Skip to content

Commit a510fa3

Browse files
fyuuki0jpclaude
andauthored
feat: optimize GitHub Actions E2E test performance (#8)
* feat: optimize GitHub Actions E2E test performance - Add Playwright browser caching to avoid re-downloading browsers - Cache build artifacts to skip rebuilds when code hasn't changed - Enable parallel test execution (workers: 2) for faster runs - Reduce test matrix to Chromium only (3x speedup) - Keep Firefox/WebKit commented for easy re-enabling Expected performance improvement: 50-70% reduction in CI time 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: remove unnecessary NPM_TOKEN from GitHub Actions workflows Remove NPM_TOKEN environment variable from all workflow files as it's no longer needed 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7a61bc6 commit a510fa3

4 files changed

Lines changed: 42 additions & 19 deletions

File tree

.github/workflows/e2e-tests.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
pull_request:
77
branches: [main]
88

9-
env:
10-
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11-
129
jobs:
1310
playwright:
1411
name: Run Playwright Tests
@@ -34,10 +31,40 @@ jobs:
3431
- name: Refresh package links
3532
run: yarn install --force
3633

34+
- name: Get Playwright version
35+
id: playwright-version
36+
run: echo "version=$(yarn list --pattern @playwright/test --depth=0 --json --non-interactive --no-progress | jq -r '.data.trees[0].name' | sed 's/@playwright\/test@//')" >> $GITHUB_OUTPUT
37+
38+
- name: Cache Playwright browsers
39+
uses: actions/cache@v4
40+
id: playwright-cache
41+
with:
42+
path: ~/.cache/ms-playwright
43+
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}
44+
restore-keys: |
45+
${{ runner.os }}-playwright-
46+
3747
- name: Install Playwright browsers
48+
if: steps.playwright-cache.outputs.cache-hit != 'true'
3849
run: npx playwright install --with-deps
3950

51+
- name: Install Playwright system dependencies
52+
if: steps.playwright-cache.outputs.cache-hit == 'true'
53+
run: npx playwright install-deps
54+
55+
- name: Cache build artifacts
56+
uses: actions/cache@v4
57+
id: build-cache
58+
with:
59+
path: |
60+
backend/dist
61+
frontend/dist
62+
key: ${{ runner.os }}-build-${{ hashFiles('**/yarn.lock', '**/package.json', '**/*.ts', '**/*.tsx', '!**/*.spec.ts', '!**/*.test.ts') }}
63+
restore-keys: |
64+
${{ runner.os }}-build-
65+
4066
- name: Build applications
67+
if: steps.build-cache.outputs.cache-hit != 'true'
4168
run: yarn build
4269

4370
- name: Run Playwright tests

.github/workflows/lint-typecheck.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
pull_request:
77
branches: [main]
88

9-
env:
10-
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11-
129
jobs:
1310
lint:
1411
name: Run Linting and Type Checking

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
pull_request:
77
branches: [main]
88

9-
env:
10-
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11-
129
jobs:
1310
test:
1411
name: Run Unit Tests

playwright.config.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import { defineConfig, devices } from '@playwright/test';
77
export default defineConfig({
88
testDir: './e2e',
99
/* Run tests in files in parallel */
10-
fullyParallel: false,
10+
fullyParallel: true,
1111
/* Fail the build on CI if you accidentally left test.only in the source code. */
1212
forbidOnly: !!process.env.CI,
1313
/* Retry on CI only */
1414
retries: process.env.CI ? 2 : 0,
1515
/* Opt out of parallel tests on CI. */
16-
workers: process.env.CI ? 1 : undefined,
16+
workers: process.env.CI ? 2 : undefined,
1717
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
1818
reporter: process.env.CI ? 'html' : 'line',
1919
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
@@ -32,15 +32,17 @@ export default defineConfig({
3232
use: { ...devices['Desktop Chrome'] },
3333
},
3434

35-
{
36-
name: 'firefox',
37-
use: { ...devices['Desktop Firefox'] },
38-
},
35+
// Firefox and webkit are commented out to speed up CI
36+
// Uncomment if cross-browser testing is required
37+
// {
38+
// name: 'firefox',
39+
// use: { ...devices['Desktop Firefox'] },
40+
// },
3941

40-
{
41-
name: 'webkit',
42-
use: { ...devices['Desktop Safari'] },
43-
},
42+
// {
43+
// name: 'webkit',
44+
// use: { ...devices['Desktop Safari'] },
45+
// },
4446

4547
/* Test against mobile viewports. */
4648
// {

0 commit comments

Comments
 (0)