Skip to content

Bump Extension.js

Bump Extension.js #90

Workflow file for this run

name: Examples CI
on:
push:
branches: ['**']
pull_request:
branches: ['**']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
NODE_VERSION: '22'
BUN_VERSION: '1.2.14'
jobs:
# ──────────────────────────────────────────────────────────────────────────
# Setup — primes caches so downstream jobs get fast restores
# ──────────────────────────────────────────────────────────────────────────
setup:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Cache node_modules
uses: actions/cache@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-
- run: pnpm install
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-
- run: pnpm test:install chromium firefox
# ──────────────────────────────────────────────────────────────────────────
# Build, lint, contract assertions
# ──────────────────────────────────────────────────────────────────────────
build-and-lint:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- run: node scripts/normalize-examples.mjs
- run: pnpm lint
- run: pnpm run test:banner
- run: pnpm run test:canary-one-run
# ──────────────────────────────────────────────────────────────────────────
# Optional dependency guards
# ──────────────────────────────────────────────────────────────────────────
optional-deps-guards:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- run: corepack enable
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- run: pnpm run test:stable-install-modes
- run: pnpm run test:stable-pnpm-postcss-repro
# ──────────────────────────────────────────────────────────────────────────
# Create + first-dev workflow (Linux)
# ──────────────────────────────────────────────────────────────────────────
create-dev-workflow-guards:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- run: corepack enable
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- run: pnpm run test:content-react
- run: pnpm run test:create-dev-workflow:all-templates
# ──────────────────────────────────────────────────────────────────────────
# Create + first-dev workflow (Windows)
# ──────────────────────────────────────────────────────────────────────────
create-dev-workflow-guards-windows:
needs: setup
runs-on: windows-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
# NOTE: no `cache: 'pnpm'` here. This job does not run `pnpm install`
# (node_modules is restored from a separate cache below). On Windows the
# Windows-specific pnpm cache key is never seeded, so the setup-node
# post-step fails with a "Path Validation Error" when it tries to save a
# nonexistent D:\.pnpm-store\v10 — failing the whole job even though all
# tests pass. Dropping pnpm caching here avoids that false-failure.
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: corepack enable
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- run: pnpm run test:content-react
# Windows is ~4x slower than Linux for create+dev workflows.
# Run a representative subset to stay within the 60-min timeout.
- run: pnpm run test:create-dev-workflow -- '--examples=content,content-react,content-vue,content-svelte,content-typescript,javascript,react'
# ──────────────────────────────────────────────────────────────────────────
# Dev reload regression — Chromium
# ──────────────────────────────────────────────────────────────────────────
dev-reload-chromium:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore Playwright browsers
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
# NOTE: verify-content-live and verify-full-extension-reload are disabled
# until source inspection emits ndjson events reliably in CI. In
# extension@3.13.5 the ChromiumSourceInspectionPlugin hangs silently
# after launch, so no page_html / action_event events are produced and
# every template times out at 180 s × retries, exceeding the job limit.
# The Playwright dev-live project below still validates reload behavior.
- name: Dev-live playwright regression
env:
CI: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm playwright test --workers=1 --project=dev-live
# ──────────────────────────────────────────────────────────────────────────
# Dev reload regression — Firefox
# ──────────────────────────────────────────────────────────────────────────
dev-reload-firefox:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore Playwright browsers
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
# NOTE: verify-content-live and verify-full-extension-reload are disabled
# for Firefox until source inspection is wired into launchFirefox(). In
# extension@3.13.5 the Firefox launcher returns empty no-op stubs for
# reload/logging/close, so no ndjson events are ever emitted and every
# template times out at 180 s × retries, exceeding the job limit.
- name: Firefox dev-reload (placeholder)
run: echo "Firefox source inspection not yet wired — verify scripts disabled"
# ──────────────────────────────────────────────────────────────────────────
# E2E — Content scripts (17 examples)
# ──────────────────────────────────────────────────────────────────────────
e2e-content:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore Playwright browsers
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Get examples
id: get-examples
run: |
EXAMPLES=$(node scripts/get-examples-for-project.mjs content)
echo "examples=$EXAMPLES" >> $GITHUB_OUTPUT
- name: Build (chrome only)
run: node scripts/build-all.mjs --filter="${{ steps.get-examples.outputs.examples }}" --browsers=chrome
- name: Run tests
env:
CI: true
SKIP_BUILD: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:content
- name: Upload test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: report-content
path: |
e2e-report/
test-results.json
retention-days: 7
if-no-files-found: ignore
- name: Upload build artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: built-examples-content
path: |
examples/content*/dist/
examples/content*/build/
examples/content*/.extension/
compression-level: 6
retention-days: 1
if-no-files-found: ignore
# ──────────────────────────────────────────────────────────────────────────
# E2E — Sidebar (4 examples)
# ──────────────────────────────────────────────────────────────────────────
e2e-sidebar:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore Playwright browsers
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Get examples
id: get-examples
run: |
EXAMPLES=$(node scripts/get-examples-for-project.mjs sidebar)
echo "examples=$EXAMPLES" >> $GITHUB_OUTPUT
- name: Build (chrome only)
run: node scripts/build-all.mjs --filter="${{ steps.get-examples.outputs.examples }}" --browsers=chrome
- name: Run tests
env:
CI: true
SKIP_BUILD: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:sidebar
- name: Upload test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: report-sidebar
path: |
e2e-report/
test-results.json
retention-days: 7
if-no-files-found: ignore
- name: Upload build artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: built-examples-sidebar
path: |
examples/sidebar*/dist/
examples/sidebar*/build/
examples/sidebar*/.extension/
compression-level: 6
retention-days: 1
if-no-files-found: ignore
# ──────────────────────────────────────────────────────────────────────────
# E2E — New tab (10+ examples)
# ──────────────────────────────────────────────────────────────────────────
e2e-newtab:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore Playwright browsers
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Get examples
id: get-examples
run: |
EXAMPLES=$(node scripts/get-examples-for-project.mjs newtab)
echo "examples=$EXAMPLES" >> $GITHUB_OUTPUT
- name: Build (chrome only)
run: node scripts/build-all.mjs --filter="${{ steps.get-examples.outputs.examples }}" --browsers=chrome
- name: Run tests
env:
CI: true
SKIP_BUILD: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:newtab
- name: Upload test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: report-newtab
path: |
e2e-report/
test-results.json
retention-days: 7
if-no-files-found: ignore
- name: Upload build artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: built-examples-newtab
path: |
examples/new*/dist/
examples/new*/build/
examples/new*/.extension/
compression-level: 6
retention-days: 1
if-no-files-found: ignore
# ──────────────────────────────────────────────────────────────────────────
# E2E — Mixed context (javascript, preact, react, svelte, typescript, vue)
# ──────────────────────────────────────────────────────────────────────────
e2e-mixed-context:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore Playwright browsers
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Get examples
id: get-examples
run: |
EXAMPLES=$(node scripts/get-examples-for-project.mjs mixed-context)
echo "examples=$EXAMPLES" >> $GITHUB_OUTPUT
- name: Build (chrome only)
run: node scripts/build-all.mjs --filter="${{ steps.get-examples.outputs.examples }}" --browsers=chrome
- name: Run tests
env:
CI: true
SKIP_BUILD: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:mixed
- name: Upload test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: report-mixed-context
path: |
e2e-report/
test-results.json
retention-days: 7
if-no-files-found: ignore
- name: Upload build artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: built-examples-mixed-context
path: |
examples/javascript/dist/
examples/preact/dist/
examples/react/dist/
examples/svelte/dist/
examples/typescript/dist/
examples/vue/dist/
compression-level: 6
retention-days: 1
if-no-files-found: ignore
# ──────────────────────────────────────────────────────────────────────────
# E2E — Small batch (action + special-folders + other + init)
# Merged into one job to reduce runner startup overhead.
# ──────────────────────────────────────────────────────────────────────────
e2e-small:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore Playwright browsers
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Get examples
id: get-examples
run: |
ACTION=$(node scripts/get-examples-for-project.mjs action)
SPECIAL=$(node scripts/get-examples-for-project.mjs special-folders)
OTHER=$(node scripts/get-examples-for-project.mjs other)
ALL="${ACTION},${SPECIAL},${OTHER}"
echo "examples=$ALL" >> $GITHUB_OUTPUT
- name: Build (chrome only)
run: node scripts/build-all.mjs --filter="${{ steps.get-examples.outputs.examples }}" --browsers=chrome
- name: Run action tests
env:
CI: true
SKIP_BUILD: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:action
- name: Run special-folders tests
env:
CI: true
SKIP_BUILD: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:special
- name: Run other tests
env:
CI: true
SKIP_BUILD: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:other
- name: Upload test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: report-small
path: |
e2e-report/
test-results.json
retention-days: 7
if-no-files-found: ignore
- name: Upload build artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: built-examples-small
path: |
examples/action*/dist/
examples/special-folders*/dist/
examples/init/dist/
compression-level: 6
retention-days: 1
if-no-files-found: ignore
# ──────────────────────────────────────────────────────────────────────────
# E2E — Assets (shadow DOM, CSS pipeline, icons, framework mount, SW)
# Fast suite (~35s) that catches broad regressions across all context types.
# ──────────────────────────────────────────────────────────────────────────
e2e-assets:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Restore Playwright browsers
uses: actions/cache/restore@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
- name: Build assets examples (chrome only)
run: |
node scripts/build-all.mjs \
--filter="content,content-css-modules,content-sass,content-less,content-sass-modules,content-less-modules,content-main-world,content-multi-one-entry,content-multi-three-entries,action,new,sidebar,react,vue,svelte,preact,javascript" \
--browsers=chrome
- name: Run assets tests
env:
CI: true
SKIP_BUILD: true
HEADLESS: false
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:assets
- name: Upload test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: report-assets
path: |
e2e-report/
test-results.json
retention-days: 7
if-no-files-found: ignore
# ──────────────────────────────────────────────────────────────────────────
# E2E — Firefox runtime (content scripts, addon install, manifest checks)
# Builds all examples for Firefox and runs headed Firefox via xvfb + RDP.
# ──────────────────────────────────────────────────────────────────────────
e2e-firefox:
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
node_modules
examples/*/node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
- name: Cache Playwright browsers (Firefox)
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-ff-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-ff-
${{ runner.os }}-playwright-
- name: Install Playwright Firefox
run: pnpm test:install firefox
- name: Build all examples (firefox only)
run: node scripts/build-all.mjs --browsers=firefox
- name: Run Firefox tests
env:
CI: true
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" pnpm test:firefox
- name: Upload test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: report-firefox
path: |
e2e-report/
test-results.json
retention-days: 7
if-no-files-found: ignore
# Packaging and publication are handled by publish-artifacts.yml on main