mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
0a65a0b8e8
Posting a comment to the PR using GITHUB_TOKEN requires elevated permissions, see https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
278 lines
10 KiB
YAML
278 lines
10 KiB
YAML
name: "tests 1"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release-*
|
|
pull_request:
|
|
paths-ignore:
|
|
- 'browser_patches/**'
|
|
- 'docs/**'
|
|
branches:
|
|
- main
|
|
- release-*
|
|
|
|
concurrency:
|
|
# For pull requests, cancel all currently-running jobs for this workflow
|
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# Force terminal colors. @see https://www.npmjs.com/package/colors
|
|
FORCE_COLOR: 1
|
|
FLAKINESS_CONNECTION_STRING: ${{ secrets.FLAKINESS_CONNECTION_STRING }}
|
|
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
|
|
|
jobs:
|
|
test_linux:
|
|
name: ${{ matrix.os }} (${{ matrix.browser }} - Node.js ${{ matrix.node-version }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
browser: [chromium, firefox, webkit]
|
|
os: [ubuntu-22.04]
|
|
node-version: [16]
|
|
include:
|
|
- os: ubuntu-22.04
|
|
node-version: 18
|
|
browser: chromium
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- run: npm ci
|
|
env:
|
|
DEBUG: pw:install
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
|
- run: npm run build
|
|
- run: npx playwright install --with-deps ${{ matrix.browser }} chromium
|
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=${{ matrix.browser }}
|
|
env:
|
|
PWTEST_BLOB_REPORT: 1
|
|
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
|
- run: node tests/config/checkCoverage.js ${{ matrix.browser }}
|
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
|
if: always()
|
|
shell: bash
|
|
- name: Upload artifacts to Azure Blob Storage
|
|
if: always() && github.event_name != 'pull_request'
|
|
run: az storage blob upload-batch -s test-results/blob-report -d '$web/run-${{ github.run_id }}-${{ github.sha }}-test_linux' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
|
|
|
|
merge_test_linux:
|
|
if: ${{ always() && github.event_name != 'pull_request' }}
|
|
permissions:
|
|
pull-requests: write
|
|
needs: [test_linux]
|
|
timeout-minutes: 10
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
- run: npm ci
|
|
env:
|
|
DEBUG: pw:install
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
|
- run: npm run build
|
|
- name: Download Blob Reports from Azure Blob Storage
|
|
run: |
|
|
az storage blob download-batch -d . -s '$web' --pattern 'run-${{ github.run_id }}-${{ github.sha }}-test_linux/*.jsonl' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
|
|
- name: Merge into HTML Report
|
|
run: |
|
|
npx playwright merge-reports --reporter html --attachments missing 'run-${{ github.run_id }}-${{ github.sha }}-test_linux'
|
|
- name: Upload HTML Report to Azure Blob Storage
|
|
run: |
|
|
az storage blob upload-batch -s playwright-report -d '$web/run-${{ github.run_id }}-${{ github.sha }}-test_linux' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
|
|
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/run-${{ github.run_id }}-${{ github.sha }}-test_linux/index.html"
|
|
- name: Comment on PR
|
|
uses: actions/github-script@v6
|
|
with:
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
script: |
|
|
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
...context.repo,
|
|
commit_sha: context.sha,
|
|
});
|
|
if (prs.length === 0) {
|
|
core.error('No pull request found for commit ' + context.sha);
|
|
return;
|
|
}
|
|
const reportUrl = `https://mspwblobreport.z1.web.core.windows.net/run-${context.runId}-${context.sha}-test_linux/index.html`;
|
|
core.notice('Report url: ' + reportUrl);
|
|
const { data: response } = await github.rest.issues.createComment({
|
|
...context.repo,
|
|
issue_number: prs[0].number,
|
|
body: 'Primary test results: ' + reportUrl,
|
|
});
|
|
core.info('Posted comment: ' + response.html_url);
|
|
|
|
test_linux_chromium_tot:
|
|
name: ${{ matrix.os }} (chromium tip-of-tree)
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-20.04]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
- run: npm ci
|
|
env:
|
|
DEBUG: pw:install
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
|
- run: npm run build
|
|
- run: npx playwright install --with-deps chromium-tip-of-tree
|
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test -- --project=chromium
|
|
env:
|
|
PWTEST_CHANNEL: chromium-tip-of-tree
|
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
|
if: always()
|
|
shell: bash
|
|
|
|
test_test_runner:
|
|
name: Test Runner
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
node-version: [16]
|
|
shard: [1/2, 2/2]
|
|
include:
|
|
- os: ubuntu-latest
|
|
node-version: 18
|
|
shard: 1/2
|
|
- os: ubuntu-latest
|
|
node-version: 18
|
|
shard: 2/2
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{matrix.node-version}}
|
|
- run: npm ci
|
|
env:
|
|
DEBUG: pw:install
|
|
- run: npm run build
|
|
- run: npx playwright install --with-deps
|
|
- run: npm run ttest -- --shard ${{ matrix.shard }}
|
|
env:
|
|
PWTEST_BLOB_REPORT: 1
|
|
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
|
if: matrix.os != 'ubuntu-latest'
|
|
- run: xvfb-run npm run ttest -- --shard ${{ matrix.shard }}
|
|
env:
|
|
PWTEST_BLOB_REPORT: 1
|
|
PWTEST_BLOB_SUFFIX: "-${{ matrix.os }}-node${{ matrix.node-version }}"
|
|
if: matrix.os == 'ubuntu-latest'
|
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
|
if: always()
|
|
shell: bash
|
|
- name: Upload artifacts to Azure Blob Storage
|
|
if: always() && github.event_name != 'pull_request'
|
|
run: az storage blob upload-batch -s test-results/blob-report -d '$web/run-${{ github.run_id }}-${{ github.sha }}-test_test_runner' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
|
|
|
|
merge_test_test_runner:
|
|
if: ${{ always() && github.event_name != 'pull_request' }}
|
|
permissions:
|
|
pull-requests: write
|
|
needs: [test_test_runner]
|
|
timeout-minutes: 10
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
- run: npm ci
|
|
env:
|
|
DEBUG: pw:install
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
|
- run: npm run build
|
|
- name: Download Blob Reports from Azure Blob Storage
|
|
run: |
|
|
az storage blob download-batch -d . -s '$web' --pattern 'run-${{ github.run_id }}-${{ github.sha }}-test_test_runner/*.jsonl' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
|
|
- name: Merge into HTML Report
|
|
run: |
|
|
npx playwright merge-reports --reporter html --attachments missing 'run-${{ github.run_id }}-${{ github.sha }}-test_test_runner'
|
|
- name: Upload HTML Report to Azure Blob Storage
|
|
run: |
|
|
az storage blob upload-batch -s playwright-report -d '$web/run-${{ github.run_id }}-${{ github.sha }}-test_test_runner' --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
|
|
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/run-${{ github.run_id }}-${{ github.sha }}-test_test_runner/index.html"
|
|
- name: Comment on PR
|
|
uses: actions/github-script@v6
|
|
with:
|
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
script: |
|
|
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
...context.repo,
|
|
commit_sha: context.sha,
|
|
});
|
|
if (prs.length === 0) {
|
|
core.error('No pull request found for commit ' + context.sha);
|
|
return;
|
|
}
|
|
const reportUrl = `https://mspwblobreport.z1.web.core.windows.net/run-${context.runId}-${context.sha}-test_test_runner/index.html`;
|
|
core.notice('Report url: ' + reportUrl);
|
|
const { data: response } = await github.rest.issues.createComment({
|
|
...context.repo,
|
|
issue_number: prs[0].number,
|
|
body: 'Test Runner test results: ' + reportUrl,
|
|
});
|
|
core.info('Posted comment: ' + response.html_url);
|
|
|
|
test_web_components:
|
|
name: Web Components
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
# Component tests require Node.js 16+ (they require ESM via TS)
|
|
node-version: 16
|
|
- run: npm ci
|
|
env:
|
|
DEBUG: pw:install
|
|
- run: npm run build
|
|
- run: npx playwright install --with-deps
|
|
- run: npm run test-html-reporter
|
|
- run: npm run test-web
|
|
if: always()
|
|
|
|
test-package-installations:
|
|
name: "Installation Test ${{ matrix.os }}"
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
- macos-latest
|
|
- windows-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
- run: npm ci
|
|
env:
|
|
DEBUG: pw:install
|
|
- run: npm run build
|
|
- run: npx playwright install-deps
|
|
- run: npm run itest
|
|
if: matrix.os != 'ubuntu-latest'
|
|
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run itest
|
|
if: matrix.os == 'ubuntu-latest'
|
|
- run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
|
|
if: always()
|
|
shell: bash
|
|
|