Skip to content

Commit 7702a46

Browse files
author
Janne Rönkkö
committed
DEBUG: Move setup e2e to run workflow to see better the timings
1 parent 3b518e4 commit 7702a46

File tree

1 file changed

+326
-19
lines changed

1 file changed

+326
-19
lines changed

.github/workflows/shared-run-e2e.yml

Lines changed: 326 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -153,26 +153,333 @@ jobs:
153153
matrix:
154154
containers: [1, 2, 3, 4]
155155
steps:
156-
- name: Start e2e env
157-
id: start-e2e-env
158-
uses: HSLdevcom/jore4-tools/github-actions/setup-e2e-environment@e2e-test-duration
156+
#- name: Start e2e env
157+
# id: start-e2e-env
158+
# uses: HSLdevcom/jore4-tools/github-actions/setup-e2e-environment@e2e-test-duration
159+
# with:
160+
# docker_compose_bundle_gha_artifact: "${{ inputs.docker_compose_bundle_gha_artifact }}"
161+
# ui_version: "${{ inputs.ui_version }}"
162+
# cypress_version: "${{ inputs.cypress_version }}"
163+
# hasura_version: "${{ inputs.hasura_version }}"
164+
# auth_version: "${{ inputs.auth_version }}"
165+
# mbtiles_version: "${{ inputs.mbtiles_version }}"
166+
# jore3importer_version: "${{ inputs.jore3importer_version }}"
167+
# testdb_version: "${{ inputs.testdb_version }}"
168+
# mssqltestdb_version: "${{ inputs.mssqltestdb_version }}"
169+
# mapmatching_version: "${{ inputs.mapmatching_version }}"
170+
# mapmatchingdb_version: "${{ inputs.mapmatchingdb_version }}"
171+
# hastus_version: "${{ inputs.hastus_version }}"
172+
# timetablesapi_version: "${{ inputs.timetablesapi_version }}"
173+
# tiamat_version: "${{ inputs.tiamat_version }}"
174+
# custom_docker_compose: "${{ inputs.custom_docker_compose }}"
175+
# start_jore3_importer: "${{ inputs.start_jore3_importer }}"
176+
- name: Create directory for Docker Compose bundle
177+
shell: bash
178+
run: |
179+
mkdir -p ${{ github.workspace }}/docker
180+
181+
- name: Download docker-compose bundle from GHA artifact
182+
if: ${{ inputs.docker_compose_bundle_gha_artifact }}
183+
uses: actions/download-artifact@v4
159184
with:
160-
docker_compose_bundle_gha_artifact: "${{ inputs.docker_compose_bundle_gha_artifact }}"
161-
ui_version: "${{ inputs.ui_version }}"
162-
cypress_version: "${{ inputs.cypress_version }}"
163-
hasura_version: "${{ inputs.hasura_version }}"
164-
auth_version: "${{ inputs.auth_version }}"
165-
mbtiles_version: "${{ inputs.mbtiles_version }}"
166-
jore3importer_version: "${{ inputs.jore3importer_version }}"
167-
testdb_version: "${{ inputs.testdb_version }}"
168-
mssqltestdb_version: "${{ inputs.mssqltestdb_version }}"
169-
mapmatching_version: "${{ inputs.mapmatching_version }}"
170-
mapmatchingdb_version: "${{ inputs.mapmatchingdb_version }}"
171-
hastus_version: "${{ inputs.hastus_version }}"
172-
timetablesapi_version: "${{ inputs.timetablesapi_version }}"
173-
tiamat_version: "${{ inputs.tiamat_version }}"
174-
custom_docker_compose: "${{ inputs.custom_docker_compose }}"
175-
start_jore3_importer: "${{ inputs.start_jore3_importer }}"
185+
name: jore4-docker-compose-bundle
186+
path: ${{ github.workspace }}/docker
187+
188+
- name: Download e2e docker-compose bundle from jore4-docker-compose-bundle repository
189+
if: ${{ !inputs.docker_compose_bundle_gha_artifact }}
190+
run: |
191+
curl -s -L https://github.com/HSLdevcom/jore4-docker-compose-bundle/archive/refs/heads/main.tar.gz \
192+
| tar \
193+
-xz \
194+
-C ${{ github.workspace }}/docker \
195+
--strip-components 2 \
196+
--wildcards 'jore4-docker-compose-bundle-main/docker-compose/*'
197+
shell: bash
198+
199+
- name: Pull Docker images for databases, Hasura and Tiamat
200+
# use environment variables within the docker-compose bundle to override some images
201+
env:
202+
UI_DOCKER_IMAGE: ${{ inputs.ui_version }}
203+
HASURA_DOCKER_IMAGE: ${{ inputs.hasura_version }}
204+
AUTH_DOCKER_IMAGE: ${{ inputs.auth_version }}
205+
MBTILES_DOCKER_IMAGE: ${{ inputs.mbtiles_version }}
206+
JORE3IMPORTER_DOCKER_IMAGE: ${{ inputs.jore3importer_version }}
207+
TESTDB_DOCKER_IMAGE: ${{ inputs.testdb_version }}
208+
MSSQLTESTDB_DOCKER_IMAGE: ${{ inputs.mssqltestdb_version }}
209+
MAPMATCHING_DOCKER_IMAGE: ${{ inputs.mapmatching_version }}
210+
MAPMATCHINGDB_DOCKER_IMAGE: ${{ inputs.mapmatchingdb_version }}
211+
CYPRESS_DOCKER_IMAGE: ${{ inputs.cypress_version }}
212+
HASTUS_DOCKER_IMAGE: ${{ inputs.hastus_version }}
213+
TIMETABLESAPI_DOCKER_IMAGE: ${{ inputs.timetablesapi_version }}
214+
TIAMAT_DOCKER_IMAGE: ${{ inputs.tiamat_version }}
215+
run: |
216+
time docker \
217+
compose \
218+
-f ${{ github.workspace }}/docker/docker-compose.yml \
219+
${{ inputs.custom_docker_compose != '' && format('-f {0}', inputs.custom_docker_compose) || '' }} \
220+
${{ inputs.start_jore3_importer == 'true' && '--profile importer' || '' }} \
221+
pull jore4-mapmatchingdb jore4-testdb jore4-hasura jore4-tiamat
222+
shell: bash
223+
224+
- name: Start databases, Hasura and Tiamat
225+
# use environment variables within the docker-compose bundle to override some images
226+
env:
227+
UI_DOCKER_IMAGE: ${{ inputs.ui_version }}
228+
HASURA_DOCKER_IMAGE: ${{ inputs.hasura_version }}
229+
AUTH_DOCKER_IMAGE: ${{ inputs.auth_version }}
230+
MBTILES_DOCKER_IMAGE: ${{ inputs.mbtiles_version }}
231+
JORE3IMPORTER_DOCKER_IMAGE: ${{ inputs.jore3importer_version }}
232+
TESTDB_DOCKER_IMAGE: ${{ inputs.testdb_version }}
233+
MSSQLTESTDB_DOCKER_IMAGE: ${{ inputs.mssqltestdb_version }}
234+
MAPMATCHING_DOCKER_IMAGE: ${{ inputs.mapmatching_version }}
235+
MAPMATCHINGDB_DOCKER_IMAGE: ${{ inputs.mapmatchingdb_version }}
236+
CYPRESS_DOCKER_IMAGE: ${{ inputs.cypress_version }}
237+
HASTUS_DOCKER_IMAGE: ${{ inputs.hastus_version }}
238+
TIMETABLESAPI_DOCKER_IMAGE: ${{ inputs.timetablesapi_version }}
239+
TIAMAT_DOCKER_IMAGE: ${{ inputs.tiamat_version }}
240+
run: |
241+
docker \
242+
compose \
243+
-f ${{ github.workspace }}/docker/docker-compose.yml \
244+
${{ inputs.custom_docker_compose != '' && format('-f {0}', inputs.custom_docker_compose) || '' }} \
245+
${{ inputs.start_jore3_importer == 'true' && '--profile importer' || '' }} \
246+
up -d jore4-mapmatchingdb jore4-testdb jore4-hasura jore4-tiamat
247+
shell: bash
248+
249+
- name: Pull Docker images
250+
# use environment variables within the docker-compose bundle to override some images
251+
env:
252+
UI_DOCKER_IMAGE: ${{ inputs.ui_version }}
253+
HASURA_DOCKER_IMAGE: ${{ inputs.hasura_version }}
254+
AUTH_DOCKER_IMAGE: ${{ inputs.auth_version }}
255+
MBTILES_DOCKER_IMAGE: ${{ inputs.mbtiles_version }}
256+
JORE3IMPORTER_DOCKER_IMAGE: ${{ inputs.jore3importer_version }}
257+
TESTDB_DOCKER_IMAGE: ${{ inputs.testdb_version }}
258+
MSSQLTESTDB_DOCKER_IMAGE: ${{ inputs.mssqltestdb_version }}
259+
MAPMATCHING_DOCKER_IMAGE: ${{ inputs.mapmatching_version }}
260+
MAPMATCHINGDB_DOCKER_IMAGE: ${{ inputs.mapmatchingdb_version }}
261+
CYPRESS_DOCKER_IMAGE: ${{ inputs.cypress_version }}
262+
HASTUS_DOCKER_IMAGE: ${{ inputs.hastus_version }}
263+
TIMETABLESAPI_DOCKER_IMAGE: ${{ inputs.timetablesapi_version }}
264+
TIAMAT_DOCKER_IMAGE: ${{ inputs.tiamat_version }}
265+
run: |
266+
time docker \
267+
compose \
268+
-f ${{ github.workspace }}/docker/docker-compose.yml \
269+
${{ inputs.custom_docker_compose != '' && format('-f {0}', inputs.custom_docker_compose) || '' }} \
270+
${{ inputs.start_jore3_importer == 'true' && '--profile importer' || '' }} \
271+
pull
272+
shell: bash
273+
274+
- name: Start e2e environment
275+
# use environment variables within the docker-compose bundle to override some images
276+
env:
277+
UI_DOCKER_IMAGE: ${{ inputs.ui_version }}
278+
HASURA_DOCKER_IMAGE: ${{ inputs.hasura_version }}
279+
AUTH_DOCKER_IMAGE: ${{ inputs.auth_version }}
280+
MBTILES_DOCKER_IMAGE: ${{ inputs.mbtiles_version }}
281+
JORE3IMPORTER_DOCKER_IMAGE: ${{ inputs.jore3importer_version }}
282+
TESTDB_DOCKER_IMAGE: ${{ inputs.testdb_version }}
283+
MSSQLTESTDB_DOCKER_IMAGE: ${{ inputs.mssqltestdb_version }}
284+
MAPMATCHING_DOCKER_IMAGE: ${{ inputs.mapmatching_version }}
285+
MAPMATCHINGDB_DOCKER_IMAGE: ${{ inputs.mapmatchingdb_version }}
286+
CYPRESS_DOCKER_IMAGE: ${{ inputs.cypress_version }}
287+
HASTUS_DOCKER_IMAGE: ${{ inputs.hastus_version }}
288+
TIMETABLESAPI_DOCKER_IMAGE: ${{ inputs.timetablesapi_version }}
289+
TIAMAT_DOCKER_IMAGE: ${{ inputs.tiamat_version }}
290+
run: |
291+
docker \
292+
compose \
293+
-f ${{ github.workspace }}/docker/docker-compose.yml \
294+
${{ inputs.custom_docker_compose != '' && format('-f {0}', inputs.custom_docker_compose) || '' }} \
295+
${{ inputs.start_jore3_importer == 'true' && '--profile importer' || '' }} \
296+
up -d
297+
shell: bash
298+
299+
- name: Show which versions of the docker images are spun up
300+
run: docker ps
301+
shell: bash
302+
303+
- name: Verify that UI is up and running standalone
304+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
305+
with:
306+
command: "curl --fail http://localhost:3302 --output /dev/null --silent"
307+
308+
- name: Verify that UI is up and running through proxy
309+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
310+
with:
311+
command: "curl --fail http://localhost:3300 --output /dev/null --silent"
312+
313+
- name: Verify that postgresql is up and running
314+
id: verify_postgresql_started
315+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
316+
with:
317+
command: "pg_isready -h localhost -p 6432"
318+
# it takes a while for the database to start
319+
retries: 50
320+
321+
- name: Show PostgreSQL logs
322+
if: ${{ failure() && steps.verify_postgresql_started.outcome == 'failure' }}
323+
run: |
324+
docker logs testdb
325+
shell: bash
326+
327+
- name: Verify that mssql testdb is up and running
328+
id: verify_mssql_started
329+
if: ${{ inputs.start_jore3_importer == 'true' }}
330+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
331+
env:
332+
SA_PASSWORD: "P@ssw0rd"
333+
with:
334+
# The IP address of MS SQL Docker container is retrieved using docker inspect because the container
335+
# does not have a predefined or predictable hostname. A predefined hostname could be added in docker
336+
# compose bundle.
337+
command:
338+
docker run
339+
--rm
340+
--network docker_jore4
341+
$(docker inspect mssqltestdb | jq -r '.[0].Config.Image')
342+
/opt/mssql-tools18/bin/sqlcmd
343+
-C
344+
-S $(docker inspect mssqltestdb | jq -r '.[0].NetworkSettings'.Networks.docker_jore4.IPAddress)
345+
-U sa
346+
-P "$SA_PASSWORD"
347+
-d master
348+
-Q "SELECT ''OK'';"
349+
# it takes a while for the database to start
350+
retries: 50
351+
352+
# on some rare occasions unfortunately this is failing...
353+
- name: Show MSSQL logs
354+
if: ${{ failure() && steps.verify_mssql_started.outcome == 'failure' }}
355+
run: |
356+
docker logs mssqltestdb
357+
shell: bash
358+
359+
- name: Verify that hasura is up and running standalone
360+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
361+
with:
362+
command: "curl --fail http://localhost:3201/healthz --output /dev/null --silent"
363+
364+
- name: Verify that hasura is up and running through proxy
365+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
366+
with:
367+
command: "curl --fail http://localhost:3300/api/graphql/healthz --output
368+
/dev/null --silent"
369+
370+
- name: Verify that auth backend is up and running standalone
371+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
372+
with:
373+
command:
374+
"curl --fail http://localhost:3200/actuator/health --output /dev/null
375+
--silent"
376+
377+
- name: Verify that auth backend has access to database
378+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
379+
with:
380+
command:
381+
"curl --fail http://localhost:3200/public/v1/login --output /dev/null
382+
--silent"
383+
384+
- name: Verify that auth backend is up and running through proxy
385+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
386+
with:
387+
command:
388+
"curl --fail http://localhost:3300/api/auth/actuator/health --output
389+
/dev/null --silent"
390+
391+
- name: Verify that mbtiles server is up and running standalone
392+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
393+
with:
394+
command: "curl --fail http://localhost:3203/services --output /dev/null
395+
--silent"
396+
397+
- name: Verify that mbtiles server is up and running through proxy
398+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
399+
with:
400+
command:
401+
"curl --fail http://localhost:3300/api/mbtiles/services --output
402+
/dev/null --silent"
403+
404+
- name: Verify that jore3 importer is up and running standalone
405+
if: ${{ inputs.start_jore3_importer == 'true' }}
406+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
407+
with:
408+
command:
409+
"curl --fail http://localhost:3004/actuator/health --output /dev/null
410+
--silent"
411+
412+
- name: Verify that map matching database is up and running standalone
413+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
414+
with:
415+
command: "pg_isready -h localhost -p 6433"
416+
417+
- name: Verify that map matching server is up and running standalone
418+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
419+
with:
420+
command:
421+
"curl --fail http://localhost:3005/actuator/health --output /dev/null
422+
--silent"
423+
424+
- name: Verify that map matching server is up and running through proxy
425+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
426+
with:
427+
command:
428+
"curl --fail http://localhost:3300/api/mapmatching/actuator/health
429+
--output /dev/null --silent"
430+
431+
- name: Verify that cypress test container is up and running standalone
432+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
433+
with:
434+
command: "docker exec cypress yarn cypress --version"
435+
436+
- name: Verify that hastus importer is up and running standalone
437+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
438+
with:
439+
command:
440+
"curl --fail http://localhost:3008/actuator/health --output /dev/null
441+
--silent"
442+
443+
- name: Verify that hastus importer is up and running through proxy
444+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
445+
with:
446+
command:
447+
"curl --fail http://localhost:3300/api/hastus/actuator/health --output
448+
/dev/null --silent"
449+
450+
- name: Verify that timetables-api is up and running standalone
451+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
452+
with:
453+
command: "curl --fail http://localhost:3009/actuator/health --output
454+
/dev/null --silent"
455+
456+
- name: Verify that tiamat is up and running standalone
457+
uses: HSLdevcom/jore4-tools/github-actions/healthcheck@healthcheck-v1
458+
with:
459+
command: "curl --fail http://localhost:3010/actuator/health --output
460+
/dev/null --silent"
461+
462+
- name: Reload Hasura metadata to re-establish connection to Tiamat
463+
# Hasura remote schema will break if it cannot establish connection on startup. Force reload after everything is running.
464+
env:
465+
HASURA_PASSWORD: "hasura"
466+
run: |
467+
curl --header "Content-Type: application/json" \
468+
--header "x-hasura-admin-secret: $HASURA_PASSWORD" \
469+
--request POST \
470+
--data '{"type":"reload_metadata","args":{"reload_remote_schemas":true,"reload_sources":true}}' \
471+
localhost:3201/v1/metadata
472+
shell: bash
473+
474+
- name: Verify that all containers are healthy
475+
run: '[ -z "$(docker ps -q --filter health=unhealthy)" ]'
476+
shell: bash
477+
478+
- name: Extract metadata
479+
id: extract-metadata
480+
shell: bash
481+
run: |
482+
echo e2e_source_commit_sha=$(docker inspect cypress -f '{{ .Config.Labels.git_sha }}') >> ${GITHUB_OUTPUT}
176483
177484
- name: Seed infrastructure links
178485
uses: HSLdevcom/jore4-tools/github-actions/seed-infrastructure-links@seed-infrastructure-links-v3

0 commit comments

Comments
 (0)