Skip to content

Onboarding v4: design feedback round 2 #13819

Onboarding v4: design feedback round 2

Onboarding v4: design feedback round 2 #13819

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
merge_group:
permissions:
contents: read
pages: write
id-token: write
deployments: write
jobs:
unit-tests:
name: Unit tests (${{ matrix.workspace }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
workspace: [injected, special-pages]
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v5
with:
path: |
node_modules
injected/node_modules
special-pages/node_modules
messaging/node_modules
types-generator/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Build (injected only)
if: ${{ matrix.workspace == 'injected' }}
run: npm run build -w injected
- run: npm run test-unit -w ${{ matrix.workspace }}
unit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v5
with:
path: |
node_modules
injected/node_modules
special-pages/node_modules
messaging/node_modules
types-generator/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run stylelint
- run: npm run test-unit -w types-generator
- name: 'Clean tree'
run: 'npm run test-clean-tree'
get-playwright-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.pw.outputs.version }}
steps:
- uses: actions/checkout@v6
- id: pw
run: |
VERSION=$(node -e "const l=require('./package-lock.json'); console.log((l.packages['node_modules/@playwright/test']||l.packages['node_modules/playwright']).version)")
echo "version=$VERSION" >> $GITHUB_OUTPUT
integration-tests-special-pages:
name: Integration tests (special-pages/${{ matrix.group }}, ubuntu-latest)
needs: get-playwright-version
runs-on: ubuntu-latest
timeout-minutes: 15
container:
image: mcr.microsoft.com/playwright:v${{ needs.get-playwright-version.outputs.version }}-noble
env:
HOME: /root
strategy:
fail-fast: false
matrix:
include:
- group: chromium
# windows=Desktop Edge, integration=Desktop Chrome
projects: --project windows --project integration
- group: webkit
# macos=Desktop Safari, ios=iPhone 14, android/android-landscape=Galaxy S III (webkit)
projects: --project macos --project ios --project android --project android-landscape
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v5
with:
path: |
node_modules
injected/node_modules
special-pages/node_modules
messaging/node_modules
types-generator/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Build
run: npm run build
- name: Run integration tests
run: npx playwright test ${{ matrix.projects }} --grep-invert '@screenshots'
working-directory: special-pages
- uses: actions/upload-artifact@v7
if: always()
with:
name: tests-playwright-report-pages-${{ matrix.group }}
path: special-pages/playwright-report
retention-days: 5
integration-tests:
name: Integration tests (injected/${{ matrix.project }}, ubuntu-latest)
needs: get-playwright-version
runs-on: ubuntu-latest
timeout-minutes: 15
container:
image: mcr.microsoft.com/playwright:v${{ needs.get-playwright-version.outputs.version }}-noble
env:
HOME: /root
strategy:
fail-fast: false
matrix:
include:
- project: windows
- project: apple-isolated
# apple runs in Chromium (Playwright default) - no device preset is set in playwright.config.js
- project: apple
- project: ios
- project: android
- project: android-autofill-import
- project: chrome-mv3
- project: firefox
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v5
with:
path: |
node_modules
injected/node_modules
special-pages/node_modules
messaging/node_modules
types-generator/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Build
run: npm run build
- name: Run integration tests
run: xvfb-run --server-args='-screen 0 1024x768x24' npx playwright test --project ${{ matrix.project }} --grep-invert '@screenshots' --reporter list
working-directory: injected
- uses: actions/upload-artifact@v7
if: always()
with:
name: tests-playwright-report-injected-${{ matrix.project }}
path: injected/playwright-report
retention-days: 5
integration:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v5
with:
path: |
node_modules
injected/node_modules
special-pages/node_modules
messaging/node_modules
types-generator/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Build
run: npm run build
- name: Cache docs output
id: docs-output
uses: actions/cache@v5
with:
path: docs
key: docs-output-${{ github.run_id }}
- name: Build docs
run: npm run docs
needs:
- integration-tests
- integration-tests-special-pages
deploy-docs:
runs-on: ubuntu-latest
needs: integration
if: ${{ github.ref == 'refs/heads/main' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- name: Cache build outputs
id: docs-output
uses: actions/cache@v5
with:
path: docs
key: docs-output-${{ github.run_id }}
- name: Setup Github Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# This job ensures all runtime dependencies for the injected/ subproject are correctly listed in 'dependencies' (not 'devDependencies')
# by running the build with only production dependencies installed in injected/. It will fail if any required dependency is missing.
production-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Cache node_modules (production)
id: cache-node-modules
uses: actions/cache@v5
with:
path: |
node_modules
injected/node_modules
special-pages/node_modules
messaging/node_modules
types-generator/node_modules
key: ${{ runner.os }}-node-modules-prod-${{ hashFiles('.nvmrc') }}-${{ hashFiles('**/package-lock.json') }}
- name: Install production dependencies only (injected/)
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --production
- name: Build with production dependencies (injected/)
run: cd injected && npm run build
- name: Simulate extension esbuild for GPC feature (production deps only)
run: npx esbuild injected/src/features/gpc.js --bundle --outfile=/tmp/gpc-bundle.js
# Single stable check to use for branch protection rules.
# This job will fail if any required job fails/skips/cancels.
ci-gate:
name: CI gate
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- unit
- unit-tests
- integration
- integration-tests
- integration-tests-special-pages
- production-deps
steps:
- name: Ensure all required jobs succeeded
run: |
echo "unit: ${{ needs.unit.result }}"
echo "unit-tests: ${{ needs.unit-tests.result }}"
echo "integration: ${{ needs.integration.result }}"
echo "integration-tests: ${{ needs.integration-tests.result }}"
echo "integration-tests-special-pages: ${{ needs.integration-tests-special-pages.result }}"
echo "production-deps: ${{ needs.production-deps.result }}"
test "${{ needs.unit.result }}" = "success"
test "${{ needs.unit-tests.result }}" = "success"
test "${{ needs.integration.result }}" = "success"
test "${{ needs.integration-tests.result }}" = "success"
test "${{ needs.integration-tests-special-pages.result }}" = "success"
test "${{ needs.production-deps.result }}" = "success"