fix(ci): improve cypress parallelization

This commit is contained in:
kolaente
2025-05-16 18:29:27 +02:00
parent 9d90030bc4
commit deb598faf5

View File

@@ -277,11 +277,24 @@ jobs:
name: frontend_dist
path: ./frontend/dist
# Workaround for this old issue, still not fixed:
# https://github.com/cypress-io/github-action/issues/121
define-frontend-e2e-batches:
runs-on: ubuntu-latest
outputs:
batches: ${{ steps.get-batches.outputs.batches }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get spec batches
id: get-batches
run: echo "batches=$(find frontend/cypress/e2e -type f -name '*.spec.ts' -printf "%P\n" | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT"
test-frontend-e2e:
runs-on: ubuntu-latest
needs:
- api-build
- build-frontend
- define-frontend-e2e-batches
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
@@ -289,7 +302,7 @@ jobs:
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5]
spec: ${{ fromJSON(needs.define-frontend-e2e-batches.outputs.batches) }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Download Vikunja Binary
@@ -318,7 +331,7 @@ jobs:
working-directory: frontend
browser: chrome
record: true
parallel: true
spec: cypress/e2e/${{ matrix.spec }}
start: |
pnpm run preview
wait-on: http://127.0.0.1:4173,http://127.0.0.1:3456/api/v1/info
@@ -329,3 +342,12 @@ jobs:
CYPRESS_API_URL: http://127.0.0.1:3456/api/v1
CYPRESS_TEST_SECRET: averyLongSecretToSe33dtheDB
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 60000
# This step only exists so that we can make it required, because we can't make
# the actual test step required due to the matrix
test-frontend-e2e-success:
runs-on: ubuntu-latest
needs:
- test-frontend-e2e
steps:
- run: exit 0