|
1
|
name: CLI Pipeline |
|
2
|
on: |
|
3
|
pull_request: |
|
4
|
|
|
5
|
jobs: |
|
6
|
test-cli-with-database: |
|
7
|
env: |
|
8
|
NODE_ENV: CI |
|
9
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} |
|
10
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} |
|
11
|
REDIS_URL: redis://localhost:6379 |
|
12
|
DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test" |
|
13
|
NPM_CONFIG_LOGLEVEL: error |
|
14
|
NPM_CONFIG_AUDIT: false |
|
15
|
NPM_CONFIG_FUND: false |
|
16
|
NPM_CONFIG_UPDATE_NOTIFIER: false |
|
17
|
services: |
|
18
|
redis: |
|
19
|
image: redis |
|
20
|
options: >- |
|
21
|
--health-cmd "redis-cli ping" |
|
22
|
--health-interval 1s |
|
23
|
--health-timeout 10s |
|
24
|
--health-retries 10 |
|
25
|
ports: |
|
26
|
- 6379:6379 |
|
27
|
|
|
28
|
postgres: |
|
29
|
image: postgres:15-alpine |
|
30
|
env: |
|
31
|
POSTGRES_PASSWORD: postgres |
|
32
|
POSTGRES_USER: postgres |
|
33
|
POSTGRES_DB: cli-test |
|
34
|
options: >- |
|
35
|
--health-cmd pg_isready |
|
36
|
--health-interval 1s |
|
37
|
--health-timeout 10s |
|
38
|
--health-retries 10 |
|
39
|
ports: |
|
40
|
- 5432:5432 |
|
41
|
|
|
42
|
runs-on: ubuntu-latest |
|
43
|
steps: |
|
44
|
- name: Checkout |
|
45
|
uses: actions/checkout@v4 |
|
46
|
with: |
|
47
|
fetch-depth: 100 |
|
48
|
|
|
49
|
- name: Setup Node.js environment |
|
50
|
uses: actions/setup-node@v4 |
|
51
|
with: |
|
52
|
node-version: 22 |
|
53
|
|
|
54
|
- name: Install dependencies |
|
55
|
uses: ./.github/actions/cache-deps |
|
56
|
with: |
|
57
|
extension: cli-database |
|
58
|
|
|
59
|
- name: Setup pnpm |
|
60
|
uses: pnpm/action-setup@v4 |
|
61
|
with: |
|
62
|
version: 10.11.1 |
|
63
|
|
|
64
|
- name: Install Medusa cli |
|
65
|
run: npm i -g @medusajs/cli@preview |
|
66
|
|
|
67
|
- name: Create Medusa project |
|
68
|
working-directory: .. |
|
69
|
run: | |
|
70
|
medusa new cli-test --skip-db --skip-migrations --branch ci-custom |
|
71
|
|
|
72
|
- name: Install new app dependencies (via resolutions) |
|
73
|
run: rm -f pnpm-lock.yaml && pnpm install --prefer-frozen-lockfile=false |
|
74
|
working-directory: ../cli-test |
|
75
|
|
|
76
|
- name: Run migrations |
|
77
|
run: npx medusa db:migrate |
|
78
|
working-directory: ../cli-test/apps/backend |
|
79
|
|
|
80
|
- name: Create admin user |
|
81
|
run: npx medusa user -e test@test.com -p password -i admin_123 |
|
82
|
working-directory: ../cli-test/apps/backend |
|
83
|
|
|
84
|
- name: Run development server |
|
85
|
run: npx medusa develop & |
|
86
|
working-directory: ../cli-test/apps/backend |
|
87
|
|
|
88
|
- name: Testing development server |
|
89
|
uses: ./.github/actions/test-server |
|
90
|
|
|
91
|
- name: Starting medusa |
|
92
|
run: npx medusa start & |
|
93
|
working-directory: ../cli-test/apps/backend |
|
94
|
|
|
95
|
- name: Testing server |
|
96
|
uses: ./.github/actions/test-server |