test-cli.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. name: Test CLI
  2. on:
  3. pull_request:
  4. branches:
  5. - 'feat/v2'
  6. - 'feat/v2-ci'
  7. jobs:
  8. test-cli-yarn:
  9. name: "Test CLI (Yarn)"
  10. env:
  11. NODE_ENV: CI
  12. REDIS_URL: redis://localhost:6379
  13. DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
  14. POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
  15. services:
  16. redis:
  17. image: redis
  18. options: >-
  19. --health-cmd "redis-cli ping"
  20. --health-interval 10s
  21. --health-timeout 5s
  22. --health-retries 5
  23. ports:
  24. - 6379:6379
  25. postgres:
  26. image: postgres
  27. env:
  28. POSTGRES_PASSWORD: postgres
  29. POSTGRES_USER: postgres
  30. POSTGRES_DB: cli-test
  31. options: >-
  32. --health-cmd pg_isready
  33. --health-interval 10s
  34. --health-timeout 5s
  35. --health-retries 5
  36. ports:
  37. - 5432:5432
  38. runs-on: ubuntu-latest
  39. steps:
  40. - name: Checkout
  41. uses: actions/checkout@v3
  42. with:
  43. fetch-depth: 0
  44. - name: Cancel Previous Runs
  45. uses: styfle/cancel-workflow-action@0.11.0
  46. with:
  47. access_token: ${{ github.token }}
  48. - name: Setup Node.js environment
  49. uses: actions/setup-node@v3
  50. with:
  51. node-version: 20
  52. - name: Install Dependencies
  53. run: yarn install
  54. - name: Check CLI tool is installed
  55. run: ./node_modules/.bin/medusa -v
  56. - name: run build
  57. run: yarn build
  58. - name: Run migrations
  59. run: npx medusa migrations run
  60. - name: Sync links
  61. run: npx medusa links sync
  62. - name: Run seed
  63. run: yarn seed
  64. - name: Run development server
  65. run: yarn dev &
  66. - name: Wait for live server response
  67. shell: "bash"
  68. run: ./.github/scripts/wait-for-server-live.sh
  69. - name: Kill server
  70. shell: "bash"
  71. run: kill -9 $(lsof -t -i :9000)
  72. test-cli-npm:
  73. name: "Test CLI (npm)"
  74. env:
  75. NODE_ENV: CI
  76. REDIS_URL: redis://localhost:6379
  77. DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
  78. POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
  79. services:
  80. postgres:
  81. image: postgres
  82. env:
  83. POSTGRES_PASSWORD: postgres
  84. POSTGRES_USER: postgres
  85. POSTGRES_DB: cli-test
  86. options: >-
  87. --health-cmd pg_isready
  88. --health-interval 10s
  89. --health-timeout 5s
  90. --health-retries 5
  91. ports:
  92. - 5432:5432
  93. runs-on: ubuntu-latest
  94. steps:
  95. - name: Checkout
  96. uses: actions/checkout@v3
  97. with:
  98. fetch-depth: 0
  99. - name: Cancel Previous Runs
  100. uses: styfle/cancel-workflow-action@0.11.0
  101. with:
  102. access_token: ${{ github.token }}
  103. - name: Setup Node.js environment
  104. uses: actions/setup-node@v3
  105. with:
  106. node-version: 20
  107. cache: "npm"
  108. - name: Install Dependencies
  109. run: npm install
  110. - name: Check CLI tool is installed
  111. run: ./node_modules/.bin/medusa -v
  112. - name: run medusa build
  113. run: npm run build
  114. - name: Run migrations
  115. run: npx medusa migrations run
  116. - name: Sync links
  117. run: npx medusa links sync
  118. - name: Run seed
  119. run: npm run seed
  120. - name: Run development server
  121. run: npm run dev -- &
  122. - name: Wait for live server response
  123. shell: "bash"
  124. run: ./.github/scripts/wait-for-server-live.sh
  125. - name: Kill server
  126. shell: "bash"
  127. run: kill -9 $(lsof -t -i :9000)
  128. test-cli-pnpm:
  129. name: "Test CLI (pnpm)"
  130. env:
  131. NODE_ENV: CI
  132. REDIS_URL: redis://localhost:6379
  133. DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
  134. POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
  135. services:
  136. postgres:
  137. image: postgres
  138. env:
  139. POSTGRES_PASSWORD: postgres
  140. POSTGRES_USER: postgres
  141. POSTGRES_DB: cli-test
  142. options: >-
  143. --health-cmd pg_isready
  144. --health-interval 10s
  145. --health-timeout 5s
  146. --health-retries 5
  147. ports:
  148. - 5432:5432
  149. runs-on: ubuntu-latest
  150. steps:
  151. - name: Checkout
  152. uses: actions/checkout@v3
  153. with:
  154. fetch-depth: 0
  155. - name: Cancel Previous Runs
  156. uses: styfle/cancel-workflow-action@0.11.0
  157. with:
  158. access_token: ${{ github.token }}
  159. - name: Create pnpm-lock.yaml
  160. run: touch pnpm-lock.yaml
  161. - uses: pnpm/action-setup@v2
  162. with:
  163. version: 6.32.9
  164. - name: Setup Node.js environment
  165. uses: actions/setup-node@v3
  166. with:
  167. node-version: 20
  168. cache: "pnpm"
  169. - name: Install Dependencies
  170. run: pnpm install
  171. - name: Check CLI tool is installed
  172. run: ./node_modules/.bin/medusa -v
  173. - name: run medusa build
  174. run: pnpm run build
  175. - name: Run migrations
  176. run: npx medusa migrations run
  177. - name: Sync links
  178. run: npx medusa links sync
  179. - name: Run seed
  180. run: pnpm run seed
  181. - name: Run development server
  182. run: pnpm run dev -- &
  183. - name: Wait for live server response
  184. shell: "bash"
  185. run: ./.github/scripts/wait-for-server-live.sh
  186. - name: Kill server
  187. shell: "bash"
  188. run: kill -9 $(lsof -t -i :9000)