test-cli.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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)