test-cli.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. name: Test CLI
  2. on:
  3. pull_request:
  4. jobs:
  5. test-cli-yarn:
  6. env:
  7. NODE_ENV: CI
  8. REDIS_URL: redis://localhost:6379
  9. DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
  10. POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
  11. services:
  12. redis:
  13. image: redis
  14. options: >-
  15. --health-cmd "redis-cli ping"
  16. --health-interval 10s
  17. --health-timeout 5s
  18. --health-retries 5
  19. ports:
  20. - 6379:6379
  21. postgres:
  22. image: postgres
  23. env:
  24. POSTGRES_PASSWORD: postgres
  25. POSTGRES_USER: postgres
  26. POSTGRES_DB: cli-test
  27. options: >-
  28. --health-cmd pg_isready
  29. --health-interval 10s
  30. --health-timeout 5s
  31. --health-retries 5
  32. ports:
  33. - 5432:5432
  34. runs-on: ubuntu-latest
  35. steps:
  36. - name: Checkout
  37. uses: actions/checkout@v3
  38. with:
  39. fetch-depth: 0
  40. - name: Cancel Previous Runs
  41. uses: styfle/cancel-workflow-action@0.11.0
  42. with:
  43. access_token: ${{ github.token }}
  44. - name: Setup Node.js environment
  45. uses: actions/setup-node@v3
  46. with:
  47. node-version: 20
  48. cache: "yarn"
  49. - name: Install Dependencies
  50. run: yarn install
  51. - name: run medusa build
  52. run: yarn build
  53. - name: Run migrations
  54. run: npx medusa migrations run
  55. - name: Run seed
  56. run: yarn seed
  57. - name: Run development server
  58. run: yarn dev
  59. - name: Wait for live server response
  60. shell: "bash"
  61. run: ./.github/scripts/wait-for-server-live.sh
  62. - name: Kill server
  63. shell: "bash"
  64. run: kill -9 $(lsof -t -i :9000)
  65. test-cli-npm:
  66. env:
  67. NODE_ENV: CI
  68. REDIS_URL: redis://localhost:6379
  69. DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
  70. POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
  71. services:
  72. postgres:
  73. image: postgres
  74. env:
  75. POSTGRES_PASSWORD: postgres
  76. POSTGRES_USER: postgres
  77. POSTGRES_DB: cli-test
  78. options: >-
  79. --health-cmd pg_isready
  80. --health-interval 10s
  81. --health-timeout 5s
  82. --health-retries 5
  83. ports:
  84. - 5432:5432
  85. runs-on: ubuntu-latest
  86. steps:
  87. - name: Checkout
  88. uses: actions/checkout@v3
  89. with:
  90. fetch-depth: 0
  91. - name: Cancel Previous Runs
  92. uses: styfle/cancel-workflow-action@0.11.0
  93. with:
  94. access_token: ${{ github.token }}
  95. - name: Setup Node.js environment
  96. uses: actions/setup-node@v3
  97. with:
  98. node-version: 20
  99. cache: "npm"
  100. - name: Install Dependencies
  101. run: npm install
  102. - name: run medusa build
  103. run: npm build
  104. - name: Run migrations
  105. run: npx medusa migrations run
  106. - name: Run seed
  107. run: npm seed
  108. - name: Run development server
  109. run: npm run dev
  110. - name: Wait for live server response
  111. shell: "bash"
  112. run: ./.github/scripts/wait-for-server-live.sh
  113. - name: Kill server
  114. shell: "bash"
  115. run: kill -9 $(lsof -t -i :9000)