Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Set up the repository
description: Node.js at the version of .nvmrc, the dependencies of the lockfile and, when asked, the Chromium of Playwright. Run it after the checkout.

inputs:
playwright:
description: Install the Chromium of Playwright with its system dependencies
default: "false"

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
shell: bash
run: npm ci

- name: Install Playwright Chromium
if: inputs.playwright == 'true'
shell: bash
working-directory: cli
run: npx playwright install --with-deps chromium
130 changes: 98 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@ concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

# The jobs run side by side, each on its own runner. The E2E tests of the CLI are most of the time
# of a run, so they are split in shards: a shard has a whole runner, as the suite had when it ran
# alone, and the tests that read timings keep their margin.
jobs:
validate:
# A pull request that only changes documentation skips the jobs that build and launch Chromium
changes:
runs-on: ubuntu-latest
# A run takes about 12 minutes. Without a limit, one that hangs holds the runner for 6 hours
timeout-minutes: 25
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
outputs:
skip: ${{ steps.slow.outputs.skip }}

steps:
- name: Checkout repository
Expand All @@ -31,9 +39,8 @@ jobs:
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: 'npm'

- name: Decide whether to skip the slow steps
- name: Decide whether to skip the slow jobs
id: slow
env:
EVENT_NAME: ${{ github.event_name }}
Expand All @@ -42,19 +49,22 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: node scripts/ci-skip-slow-steps.js

- name: Install dependencies
run: npm ci
# What needs neither a build nor a browser
checks:
runs-on: ubuntu-latest
timeout-minutes: 10

- name: Lint
run: npm run lint
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Build
if: steps.slow.outputs.skip != 'true'
run: npm run build
- name: Set up the repository
uses: ./.github/actions/setup

- name: Check the built snippets
if: steps.slow.outputs.skip != 'true'
run: npm run check:built-snippets
- name: Lint
run: npm run lint

- name: Check consistency
run: npm run check:consistency
Expand All @@ -68,12 +78,18 @@ jobs:
if: github.event_name == 'push'
run: node scripts/release-versions.js --untagged

- name: Run demo tests
run: npm run test:demos

- name: Check emojis have icons
run: npm run check:emoji

- name: Check generated skills are up to date
run: npm run generate-skills:check

- name: Check generated llms files are up to date
run: npm run generate-llms:check

- name: Run demo tests
run: npm run test:demos

- name: Run icon plugin tests
run: npm run test:icons

Expand All @@ -89,12 +105,6 @@ jobs:
- name: Run extension tests
run: npm run test:extension

- name: Check generated skills are up to date
run: npm run generate-skills:check

- name: Check generated llms files are up to date
run: npm run generate-llms:check

- name: Run skill script tests
run: npm run test:skills

Expand All @@ -110,21 +120,77 @@ jobs:
- name: Run unit tests
run: npm run test:unit --prefix cli

- name: Install Playwright Chromium
if: steps.slow.outputs.skip != 'true'
run: npx playwright install --with-deps chromium
working-directory: cli
build:
needs: changes
if: needs.changes.outputs.skip != 'true'
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up the repository
uses: ./.github/actions/setup
with:
playwright: "true"

- name: Build
run: npm run build

- name: Check the built snippets
run: npm run check:built-snippets

# Reports to the job summary and does not block: a failing audit marks this step, not the job.
- name: Audit agentic browsing with Lighthouse
if: steps.slow.outputs.skip != 'true'
continue-on-error: true
run: npm run audit:agentic

e2e-cli:
name: E2E of the CLI (${{ matrix.shard }}/4)
needs: changes
if: needs.changes.outputs.skip != 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
# A shard that fails does not stop the others: the run says everything that fails
fail-fast: false
matrix:
shard: [1, 2, 3, 4]

steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up the repository
uses: ./.github/actions/setup
with:
playwright: "true"

- name: Run E2E tests
if: steps.slow.outputs.skip != 'true'
run: npm run test:e2e --prefix cli
run: npm run test:e2e --prefix cli -- --shard=${{ matrix.shard }}/4

e2e-extension:
name: E2E of the extension
needs: changes
if: needs.changes.outputs.skip != 'true'
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up the repository
uses: ./.github/actions/setup
with:
playwright: "true"

- name: Run extension E2E tests
if: steps.slow.outputs.skip != 'true'
run: npm run test:extension:e2e
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ npm run smoke:cli-package # before a CLI release: the packed CLI installed i
npm run test:e2e --prefix cli # Playwright against local fixtures (cli/tests/fixtures)
```

CI (`.github/workflows/ci.yml`) runs lint, build, all the checks above except `eval:prompts`, `generate-skills:check` and the CLI unit and e2e tests. The pre-commit hook (`.githooks/pre-commit`) runs `check:consistency`, `check:emoji` and `lint`.
CI (`.github/workflows/ci.yml`) runs lint, build, all the checks above except `eval:prompts`, `generate-skills:check` and the CLI unit and e2e tests. Its jobs run side by side: `checks` (what needs neither a build nor a browser), `build`, the e2e tests of the extension, and the e2e tests of the CLI in four shards; `.github/actions/setup` installs Node, the dependencies and Chromium for all of them. The pre-commit hook (`.githooks/pre-commit`) runs `check:consistency`, `check:emoji` and `lint`.

## Snippets

Expand Down
Loading