puppeteer/.github/workflows/deflake.yml

146 lines
5.8 KiB
YAML
Raw Normal View History

2023-10-11 17:26:48 +00:00
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-new-headless
- 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
2023-10-13 12:13:54 +00:00
default: 100
2023-10-11 17:26:48 +00:00
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2023-10-11 17:26:48 +00:00
- name: Set up Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
2023-10-11 17:26:48 +00:00
with:
cache: npm
node-version: lts/*
- name: Set up FFmpeg
uses: FedericoCarboni/setup-ffmpeg@5058c9851b649ced05c3e73a4fb5ef2995a89127 # v2.0.0
- name: Install dependencies
run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: true
# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903 # setup-github-actions-caching/v1
- name: Build packages
run: npm run build -w @puppeteer-test/test
2023-10-11 17:26:48 +00:00
- name: Setup cache for Chrome binary
if: ${{ inputs.suite != 'chrome-bidi' }}
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.cache/puppeteer/chrome
key: ${{ runner.os }}-Chrome-${{ 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@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.cache/puppeteer/chrome-canary
key: ${{ runner.os }}-Chrome-Canary-${{ 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 }}
2023-10-12 17:08:49 +00:00
PUPPETEER_DEFLAKE_TESTS: '${{ inputs.tests }}'
2023-10-11 17:26:48 +00:00
- 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 }}
2023-10-12 17:08:49 +00:00
PUPPETEER_DEFLAKE_TESTS: '${{ inputs.tests }}'
2023-10-11 17:26:48 +00:00
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2023-10-11 17:26:48 +00:00
- name: Set up Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
2023-10-11 17:26:48 +00:00
with:
cache: npm
node-version: lts/*
- name: Set up FFmpeg
uses: FedericoCarboni/setup-ffmpeg@5058c9851b649ced05c3e73a4fb5ef2995a89127 # v2.0.0
- name: Install dependencies
run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: true
# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903 # setup-github-actions-caching/v1
- name: Build packages
run: npm run build -w @puppeteer-test/test
2023-10-11 17:26:48 +00:00
- name: Setup cache for Firefox binary
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.cache/puppeteer/firefox
key: ${{ runner.os }}-firefox-${{ 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:
2023-10-12 17:08:49 +00:00
PUPPETEER_DEFLAKE_TESTS: '${{ inputs.tests }}'
2023-10-11 17:26:48 +00:00
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:
2023-10-12 17:08:49 +00:00
PUPPETEER_DEFLAKE_TESTS: '${{ inputs.tests }}'
2023-10-11 17:26:48 +00:00
PUPPETEER_DEFLAKE_RETRIES: ${{ inputs.retries }}