Skip to content

Commit 406b16a

Browse files
author
Janne Rönkkö
committed
Add GHA workflow for running E2E tests in parallel
This workflow basically copies the run-ci action. The run-ci action is not removed as it is currently being used, i.e. the run-ci action will be removed after all repositories have been converted to use the new shared-run-e2e workflow.
1 parent ce0ea87 commit 406b16a

File tree

2 files changed

+218
-0
lines changed

2 files changed

+218
-0
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
run_e2e_tests_workflow:
8+
name: Test run E2E tests workflow
9+
uses: ./.github/workflows/shared-run-e2e.yml
10+
with:
11+
test-tags: ''
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
---
2+
name: Build and publish Docker Image
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
docker_compose_bundle_gha_artifact:
8+
description:
9+
Name of GitHub Actions artifact from which the Docker Compose bundle
10+
can be found. If not set, the bundle is downloaded from jore4-docker-compose-bundle
11+
Git repository's main branch.
12+
type: string
13+
required: false
14+
default: null
15+
ui_version:
16+
description:
17+
Version of ui to use (docker image tag). Set to "" if using the default
18+
version.
19+
type: string
20+
required: false
21+
default: ""
22+
hasura_version:
23+
description:
24+
Version of hasura to use (docker image tag). Set to "" if using the
25+
default version.
26+
type: string
27+
required: false
28+
default: ""
29+
auth_version:
30+
description:
31+
Version of auth to use (docker image tag). Set to "" if using the default
32+
version.
33+
type: string
34+
required: false
35+
default: ""
36+
mbtiles_version:
37+
description:
38+
Version of mbtiles server to use (docker image tag). Set to "" if using
39+
the default version.
40+
type: string
41+
required: false
42+
default: ""
43+
jore3importer_version:
44+
description:
45+
Version of jore3importer to use (docker image tag). Set to "" if using the
46+
default version.
47+
type: string
48+
required: false
49+
default: ""
50+
testdb_version:
51+
description:
52+
Version of testdb to use (docker image tag). Set to "" if using the
53+
default version.
54+
type: string
55+
required: false
56+
default: ""
57+
mssqltestdb_version:
58+
description:
59+
Version of mssqltestdb to use (docker image tag). Set to "" if using the
60+
default version.
61+
type: string
62+
required: false
63+
default: ""
64+
mapmatching_version:
65+
description:
66+
Version of map matching service to use (docker image tag). Set to "" if
67+
using the default version.
68+
type: string
69+
required: false
70+
default: ""
71+
mapmatchingdb_version:
72+
description:
73+
Version of map matching database to use (docker image tag). Set to "" if
74+
using the default version.
75+
type: string
76+
required: false
77+
default: ""
78+
cypress_version:
79+
description:
80+
Version of cypress tests to use (docker image tag). Set to "" if using the
81+
default version.
82+
type: string
83+
required: false
84+
default: ""
85+
hastus_version:
86+
description:
87+
Version of hastus importer to use (docker image tag). Set to "" if using
88+
the default version.
89+
type: string
90+
required: false
91+
default: ""
92+
timetablesapi_version:
93+
description:
94+
Version of timetables api to use (docker image tag). Set to "" if using
95+
the default version.
96+
type: string
97+
required: false
98+
default: ""
99+
tiamat_version:
100+
description: Version of tiamat to use (docker image tag). Set to "" if using
101+
the default version.
102+
type: string
103+
required: false
104+
default: ""
105+
custom_docker_compose:
106+
description:
107+
Path for an additional docker-compose file to be used when starting up the
108+
environment. Can be used to e.g. run tests with the repository's own
109+
docker-compose.custom.yml setup
110+
type: string
111+
required: false
112+
default: ""
113+
start_jore3_importer:
114+
description: Should Jore3 importer be started along the rest of the e2e environment.
115+
type: string
116+
required: false
117+
default: "false"
118+
test-tags:
119+
description:
120+
Specify a string of tags for tests to be run in format '@smoke'. To
121+
specify multiple tags, use format '@routes @smoke'. To run all tests, set
122+
it to ''.
123+
type: string
124+
required: false
125+
default: "@smoke"
126+
video:
127+
description:
128+
Turn video on or off. Supported values are 'true' and 'false'.
129+
type: string
130+
required: false
131+
default: 'false'
132+
133+
jobs:
134+
run_e2e_tests:
135+
name: Run e2e tests
136+
runs-on: ubuntu-24.04
137+
strategy:
138+
fail-fast: false
139+
matrix:
140+
containers: [1, 2, 3, 4]
141+
steps:
142+
- name: Start e2e env
143+
id: start-e2e-env
144+
uses: HSLdevcom/jore4-tools/github-actions/setup-e2e-environment@setup-e2e-environment-v9
145+
with:
146+
docker_compose_bundle_gha_artifact: "${{ inputs.docker_compose_bundle_gha_artifact }}"
147+
ui_version: "${{ inputs.ui_version }}"
148+
cypress_version: "${{ inputs.cypress_version }}"
149+
hasura_version: "${{ inputs.hasura_version }}"
150+
auth_version: "${{ inputs.auth_version }}"
151+
mbtiles_version: "${{ inputs.mbtiles_version }}"
152+
jore3importer_version: "${{ inputs.jore3importer_version }}"
153+
testdb_version: "${{ inputs.testdb_version }}"
154+
mssqltestdb_version: "${{ inputs.mssqltestdb_version }}"
155+
mapmatching_version: "${{ inputs.mapmatching_version }}"
156+
mapmatchingdb_version: "${{ inputs.mapmatchingdb_version }}"
157+
hastus_version: "${{ inputs.hastus_version }}"
158+
timetablesapi_version: "${{ inputs.timetablesapi_version }}"
159+
tiamat_version: "${{ inputs.tiamat_version }}"
160+
custom_docker_compose: "${{ inputs.custom_docker_compose }}"
161+
start_jore3_importer: "${{ inputs.start_jore3_importer }}"
162+
163+
- name: Seed infrastructure links
164+
uses: HSLdevcom/jore4-tools/github-actions/seed-infrastructure-links@seed-infrastructure-links-v3
165+
with:
166+
seed_data_commit_sha: "${{ steps.start-e2e-env.outputs.e2e_source_commit_sha }}"
167+
168+
- name: Seed municipalities and fare zones
169+
uses: HSLdevcom/jore4-tools/github-actions/seed-municipalities-and-fare-zones@seed-municipalities-and-fare-zones-v2
170+
with:
171+
seed_data_commit_sha: "${{ steps.start-e2e-env.outputs.e2e_source_commit_sha }}"
172+
173+
- name: Run the tests
174+
shell: bash
175+
run: |
176+
docker exec \
177+
-e TEST_TAGS="${{ inputs.test-tags }}" \
178+
-e TEST_VIDEO="${{ inputs.video }}" \
179+
-e SPLIT="${{ strategy.job-total }}" \
180+
-e SPLIT_INDEX="${{ strategy.job-index }}" \
181+
cypress /e2e/cypress/run_cypress_in_4K_xvfb.sh
182+
183+
- name: Copy test reports from Cypress container
184+
id: copy_test_reports
185+
# Should be run especially when tests fail
186+
if: always()
187+
shell: bash
188+
run: |
189+
docker cp cypress:/e2e/cypress/reports ${{ github.workspace }}/test-reports || true
190+
191+
if [[ -d test-reports ]]
192+
then
193+
# List files in test-reports directory
194+
find test-reports -type f
195+
test_reports_exist=true
196+
else
197+
test_reports_exist=false
198+
fi
199+
200+
echo "test_reports_exist=${test_reports_exist}" >> $GITHUB_OUTPUT
201+
202+
- name: Upload test reports as an artifact
203+
if: always() && steps.copy_test_reports.outputs.test_reports_exist == 'true'
204+
uses: actions/upload-artifact@v4
205+
with:
206+
name: cypress-docker-reports-${{ strategy.job-index }}
207+
path: ${{ github.workspace }}/test-reports

0 commit comments

Comments
 (0)