Shard playwright tests, cache tracker npm deps and browsers (#5603)
This commit is contained in:
parent
bb17a17e5a
commit
51647b323d
|
|
@ -4,7 +4,7 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- 'tracker/**'
|
- "tracker/**"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
@ -14,15 +14,68 @@ jobs:
|
||||||
test:
|
test:
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
shardIndex: [1, 2, 3, 4]
|
||||||
|
shardTotal: [4]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 23.2.0
|
node-version: 23.2.0
|
||||||
- name: Install dependencies
|
cache: 'npm'
|
||||||
run: npm --prefix ./tracker ci
|
cache-dependency-path: tracker/package-lock.json
|
||||||
- name: Install Playwright Browsers
|
- name: Install dependencies
|
||||||
working-directory: ./tracker
|
run: npm --prefix ./tracker ci
|
||||||
run: npx playwright install --with-deps
|
- name: Cache Playwright browsers
|
||||||
- name: Run Playwright tests
|
uses: actions/cache@v4
|
||||||
run: npm --prefix ./tracker test
|
id: playwright-cache
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/ms-playwright
|
||||||
|
~/.cache/ms-playwright-github
|
||||||
|
key: playwright-${{ runner.os }}-${{ hashFiles('tracker/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
playwright-${{ runner.os }}-
|
||||||
|
- name: Install Playwright system dependencies
|
||||||
|
working-directory: ./tracker
|
||||||
|
run: npx playwright install-deps
|
||||||
|
- name: Install Playwright Browsers
|
||||||
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
||||||
|
working-directory: ./tracker
|
||||||
|
run: npx playwright install
|
||||||
|
- name: Run Playwright tests
|
||||||
|
run: npm --prefix ./tracker test -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=blob
|
||||||
|
- name: Upload blob report to GitHub Actions Artifacts
|
||||||
|
if: ${{ !cancelled() }}
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: blob-report-${{ matrix.shardIndex }}
|
||||||
|
path: tracker/blob-report
|
||||||
|
retention-days: 1
|
||||||
|
merge-sharded-test-report:
|
||||||
|
if: ${{ !cancelled() }}
|
||||||
|
needs: [test]
|
||||||
|
timeout-minutes: 5
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 23.2.0
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: tracker/package-lock.json
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm --prefix ./tracker ci
|
||||||
|
|
||||||
|
- name: Download blob reports from GitHub Actions Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: all-blob-reports
|
||||||
|
pattern: blob-report-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Merge into list report
|
||||||
|
working-directory: ./tracker
|
||||||
|
run: npx playwright merge-reports --reporter list ../all-blob-reports
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
// @ts-check
|
import { defineConfig, devices } from '@playwright/test'
|
||||||
import { defineConfig, devices } from '@playwright/test'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://playwright.dev/docs/test-configuration
|
* @see https://playwright.dev/docs/test-configuration
|
||||||
|
|
@ -7,14 +6,18 @@ import { defineConfig, devices } from '@playwright/test'
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
testDir: './test',
|
testDir: './test',
|
||||||
/* Can be overridden in specific tests with test('a longer running test', async () => { test.setTimeout(<longer timeout>); // test content... }) */
|
/* Can be overridden in specific tests with test('a longer running test', async () => { test.setTimeout(<longer timeout>); // test content... }) */
|
||||||
timeout: 10 * 1000,
|
timeout: 10 * 1000,
|
||||||
fullyParallel: true,
|
fullyParallel: true,
|
||||||
|
/* Optimize workers for CI vs local development */
|
||||||
|
workers: process.env.CI ? 4 : undefined,
|
||||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
forbidOnly: !!process.env.CI,
|
forbidOnly: !!process.env.CI,
|
||||||
/* Retry on CI only */
|
/* Retry on CI only */
|
||||||
retries: process.env.CI ? 1 : 0,
|
retries: process.env.CI ? 2 : 0,
|
||||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
reporter: 'list',
|
reporter: 'list',
|
||||||
|
/* Limit the number of failures on CI to save resources */
|
||||||
|
maxFailures: process.env.CI ? 10 : undefined,
|
||||||
/*
|
/*
|
||||||
Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions.
|
Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions.
|
||||||
NOTE: We run the installation support tests on Chrome only because the Browserless /function API
|
NOTE: We run the installation support tests on Chrome only because the Browserless /function API
|
||||||
|
|
@ -23,24 +26,24 @@ export default defineConfig({
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
name: 'chromium',
|
name: 'chromium',
|
||||||
use: { ...devices['Desktop Chrome'] },
|
use: { ...devices['Desktop Chrome'] }
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'firefox',
|
name: 'firefox',
|
||||||
use: { ...devices['Desktop Firefox'] },
|
use: { ...devices['Desktop Firefox'] },
|
||||||
testIgnore: 'test/installation_support/**',
|
testIgnore: 'test/installation_support/**'
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'webkit',
|
name: 'webkit',
|
||||||
use: { ...devices['Desktop Safari'] },
|
use: { ...devices['Desktop Safari'] },
|
||||||
testIgnore: 'test/installation_support/**',
|
testIgnore: 'test/installation_support/**'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start',
|
command: 'npm run start',
|
||||||
port: 3000,
|
port: 3000,
|
||||||
reuseExistingServer: !process.env.CI
|
reuseExistingServer: !process.env.CI
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
Loading…
Reference in New Issue