Skip to content

Commit 033e542

Browse files
(chore) O3-4504: Optimize Distro E2E Test Workflow Using Matrix Strategy (#911)
1 parent 45e0629 commit 033e542

File tree

1 file changed

+13
-310
lines changed

1 file changed

+13
-310
lines changed

.github/workflows/e2e-tests-on-commit.yml

+13-310
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ on:
66
pull_request:
77
branches: [main]
88

9-
jobs:
9+
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12-
1312
steps:
1413
- uses: actions/checkout@v4
1514

@@ -29,313 +28,17 @@ jobs:
2928
path: e2e_release_env_images.tar.gz
3029
retention-days: 1
3130

32-
run-patient-management-e2e-tests:
33-
runs-on: ubuntu-latest
34-
needs: build
35-
steps:
36-
- uses: actions/checkout@v4
37-
38-
- name: Create Temporary Directory to Download Docker Images
39-
id: tempdir
40-
run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
41-
42-
- name: Download Docker Images
43-
uses: actions/download-artifact@v4
44-
with:
45-
name: e2e_release_env_images
46-
path: ${{ steps.tempdir.outputs.tmpdir }}
47-
48-
- name: Load Docker Images
49-
run: |
50-
gzip -d ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar.gz
51-
docker load --input ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar
52-
docker image ls -a
53-
54-
- name: Spin up an OpenMRS Instance
55-
run: docker compose up -d
56-
working-directory: e2e_test_support_files
57-
58-
- name: Checkout to the repo's main branch
59-
uses: actions/checkout@v4
60-
with:
61-
repository: openmrs/openmrs-esm-patient-management
62-
ref: main
63-
path: e2e_repo
64-
65-
- name: Copy test environment variables
66-
run: cp example.env .env
67-
working-directory: e2e_repo
68-
69-
- name: Install dependencies
70-
if: steps.cache.outputs.cache-hit != 'true'
71-
run: yarn install --immutable
72-
working-directory: e2e_repo
73-
74-
- name: Install Playwright Browsers
75-
run: npx playwright install chromium --with-deps
76-
working-directory: e2e_repo
77-
78-
- name: Wait for the OpenMRS instance to start
79-
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
80-
81-
- name: Run E2E tests
82-
run: yarn playwright test
83-
working-directory: e2e_repo
84-
85-
- name: Upload Report
86-
uses: actions/upload-artifact@v4
87-
if: always()
88-
with:
89-
name: report-patient-management
90-
path: e2e_repo/playwright-report/
91-
retention-days: 30
92-
93-
- name: 📝 Capture Server Logs
94-
if: always()
95-
uses: jwalton/gh-docker-logs@v2
96-
with:
97-
dest: "./logs"
98-
99-
- name: 📤 Upload Logs as Artifact
100-
uses: actions/upload-artifact@v4
101-
if: always()
102-
with:
103-
name: server-logs-patient-management
104-
path: "./logs"
105-
retention-days: 2
106-
overwrite: true
107-
108-
run-patient-chart-e2e-tests:
109-
runs-on: ubuntu-latest
110-
needs: build
111-
steps:
112-
- uses: actions/checkout@v4
113-
114-
- name: Create Temporary Directory to Download Docker Images
115-
id: tempdir
116-
run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
117-
118-
- name: Download Docker Images
119-
uses: actions/download-artifact@v4
120-
with:
121-
name: e2e_release_env_images
122-
path: ${{ steps.tempdir.outputs.tmpdir }}
123-
124-
- name: Load Docker Images
125-
run: |
126-
gzip -d ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar.gz
127-
docker load --input ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar
128-
docker image ls -a
129-
130-
- name: Spin up an OpenMRS Instance
131-
run: docker compose up -d
132-
working-directory: e2e_test_support_files
133-
134-
- name: Checkout to the repo's main branch
135-
uses: actions/checkout@v4
136-
with:
137-
repository: openmrs/openmrs-esm-patient-chart
138-
ref: main
139-
path: e2e_repo
140-
141-
- name: Copy test environment variables
142-
run: cp example.env .env
143-
working-directory: e2e_repo
144-
145-
- name: Install dependencies
146-
if: steps.cache.outputs.cache-hit != 'true'
147-
run: yarn install --immutable
148-
working-directory: e2e_repo
149-
150-
- name: Install Playwright Browsers
151-
run: npx playwright install chromium --with-deps
152-
working-directory: e2e_repo
153-
154-
- name: Wait for the OpenMRS instance to start
155-
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
156-
157-
- name: Run E2E tests
158-
run: yarn playwright test
159-
working-directory: e2e_repo
160-
161-
- name: Upload Report
162-
uses: actions/upload-artifact@v4
163-
if: always()
164-
with:
165-
name: report-patient-chart
166-
path: e2e_repo/playwright-report/
167-
retention-days: 30
168-
169-
- name: 📝 Capture Server Logs
170-
if: always()
171-
uses: jwalton/gh-docker-logs@v2
172-
with:
173-
dest: "./logs"
174-
175-
- name: 📤 Upload Logs as Artifact
176-
uses: actions/upload-artifact@v4
177-
if: always()
178-
with:
179-
name: server-logs-patient-chart
180-
path: "./logs"
181-
retention-days: 2
182-
overwrite: true
183-
184-
run-form-builder-e2e-tests:
185-
runs-on: ubuntu-latest
186-
needs: build
187-
steps:
188-
- uses: actions/checkout@v4
189-
190-
- name: Create Temporary Directory to Download Docker Images
191-
id: tempdir
192-
run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
193-
194-
- name: Download Docker Images
195-
uses: actions/download-artifact@v4
196-
with:
197-
name: e2e_release_env_images
198-
path: ${{ steps.tempdir.outputs.tmpdir }}
199-
200-
- name: Load Docker Images
201-
run: |
202-
gzip -d ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar.gz
203-
docker load --input ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar
204-
docker image ls -a
205-
206-
- name: Spin up an OpenMRS Instance
207-
run: docker compose up -d
208-
working-directory: e2e_test_support_files
209-
210-
- name: Checkout to the repo's main branch
211-
uses: actions/checkout@v4
212-
with:
213-
repository: openmrs/openmrs-esm-form-builder
214-
ref: main
215-
path: e2e_repo
216-
217-
- name: Copy test environment variables
218-
run: cp example.env .env
219-
working-directory: e2e_repo
220-
221-
- name: Install dependencies
222-
if: steps.cache.outputs.cache-hit != 'true'
223-
run: yarn install --immutable
224-
working-directory: e2e_repo
225-
226-
- name: Install Playwright Browsers
227-
run: npx playwright install chromium --with-deps
228-
working-directory: e2e_repo
229-
230-
- name: Wait for the OpenMRS instance to start
231-
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
232-
233-
- name: Run E2E tests
234-
run: yarn playwright test
235-
working-directory: e2e_repo
236-
237-
- name: Upload Report
238-
uses: actions/upload-artifact@v4
239-
if: always()
240-
with:
241-
name: report-form-builder
242-
path: e2e_repo/playwright-report/
243-
retention-days: 30
244-
245-
- name: 📝 Capture Server Logs
246-
if: always()
247-
uses: jwalton/gh-docker-logs@v2
248-
with:
249-
dest: "./logs"
250-
251-
- name: 📤 Upload Logs as Artifact
252-
uses: actions/upload-artifact@v4
253-
if: always()
254-
with:
255-
name: server-logs-form-builder
256-
path: "./logs"
257-
retention-days: 2
258-
overwrite: true
259-
260-
run-esm-core-e2e-tests:
261-
runs-on: ubuntu-latest
262-
needs: build
263-
steps:
264-
- uses: actions/checkout@v4
265-
266-
- name: Create Temporary Directory to Download Docker Images
267-
id: tempdir
268-
run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
269-
270-
- name: Download Docker Images
271-
uses: actions/download-artifact@v4
272-
with:
273-
name: e2e_release_env_images
274-
path: ${{ steps.tempdir.outputs.tmpdir }}
275-
276-
- name: Load Docker Images
277-
run: |
278-
gzip -d ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar.gz
279-
docker load --input ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar
280-
docker image ls -a
281-
282-
- name: Spin up an OpenMRS Instance
283-
run: docker compose up -d
284-
working-directory: e2e_test_support_files
285-
286-
- name: Checkout to the repo's main branch
287-
uses: actions/checkout@v4
288-
with:
289-
repository: openmrs/openmrs-esm-core
290-
ref: main
291-
path: e2e_repo
292-
293-
- name: Copy test environment variables
294-
run: cp example.env .env
295-
working-directory: e2e_repo
296-
297-
- name: Install dependencies
298-
if: steps.cache.outputs.cache-hit != 'true'
299-
run: yarn install --immutable
300-
working-directory: e2e_repo
301-
302-
- name: Install Playwright Browsers
303-
run: npx playwright install chromium --with-deps
304-
working-directory: e2e_repo
305-
306-
- name: Wait for the OpenMRS instance to start
307-
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
308-
309-
- name: Run E2E tests
310-
run: yarn playwright test
311-
working-directory: e2e_repo
312-
313-
- name: Upload Report
314-
uses: actions/upload-artifact@v4
315-
if: always()
316-
with:
317-
name: report-esm-core
318-
path: e2e_repo/playwright-report/
319-
retention-days: 30
320-
321-
- name: 📝 Capture Server Logs
322-
if: always()
323-
uses: jwalton/gh-docker-logs@v2
324-
with:
325-
dest: "./logs"
326-
327-
- name: 📤 Upload Logs as Artifact
328-
uses: actions/upload-artifact@v4
329-
if: always()
330-
with:
331-
name: server-logs-esm-core
332-
path: "./logs"
333-
retention-days: 2
334-
overwrite: true
335-
336-
run-cohort-builder-e2e-tests:
31+
run-e2e-tests:
33732
runs-on: ubuntu-latest
33833
needs: build
34+
strategy:
35+
matrix:
36+
repo:
37+
- openmrs-esm-patient-management
38+
- openmrs-esm-patient-chart
39+
- openmrs-esm-form-builder
40+
- openmrs-esm-core
41+
33942
steps:
34043
- uses: actions/checkout@v4
34144

@@ -362,7 +65,7 @@ jobs:
36265
- name: Checkout to the repo's main branch
36366
uses: actions/checkout@v4
36467
with:
365-
repository: openmrs/openmrs-esm-cohortbuilder
68+
repository: openmrs/${{ matrix.repo }}
36669
ref: main
36770
path: e2e_repo
36871

@@ -390,7 +93,7 @@ jobs:
39093
uses: actions/upload-artifact@v4
39194
if: always()
39295
with:
393-
name: report-cohort-builder
96+
name: report-${{ matrix.repo }}
39497
path: e2e_repo/playwright-report/
39598
retention-days: 30
39699

@@ -404,7 +107,7 @@ jobs:
404107
uses: actions/upload-artifact@v4
405108
if: always()
406109
with:
407-
name: server-logs-cohort-builder
110+
name: server-logs-${{ matrix.repo }}
408111
path: "./logs"
409112
retention-days: 2
410113
overwrite: true

0 commit comments

Comments
 (0)