mirror of
https://github.com/zen-browser/www.git
synced 2025-07-07 17:05:32 +02:00
feat(ci): enhance Playwright test sharding and caching
This commit is contained in:
parent
c64b34cc59
commit
dc30633bc3
3 changed files with 30 additions and 12 deletions
18
.github/workflows/ci-pipeline.yml
vendored
18
.github/workflows/ci-pipeline.yml
vendored
|
@ -179,14 +179,10 @@ jobs:
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
playwright:
|
playwright:
|
||||||
name: Playwright Tests (Shard ${{ matrix.shard }})
|
name: Playwright Tests
|
||||||
needs: [check_changes, setup, build]
|
needs: [check_changes, setup, build]
|
||||||
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
if: ${{ needs.check_changes.outputs.exists == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
shard: [1, 2, 3, 4]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
@ -202,10 +198,8 @@ jobs:
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: .turbo
|
path: .turbo
|
||||||
key: ${{ runner.os }}-turbo-playwright-shard-${{ matrix.shard }}-${{ github.sha }}
|
key: ${{ runner.os }}-turbo-playwright-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: ${{ runner.os }}-turbo-playwright-
|
||||||
${{ runner.os }}-turbo-playwright-shard-${{ matrix.shard }}-
|
|
||||||
${{ runner.os }}-turbo-playwright-
|
|
||||||
|
|
||||||
- name: Restore Astro Cache
|
- name: Restore Astro Cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
@ -252,15 +246,15 @@ jobs:
|
||||||
- name: Install Playwright Browsers
|
- name: Install Playwright Browsers
|
||||||
run: pnpm exec playwright install --with-deps
|
run: pnpm exec playwright install --with-deps
|
||||||
|
|
||||||
- name: Run Playwright Tests (Shard ${{ matrix.shard }}/4)
|
- name: Run Playwright Tests (4 Shards)
|
||||||
run: pnpm exec turbo run test:playwright -- --shard=${{ matrix.shard }}/4
|
run: pnpm exec turbo run test:playwright:shard1 test:playwright:shard2 test:playwright:shard3 test:playwright:shard4
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
|
||||||
- name: Upload Playwright Report
|
- name: Upload Playwright Report
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: playwright-report-shard-${{ matrix.shard }}
|
name: playwright-report
|
||||||
path: playwright-report/
|
path: playwright-report/
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:coverage": "vitest --coverage",
|
"test:coverage": "vitest --coverage",
|
||||||
"test:playwright": "playwright test --reporter=list",
|
"test:playwright": "playwright test --reporter=list",
|
||||||
|
"test:playwright:shard1": "playwright test --reporter=list --shard=1/4",
|
||||||
|
"test:playwright:shard2": "playwright test --reporter=list --shard=2/4",
|
||||||
|
"test:playwright:shard3": "playwright test --reporter=list --shard=3/4",
|
||||||
|
"test:playwright:shard4": "playwright test --reporter=list --shard=4/4",
|
||||||
"prepare": "lefthook install"
|
"prepare": "lefthook install"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
20
turbo.json
20
turbo.json
|
@ -34,6 +34,26 @@
|
||||||
"cache": true,
|
"cache": true,
|
||||||
"inputs": ["**/*.{ts,tsx,js,jsx,astro}"],
|
"inputs": ["**/*.{ts,tsx,js,jsx,astro}"],
|
||||||
"outputs": ["playwright-report/**", "test-results/**"]
|
"outputs": ["playwright-report/**", "test-results/**"]
|
||||||
|
},
|
||||||
|
"test:playwright:shard1": {
|
||||||
|
"cache": true,
|
||||||
|
"inputs": ["**/*.{ts,tsx,js,jsx,astro}"],
|
||||||
|
"outputs": ["playwright-report/**", "test-results/**"]
|
||||||
|
},
|
||||||
|
"test:playwright:shard2": {
|
||||||
|
"cache": true,
|
||||||
|
"inputs": ["**/*.{ts,tsx,js,jsx,astro}"],
|
||||||
|
"outputs": ["playwright-report/**", "test-results/**"]
|
||||||
|
},
|
||||||
|
"test:playwright:shard3": {
|
||||||
|
"cache": true,
|
||||||
|
"inputs": ["**/*.{ts,tsx,js,jsx,astro}"],
|
||||||
|
"outputs": ["playwright-report/**", "test-results/**"]
|
||||||
|
},
|
||||||
|
"test:playwright:shard4": {
|
||||||
|
"cache": true,
|
||||||
|
"inputs": ["**/*.{ts,tsx,js,jsx,astro}"],
|
||||||
|
"outputs": ["playwright-report/**", "test-results/**"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ui": "tui"
|
"ui": "tui"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue