From ee276f8b914f918c209cd3d83db12cd6346edbc2 Mon Sep 17 00:00:00 2001 From: splincode Date: Tue, 5 Nov 2024 15:41:38 +0300 Subject: [PATCH] ci: add shard matrix --- .github/workflows/e2e.yml | 46 +++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c443ee56ffd9..38082f29f882 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -2,12 +2,6 @@ name: ⚙️ E2E testing on: pull_request: -env: - CYPRESS_BASELINE_REPO: 'baseline' - CYPRESS_RESULTS_FOLDER: 'projects/demo-cypress/tests-results' - CYPRESS_BASELINE_SNAPSHOTS: 'projects/demo-cypress/tests-results/snapshots/baseline' - CYPRESS_BASELINE_SNAPSHOTS_KEY: 'cy_baseline_${{ github.event.pull_request.head.sha }}' - jobs: build-demo: if: ${{ !contains(github.head_ref , 'release/') }} @@ -35,6 +29,11 @@ jobs: cypress: runs-on: ubuntu-latest name: Cypress / Component Testing + env: + CYPRESS_BASELINE_REPO: 'baseline' + CYPRESS_RESULTS_FOLDER: 'projects/demo-cypress/tests-results' + CYPRESS_BASELINE_SNAPSHOTS: 'projects/demo-cypress/tests-results/snapshots/baseline' + CYPRESS_BASELINE_SNAPSHOTS_KEY: 'cy_baseline_${{ github.event.pull_request.head.sha }}' steps: - uses: actions/checkout@v4.2.2 with: @@ -92,19 +91,31 @@ jobs: needs: [build-demo] strategy: fail-fast: false + max-parallel: 9 matrix: - shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9] - shardTotal: [9] - name: Playwright / (${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}) + shard: [ + # Chrome + {index: 1, os: 'ubuntu-latest', project: 'chromium', total: 9}, + {index: 2, os: 'ubuntu-latest', project: 'chromium', total: 9}, + {index: 3, os: 'ubuntu-latest', project: 'chromium', total: 9}, + {index: 4, os: 'ubuntu-latest', project: 'chromium', total: 9}, + {index: 5, os: 'ubuntu-latest', project: 'chromium', total: 9}, + {index: 6, os: 'ubuntu-latest', project: 'chromium', total: 9}, + {index: 7, os: 'ubuntu-latest', project: 'chromium', total: 9}, + {index: 8, os: 'ubuntu-latest', project: 'chromium', total: 9}, + {index: 9, os: 'ubuntu-latest', project: 'chromium', total: 9}, + ] + name: Playwright / ${{ matrix.shard.os }} / ${{ matrix.shard.index }} of ${{ matrix.shard.total }} steps: - uses: actions/checkout@v4.2.2 - - uses: taiga-family/ci/actions/setup/variables@v1.93.5 - - uses: taiga-family/ci/actions/setup/node@v1.93.5 + - uses: taiga-family/ci/actions/setup/variables@v1.94.0 + - uses: taiga-family/ci/actions/setup/node@v1.94.0 - name: Get installed Playwright version id: playwright-version run: | echo "PLAYWRIGHT_VERSION=$(node -p 'require("./projects/demo-playwright/package.json").devDependencies["@playwright/test"]')" >> $GITHUB_ENV + - uses: actions/cache/restore@v4.1.2 id: playwright-cache with: @@ -131,7 +142,11 @@ jobs: replaceBaseUrl: false - name: Run screenshot tests on ${{ env.DIST }} - run: npx nx e2e demo-playwright -- --update-snapshots --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + run: | + npx nx e2e demo-playwright -- \ + --update-snapshots \ + --project=${{ matrix.shard.project }} \ + --shard=${{ matrix.shard.index }}/${{ matrix.shard.total }} - uses: taiga-family/ci/actions/run/clone@v1.94.0 with: @@ -146,7 +161,10 @@ jobs: - name: Run screenshot tests on ${{ env.DIST_NEXT }} continue-on-error: true - run: npx nx e2e demo-playwright --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + run: | + npx nx e2e demo-playwright -- \ + --project=${{ matrix.shard.project }} \ + --shard=${{ matrix.shard.index }}/${{ matrix.shard.total }} - name: Combine images to get diff reports run: | @@ -164,7 +182,7 @@ jobs: path: | ./projects/demo-playwright/tests-results/**/*.diff.png !./projects/demo-playwright/tests-results/**/*-retry*/*.diff.png - name: '${{ env.PLAYWRIGHT_SNAPSHOTS_ARTIFACTS_KEY }}_${{ matrix.shardIndex }}' + name: '${{ env.PLAYWRIGHT_SNAPSHOTS_ARTIFACTS_KEY }}_${{ matrix.shard.project }}_${{ matrix.shard.index }}' if-no-files-found: ignore compression-level: 0 retention-days: 1