From 3f22e19cf5926f5e603b217c3d86a244f63b791b Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Fri, 26 Jul 2024 13:32:31 +0100 Subject: [PATCH] ci: add frontend e2e test workflow during pr and deploy --- .github/workflows/build_and_deploy.yml | 28 ++++++++++++++++++-------- .github/workflows/pr_test_frontend.yml | 15 +++++++++----- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 1246905e8..73c854a66 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -16,8 +16,8 @@ on: workflow_dispatch: jobs: - pytest: - uses: hotosm/gh-workflows/.github/workflows/test_compose.yml@1.6.0 + backend-test: + uses: hotosm/gh-workflows/.github/workflows/test_compose.yml@2.0.0 with: image_name: ghcr.io/${{ github.repository }}/backend build_context: src/backend @@ -28,22 +28,34 @@ jobs: coverage: true secrets: inherit - frontend-tests: - uses: hotosm/gh-workflows/.github/workflows/test_pnpm.yml@1.6.0 + frontend-unit-test: + uses: hotosm/gh-workflows/.github/workflows/test_pnpm.yml@2.0.0 with: working_dir: src/frontend + frontend-e2e-test: + uses: hotosm/gh-workflows/.github/workflows/test_compose.yml@2.0.0 + with: + image_name: mcr.microsoft.com/playwright:v1.44.1 + build_img: false + compose_file: docker-compose.yml -f contrib/playwright/docker-compose.yml + compose_service: ui-test + cache_extra_imgs: | + "docker.io/postgis/postgis:${{ vars.POSTGIS_TAG }}" + "docker.io/minio/minio:${{ vars.MINIO_TAG }}" + secrets: inherit + backend-build: - uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.6.0 - needs: [pytest] + uses: hotosm/gh-workflows/.github/workflows/image_build.yml@2.0.0 + needs: [backend-test] with: context: src/backend build_target: prod image_name: ghcr.io/${{ github.repository }}/backend frontend-build: - uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.6.0 - needs: [frontend-tests] + uses: hotosm/gh-workflows/.github/workflows/image_build.yml@2.0.0 + needs: [frontend-unit-test, frontend-e2e-test] with: context: src/frontend dockerfile: prod.dockerfile diff --git a/.github/workflows/pr_test_frontend.yml b/.github/workflows/pr_test_frontend.yml index d66df725f..780b7ba52 100644 --- a/.github/workflows/pr_test_frontend.yml +++ b/.github/workflows/pr_test_frontend.yml @@ -14,13 +14,18 @@ on: jobs: unit-tests: - uses: hotosm/gh-workflows/.github/workflows/test_pnpm.yml@1.6.0 + uses: hotosm/gh-workflows/.github/workflows/test_pnpm.yml@2.0.0 with: working_dir: src/frontend e2e-tests: - uses: hotosm/gh-workflows/.github/workflows/test_pnpm.yml@main + uses: hotosm/gh-workflows/.github/workflows/test_compose.yml@2.0.0 with: - container_config: '{"image": "mcr.microsoft.com/playwright:v1.45.1"}' - working_dir: src/frontend - run_command: "test:e2e" + image_name: mcr.microsoft.com/playwright:v1.44.1 + build_img: false + compose_file: docker-compose.yml -f contrib/playwright/docker-compose.yml + compose_service: ui-test + cache_extra_imgs: | + "docker.io/postgis/postgis:${{ vars.POSTGIS_TAG }}" + "docker.io/minio/minio:${{ vars.MINIO_TAG }}" + secrets: inherit