Skip to content

Commit 3f9d4bd

Browse files
Commit and export images
1 parent 4c8a7a8 commit 3f9d4bd

File tree

3 files changed

+83
-11
lines changed

3 files changed

+83
-11
lines changed

.github/workflows/e2e.yml

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- 'example.env'
4646
- '.github/workflows/e2e.yml'
4747
48-
main:
48+
build:
4949
needs: changes
5050
if: ${{ needs.changes.outputs.test-changes == 'true' }}
5151

@@ -74,9 +74,6 @@ jobs:
7474
- name: Install dependencies
7575
run: yarn install --immutable
7676

77-
- name: Install Playwright Browsers
78-
run: yarn playwright install chromium --with-deps
79-
8077
- name: Setup local cache server for Turborepo
8178
uses: felixmosh/turborepo-gh-artifacts@v3
8279
with:
@@ -92,17 +89,73 @@ jobs:
9289
- name: Wait for OpenMRS instance to start
9390
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
9491

92+
- name: Commit and export Containers
93+
run: bash e2e/support/github/commit_and_export_images.sh
94+
95+
- name: Upload artifact
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: e2e_release_env_images
99+
path: e2e_release_env_images.tar.gz
100+
retention-days: 1
101+
102+
run-patient-management-e2e-tests:
103+
runs-on: ubuntu-latest
104+
needs: build
105+
steps:
106+
- uses: actions/checkout@v4
107+
108+
- name: Create Temporary Directory to Download Docker Images
109+
id: tempdir
110+
run: echo "tmpdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
111+
112+
- name: Download Docker Images
113+
uses: actions/download-artifact@v4
114+
with:
115+
name: e2e_release_env_images
116+
path: ${{ steps.tempdir.outputs.tmpdir }}
117+
118+
- name: Load Docker Images
119+
run: |
120+
gzip -d ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar.gz
121+
docker load --input ${{ steps.tempdir.outputs.tmpdir }}/e2e_release_env_images.tar
122+
docker image ls -a
123+
124+
- name: Spin up an OpenMRS Instance
125+
run: docker compose up -d
126+
working-directory: e2e_test_support_files
127+
128+
- name: Checkout to the repo's main branch
129+
uses: actions/checkout@v4
130+
with:
131+
repository: openmrs/openmrs-esm-patient-management
132+
ref: main
133+
path: e2e_repo
134+
135+
- name: Copy test environment variables
136+
run: cp example.env .env
137+
working-directory: e2e_repo
138+
139+
- name: Install dependencies
140+
if: steps.cache.outputs.cache-hit != 'true'
141+
run: yarn install --immutable
142+
working-directory: e2e_repo
143+
144+
- name: Install Playwright Browsers
145+
run: npx playwright install chromium --with-deps
146+
working-directory: e2e_repo
147+
148+
- name: Wait for the OpenMRS instance to start
149+
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
150+
95151
- name: Run E2E tests
96152
run: yarn playwright test
153+
working-directory: e2e_repo
97154

98-
- name: Stop dev server
99-
if: '!cancelled()'
100-
run: docker stop $(docker ps -a -q)
101-
102-
- name: Upload report
155+
- name: Upload Report
103156
uses: actions/upload-artifact@v4
104157
if: always()
105158
with:
106-
name: playwright-report
107-
path: playwright-report/
159+
name: report-patient-management
160+
path: e2e_repo/playwright-report/
108161
retention-days: 30
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
backend_container_id=$(docker ps --filter "name=backend" --format "{{.ID}}")
4+
db_container_id=$(docker ps --filter "name=db" --format "{{.ID}}")
5+
frontend_container_id=$(docker ps --filter "name=frontend" --format "{{.ID}}")
6+
gateway_container_id=$(docker ps --filter "name=gateway" --format "{{.ID}}")
7+
8+
docker commit $frontend_container_id frontend
9+
docker commit $gateway_container_id gateway
10+
docker commit $backend_container_id backend
11+
docker commit $db_container_id db
12+
13+
docker save frontend gateway backend db > e2e_release_env_images.tar
14+
15+
# compress the file (to decrease the upload file size)
16+
gzip -c e2e_release_env_images.tar > e2e_release_env_images.tar.gz

e2e/support/github/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ version: "3.7"
44

55
services:
66
gateway:
7+
container_name: gateway
78
image: openmrs/openmrs-reference-application-3-gateway:${TAG:-nightly}
89
ports:
910
- "8080:80"
1011

1112
frontend:
13+
container_name: frontend
1214
build:
1315
context: .
1416
environment:
1517
SPA_PATH: /openmrs/spa
1618
API_URL: /openmrs
1719

1820
backend:
21+
container_name: backend
1922
image: openmrs/openmrs-reference-application-3-backend:nightly-with-data
2023
depends_on:
2124
- db

0 commit comments

Comments
 (0)