Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add shard matrix #9689

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/') }}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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: |
Expand All @@ -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
Expand Down
Loading