puppeteer/.github/workflows/deflake.yml
dependabot[bot] 7a40845581
chore(deps): Bump the all group with 5 updates (#12299)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 09:30:26 +02:00

142 lines
5.6 KiB
YAML

name: Deflake Puppeteer test
# Declare default permissions as read only.
permissions: read-all
concurrency:
group: deflake-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
tests:
description: Tests to deflake (e.g. '[network.spec] *')
required: true
type: string
suite:
description: Which suite to run?
required: true
type: choice
options:
- chrome-headless
- chrome-headful
- chrome-headless-shell
- chrome-bidi
- firefox-headful
- firefox-headless
- firefox-bidi
os:
description: On which OS to run?
required: true
type: choice
options:
- ubuntu-latest
- windows-latest
- macos-latest
retries:
description: Number of retries per test
required: false
default: 100
type: number
jobs:
chrome-deflake:
name: Deflake test with pattern ${{ inputs.tests }} on ${{ inputs.os }}
runs-on: ${{ inputs.os }}
if: ${{ contains(inputs.suite, 'chrome') }}
strategy:
fail-fast: false
steps:
- name: Check out repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
cache: npm
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: true
# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@4aad131006ea85c1e42af927534ebb13426dd730 # setup-github-actions-caching/v1.0.2
- name: Build packages
run: npm run build -w @puppeteer-test/test
- name: Setup cache for Chrome binary
if: ${{ inputs.suite != 'chrome-bidi' }}
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cache/puppeteer/chrome
key: Chrome-${{ runner.os }}-${{ hashFiles('packages/puppeteer-core/src/revisions.ts') }}-${{ hashFiles('packages/puppeteer/src/node/install.ts') }}
- name: Install Chrome
if: ${{ inputs.suite != 'chrome-bidi' }}
run: npm run postinstall
- name: Setup cache for Chrome Canary binary
if: ${{ inputs.suite == 'chrome-bidi' }}
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cache/puppeteer/chrome-canary
key: Chrome-Canary-${{ runner.os }}-${{ hashFiles('package.json') }}
- name: Install Chrome Canary
if: ${{ inputs.suite == 'chrome-bidi' }}
id: browser
run: node tools/download_chrome_bidi.mjs ~/.cache/puppeteer/chrome-canary
- name: Run all tests (for non-Linux)
if: ${{ inputs.os != 'ubuntu-latest' }}
run: npm run test -- --test-suite ${{ inputs.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json
env:
PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }}
PUPPETEER_DEFLAKE_TESTS: '${{ inputs.tests }}'
- name: Run all tests (for Linux)
if: ${{ inputs.os == 'ubuntu-latest' }}
run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ inputs.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json
env:
PUPPETEER_EXECUTABLE_PATH: ${{ steps.browser.outputs.executablePath }}
PUPPETEER_DEFLAKE_TESTS: '${{ inputs.tests }}'
PUPPETEER_DEFLAKE_RETRIES: ${{ inputs.retries }}
firefox-tests:
name: Deflake test with pattern ${{ inputs.tests }} on ${{ inputs.os }}
runs-on: ${{ inputs.os }}
if: ${{ contains(inputs.suite, 'firefox') }}
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
cache: npm
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: true
# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@4aad131006ea85c1e42af927534ebb13426dd730 # setup-github-actions-caching/v1.0.2
- name: Build packages
run: npm run build -w @puppeteer-test/test
- name: Setup cache for Firefox binary
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cache/puppeteer/firefox
key: Firefox-${{ runner.os }}-${{ hashFiles('packages/puppeteer-core/src/revisions.ts') }}-${{ hashFiles('packages/puppeteer/src/node/install.ts') }}
- name: Install Firefox
env:
PUPPETEER_PRODUCT: firefox
run: npm run postinstall
- name: Run all tests (for non-Linux)
if: ${{ inputs.os != 'ubuntu-latest' }}
run: npm run test -- --test-suite ${{ inputs.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json
env:
PUPPETEER_DEFLAKE_TESTS: '${{ inputs.tests }}'
PUPPETEER_DEFLAKE_RETRIES: ${{ inputs.retries }}
- name: Run all tests (for Linux)
if: ${{ inputs.os == 'ubuntu-latest' }}
run: xvfb-run --auto-servernum npm run test -- --test-suite ${{ inputs.suite }} --save-stats-to /tmp/artifacts/${{ github.event_name }}_INSERTID.json
env:
PUPPETEER_DEFLAKE_TESTS: '${{ inputs.tests }}'
PUPPETEER_DEFLAKE_RETRIES: ${{ inputs.retries }}