@@ -27,6 +27,10 @@ concurrency:
2727 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
2828 cancel-in-progress : true
2929
30+ # NOTE: The Elasticsearch and Redis service definitions are duplicated across the e2e-* jobs
31+ # because GitHub Actions does not support YAML anchors or service definition reuse.
32+ # When updating these services (version bumps, env changes, health checks), update ALL four copies:
33+ # e2e-sqljs, e2e-mariadb, e2e-mysql, e2e-postgres.
3034jobs :
3135 codegen :
3236 uses : ./.github/workflows/codegen.yml
3539 runs-on : ubuntu-latest
3640 permissions :
3741 contents : read
38- strategy :
39- matrix :
40- node : [20.x, 22.x, 24.x]
4142 steps :
4243 - uses : actions/checkout@v4
43- - name : Use Node.js ${{ matrix.node }}
44- uses : actions/setup-node@v4
45- with :
46- node-version : ${{ matrix.node }}
47- - name : npm install
48- run : |
49- npm install
50- npm install --os=linux --cpu=x64 sharp
44+ - uses : ./.github/actions/setup
5145 - name : Build
5246 run : npm run build
5347 unit-tests :
@@ -56,24 +50,113 @@ jobs:
5650 permissions :
5751 contents : read
5852 strategy :
53+ fail-fast : false
5954 matrix :
6055 node : [20.x, 22.x, 24.x]
6156 steps :
6257 - uses : actions/checkout@v4
63- - name : Use Node.js ${{ matrix.node }}
64- uses : actions/setup-node@v4
58+ - uses : ./.github/actions/setup
6559 with :
6660 node-version : ${{ matrix.node }}
67- - name : npm install
68- run : |
69- npm install
70- npm install --os=linux --cpu=x64 sharp
7161 - name : Build
7262 run : npx lerna run ci
7363 - name : Unit tests
7464 run : npm run test
75- e2e-tests :
76- name : e2e tests
65+ dashboard-changes :
66+ name : check dashboard changes
67+ runs-on : ubuntu-latest
68+ permissions :
69+ contents : read
70+ outputs :
71+ changed : ${{ steps.check.outputs.changed }}
72+ steps :
73+ - uses : actions/checkout@v4
74+ with :
75+ fetch-depth : 0
76+ - name : Check for dashboard changes
77+ id : check
78+ run : |
79+ base="${{ github.event.pull_request.base.sha }}"
80+ if [ -z "$base" ]; then base="${{ github.event.before }}"; fi
81+ if [ -z "$base" ]; then base="HEAD~1"; fi
82+ if git diff --name-only "$base" HEAD | grep -q '^packages/dashboard/'; then
83+ echo "changed=true" >> "$GITHUB_OUTPUT"
84+ else
85+ echo "changed=false" >> "$GITHUB_OUTPUT"
86+ fi
87+ dashboard-e2e :
88+ name : dashboard e2e
89+ needs : dashboard-changes
90+ if : needs.dashboard-changes.outputs.changed == 'true'
91+ runs-on : ubuntu-latest
92+ permissions :
93+ contents : read
94+ steps :
95+ - uses : actions/checkout@v4
96+ - uses : ./.github/actions/setup
97+ - name : Build
98+ run : npx lerna run ci
99+ - name : Cache Playwright browsers
100+ id : playwright-cache
101+ uses : actions/cache@v4
102+ with :
103+ path : ~/.cache/ms-playwright
104+ key : playwright-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
105+ - name : Install Playwright browsers
106+ if : steps.playwright-cache.outputs.cache-hit != 'true'
107+ run : npx playwright install chromium
108+ working-directory : packages/dashboard
109+ - name : Install Playwright system deps
110+ run : npx playwright install-deps chromium
111+ working-directory : packages/dashboard
112+ - name : Dashboard e2e tests
113+ run : npm run e2e:pw
114+ working-directory : packages/dashboard
115+ e2e-sqljs :
116+ name : e2e (sqljs)
117+ runs-on : ubuntu-latest
118+ permissions :
119+ contents : read
120+ services :
121+ elastic :
122+ image : docker.elastic.co/elasticsearch/elasticsearch:7.1.1
123+ env :
124+ discovery.type : single-node
125+ bootstrap.memory_lock : true
126+ ES_JAVA_OPTS : -Xms512m -Xmx512m
127+ # Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
128+ # be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
129+ # > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
130+ # e2e tests from failing.
131+ cluster.routing.allocation.disk.watermark.low : 500mb
132+ cluster.routing.allocation.disk.watermark.high : 200mb
133+ cluster.routing.allocation.disk.watermark.flood_stage : 100mb
134+ ports :
135+ - 9200
136+ options : --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
137+ redis :
138+ image : redis:7.4.1
139+ ports :
140+ - 6379
141+ strategy :
142+ fail-fast : false
143+ matrix :
144+ node : ${{ github.event_name == 'pull_request' && fromJSON('["22.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
145+ steps :
146+ - uses : actions/checkout@v4
147+ - uses : ./.github/actions/setup
148+ with :
149+ node-version : ${{ matrix.node }}
150+ - name : Build
151+ run : npx lerna run ci
152+ - name : e2e tests
153+ env :
154+ E2E_ELASTIC_PORT : ${{ job.services.elastic.ports['9200'] }}
155+ E2E_REDIS_PORT : ${{ job.services.redis.ports['6379'] }}
156+ DB : sqljs
157+ run : npm run e2e
158+ e2e-mariadb :
159+ name : e2e (mariadb)
77160 runs-on : ubuntu-latest
78161 permissions :
79162 contents : read
@@ -87,13 +170,93 @@ jobs:
87170 ports :
88171 - 3306
89172 options : --health-cmd="mariadb-admin ping -h localhost -u vendure -ppassword" --health-interval=10s --health-timeout=5s --health-retries=3
173+ elastic :
174+ image : docker.elastic.co/elasticsearch/elasticsearch:7.1.1
175+ env :
176+ discovery.type : single-node
177+ bootstrap.memory_lock : true
178+ ES_JAVA_OPTS : -Xms512m -Xmx512m
179+ cluster.routing.allocation.disk.watermark.low : 500mb
180+ cluster.routing.allocation.disk.watermark.high : 200mb
181+ cluster.routing.allocation.disk.watermark.flood_stage : 100mb
182+ ports :
183+ - 9200
184+ options : --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
185+ redis :
186+ image : redis:7.4.1
187+ ports :
188+ - 6379
189+ strategy :
190+ fail-fast : false
191+ matrix :
192+ node : ${{ github.event_name == 'pull_request' && fromJSON('["22.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
193+ steps :
194+ - uses : actions/checkout@v4
195+ - uses : ./.github/actions/setup
196+ with :
197+ node-version : ${{ matrix.node }}
198+ - name : Build
199+ run : npx lerna run ci
200+ - name : e2e tests
201+ env :
202+ E2E_MARIADB_PORT : ${{ job.services.mariadb.ports['3306'] }}
203+ E2E_ELASTIC_PORT : ${{ job.services.elastic.ports['9200'] }}
204+ E2E_REDIS_PORT : ${{ job.services.redis.ports['6379'] }}
205+ DB : mariadb
206+ run : npm run e2e
207+ e2e-mysql :
208+ name : e2e (mysql)
209+ runs-on : ubuntu-latest
210+ permissions :
211+ contents : read
212+ services :
90213 mysql :
91214 image : vendure/mysql-8-native-auth:latest
92215 env :
93216 MYSQL_ROOT_PASSWORD : password
94217 ports :
95218 - 3306
96219 options : --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=20s --health-retries=10
220+ elastic :
221+ image : docker.elastic.co/elasticsearch/elasticsearch:7.1.1
222+ env :
223+ discovery.type : single-node
224+ bootstrap.memory_lock : true
225+ ES_JAVA_OPTS : -Xms512m -Xmx512m
226+ cluster.routing.allocation.disk.watermark.low : 500mb
227+ cluster.routing.allocation.disk.watermark.high : 200mb
228+ cluster.routing.allocation.disk.watermark.flood_stage : 100mb
229+ ports :
230+ - 9200
231+ options : --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
232+ redis :
233+ image : redis:7.4.1
234+ ports :
235+ - 6379
236+ strategy :
237+ fail-fast : false
238+ matrix :
239+ node : ${{ github.event_name == 'pull_request' && fromJSON('["22.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
240+ steps :
241+ - uses : actions/checkout@v4
242+ - uses : ./.github/actions/setup
243+ with :
244+ node-version : ${{ matrix.node }}
245+ - name : Build
246+ run : npx lerna run ci
247+ - name : e2e tests
248+ env :
249+ E2E_MYSQL_PORT : ${{ job.services.mysql.ports['3306'] }}
250+ E2E_ELASTIC_PORT : ${{ job.services.elastic.ports['9200'] }}
251+ E2E_REDIS_PORT : ${{ job.services.redis.ports['6379'] }}
252+ DB : mysql
253+ run : npm run e2e
254+ e2e-postgres :
255+ name : e2e (postgres)
256+ runs-on : ubuntu-latest
257+ permissions :
258+ contents : read
259+ services :
97260 postgres :
98261 image : postgres:16
99262 env :
@@ -108,10 +271,6 @@ jobs:
108271 discovery.type : single-node
109272 bootstrap.memory_lock : true
110273 ES_JAVA_OPTS : -Xms512m -Xmx512m
111- # Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
112- # be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
113- # > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
114- # e2e tests from failing.
115274 cluster.routing.allocation.disk.watermark.low : 500mb
116275 cluster.routing.allocation.disk.watermark.high : 200mb
117276 cluster.routing.allocation.disk.watermark.flood_stage : 100mb
@@ -125,26 +284,18 @@ jobs:
125284 strategy :
126285 fail-fast : false
127286 matrix :
128- node : [20.x, 22.x, 24.x]
129- db : [sqljs, mariadb, mysql, postgres]
287+ node : ${{ github.event_name == 'pull_request' && fromJSON('["22.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
130288 steps :
131289 - uses : actions/checkout@v4
132- - name : Use Node.js ${{ matrix.node }}
133- uses : actions/setup-node@v4
290+ - uses : ./.github/actions/setup
134291 with :
135292 node-version : ${{ matrix.node }}
136- - name : npm install
137- run : |
138- npm install
139- npm install --os=linux --cpu=x64 sharp
140293 - name : Build
141294 run : npx lerna run ci
142295 - name : e2e tests
143296 env :
144- E2E_MYSQL_PORT : ${{ job.services.mysql.ports['3306'] }}
145- E2E_MARIADB_PORT : ${{ job.services.mariadb.ports['3306'] }}
146297 E2E_POSTGRES_PORT : ${{ job.services.postgres.ports['5432'] }}
147298 E2E_ELASTIC_PORT : ${{ job.services.elastic.ports['9200'] }}
148299 E2E_REDIS_PORT : ${{ job.services.redis.ports['6379'] }}
149- DB : ${{ matrix.db }}
300+ DB : postgres
150301 run : npm run e2e
0 commit comments