mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs: shard numbers in yaml (#26336)
This commit is contained in:
parent
8fcb6383ce
commit
0f0045be94
@ -189,14 +189,13 @@ on:
|
|||||||
branches: [ main, master ]
|
branches: [ main, master ]
|
||||||
jobs:
|
jobs:
|
||||||
playwright:
|
playwright:
|
||||||
name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}'
|
name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shard }}'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
project: [chromium, webkit]
|
project: [chromium, webkit]
|
||||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
shard: [1/10, 2/10, 3/10, 4/10, 5/10, 6/10, 7/10, 8/10, 9/10, 10/10]
|
||||||
shardTotal: [10]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -207,7 +206,7 @@ jobs:
|
|||||||
- name: Install browsers
|
- name: Install browsers
|
||||||
run: npx playwright install --with-deps
|
run: npx playwright install --with-deps
|
||||||
- name: Run your tests
|
- name: Run your tests
|
||||||
run: npx playwright test --project=${{ matrix.project }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
run: npx playwright test --project=${{ matrix.project }} --shard=${{ matrix.shard }}
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: The `${{ <expression> }}` is the [expression](https://docs.github.com/en/actions/learn-github-actions/expressions) syntax that allows accessing the current [context](https://docs.github.com/en/actions/learn-github-actions/contexts). In this example, we are using the [`matrix`](https://docs.github.com/en/actions/learn-github-actions/contexts#matrix-context) context to set the job variants.
|
> Note: The `${{ <expression> }}` is the [expression](https://docs.github.com/en/actions/learn-github-actions/expressions) syntax that allows accessing the current [context](https://docs.github.com/en/actions/learn-github-actions/contexts). In this example, we are using the [`matrix`](https://docs.github.com/en/actions/learn-github-actions/contexts#matrix-context) context to set the job variants.
|
||||||
@ -331,7 +330,7 @@ on:
|
|||||||
branches: [ main, master ]
|
branches: [ main, master ]
|
||||||
jobs:
|
jobs:
|
||||||
playwright:
|
playwright:
|
||||||
name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}'
|
name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shard }}'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
|
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
|
||||||
@ -339,8 +338,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
project: [chromium, webkit]
|
project: [chromium, webkit]
|
||||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
shard: [1/10, 2/10, 3/10, 4/10, 5/10, 6/10, 7/10, 8/10, 9/10, 10/10]
|
||||||
shardTotal: [10]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
@ -349,7 +347,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Run your tests
|
- name: Run your tests
|
||||||
run: npx playwright test --project=${{ matrix.project }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
run: npx playwright test --project=${{ matrix.project }} --shard=${{ matrix.shard }}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### On deployment
|
#### On deployment
|
||||||
@ -637,40 +635,31 @@ strategy:
|
|||||||
matrix:
|
matrix:
|
||||||
chromium-1:
|
chromium-1:
|
||||||
project: chromium
|
project: chromium
|
||||||
shardIndex: 1
|
shard: 1/3
|
||||||
shardTotal: 3
|
|
||||||
chromium-2:
|
chromium-2:
|
||||||
project: chromium
|
project: chromium
|
||||||
shardIndex: 2
|
shard: 2/3
|
||||||
shardTotal: 3
|
|
||||||
chromium-3:
|
chromium-3:
|
||||||
project: chromium
|
project: chromium
|
||||||
shardIndex: 3
|
shard: 3/3
|
||||||
shardTotal: 3
|
|
||||||
firefox-1:
|
firefox-1:
|
||||||
project: firefox
|
project: firefox
|
||||||
shardIndex: 1
|
shard: 1/3
|
||||||
shardTotal: 3
|
|
||||||
firefox-2:
|
firefox-2:
|
||||||
project: firefox
|
project: firefox
|
||||||
shardIndex: 2
|
shard: 2/3
|
||||||
shardTotal: 3
|
|
||||||
firefox-3:
|
firefox-3:
|
||||||
project: firefox
|
project: firefox
|
||||||
shardIndex: 3
|
shard: 3/3
|
||||||
shardTotal: 3
|
|
||||||
webkit-1:
|
webkit-1:
|
||||||
project: webkit
|
project: webkit
|
||||||
shardIndex: 1
|
shard: 1/3
|
||||||
shardTotal: 3
|
|
||||||
webkit-2:
|
webkit-2:
|
||||||
project: webkit
|
project: webkit
|
||||||
shardIndex: 2
|
shard: 2/3
|
||||||
shardTotal: 3
|
|
||||||
webkit-3:
|
webkit-3:
|
||||||
project: webkit
|
project: webkit
|
||||||
shardIndex: 3
|
shard: 3/3
|
||||||
shardTotal: 3
|
|
||||||
steps:
|
steps:
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
inputs:
|
inputs:
|
||||||
@ -681,7 +670,7 @@ steps:
|
|||||||
displayName: 'npm ci'
|
displayName: 'npm ci'
|
||||||
- script: npx playwright install --with-deps
|
- script: npx playwright install --with-deps
|
||||||
displayName: 'Install Playwright browsers'
|
displayName: 'Install Playwright browsers'
|
||||||
- script: npx playwright test --project=$(project) --shard=$(shardIndex)/$(shardTotal)
|
- script: npx playwright test --project=$(project) --shard=$(shard)
|
||||||
displayName: 'Run Playwright tests'
|
displayName: 'Run Playwright tests'
|
||||||
env:
|
env:
|
||||||
CI: 'true'
|
CI: 'true'
|
||||||
@ -970,7 +959,7 @@ tests:
|
|||||||
- npx playwright test --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
|
- npx playwright test --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
|
||||||
```
|
```
|
||||||
|
|
||||||
GitLab CI also supports sharding tests between multiple jobs using the [parallel:matrix](https://docs.gitlab.com/ee/ci/yaml/index.html#parallelmatrix) option. The test job will run multiple times in parallel in a single pipeline, but with different variable values for each instance of the job. In the example below, we have 2 `PROJECT` values, 10 `SHARD_INDEX` values and 1 `SHARD_TOTAL` value, resulting in a total of 20 jobs to be run.
|
GitLab CI also supports sharding tests between multiple jobs using the [parallel:matrix](https://docs.gitlab.com/ee/ci/yaml/index.html#parallelmatrix) option. The test job will run multiple times in parallel in a single pipeline, but with different variable values for each instance of the job. In the example below, we have 2 `PROJECT` values and 10 `SHARD` values, resulting in a total of 20 jobs to be run.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
stages:
|
stages:
|
||||||
@ -982,11 +971,10 @@ tests:
|
|||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
- PROJECT: ['chromium', 'webkit']
|
- PROJECT: ['chromium', 'webkit']
|
||||||
SHARD_INDEX: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
SHARD: ['1/10', '2/10', '3/10', '4/10', '5/10', '6/10', '7/10', '8/10', '9/10', '10/10']
|
||||||
SHARD_TOTAL: 10
|
|
||||||
script:
|
script:
|
||||||
- npm ci
|
- npm ci
|
||||||
- npx playwright test --project=$PROJECT --shard=$SHARD_INDEX/$SHARD_TOTAL
|
- npx playwright test --project=$PROJECT --shard=$SHARD
|
||||||
```
|
```
|
||||||
|
|
||||||
## Caching browsers
|
## Caching browsers
|
||||||
|
@ -60,7 +60,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
shard: [1, 2, 3, 4]
|
shard: [1/4, 2/4, 3/4, 4/4]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@ -71,7 +71,7 @@ jobs:
|
|||||||
run: npx playwright install
|
run: npx playwright install
|
||||||
|
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
run: npx playwright test --shard ${{ matrix.shard }}/4
|
run: npx playwright test --shard ${{ matrix.shard }}
|
||||||
|
|
||||||
- name: Upload blob report to GitHub Actions Artifacts
|
- name: Upload blob report to GitHub Actions Artifacts
|
||||||
if: always()
|
if: always()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user