Files
actionbook__actionbook/.github/workflows/test.yml
mcfn.feng e51ec6ec9d [packages/cli-v2]feat: enable parallel E2E tests with profile cleanup
- browser close now removes the Chrome profile directory after killing
  the process, preventing disk accumulation from test runs
- Remove --test-threads=1 from CI — each test already uses a unique
  session/profile via unique_session(), so parallel execution is safe
- Profile isolation: each test gets its own Chrome user-data-dir,
  no shared state between concurrent tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 12:31:54 +08:00

103 lines
2.3 KiB
YAML

name: Tests (cli-v2)
on:
push:
branches: [main, "release/**"]
paths:
- "packages/cli-v2/**"
pull_request:
branches: [main, "release/**"]
paths:
- "packages/cli-v2/**"
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
checks: write
jobs:
lint:
name: Lint (fmt + clippy)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
packages/cli-v2/target
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('packages/cli-v2/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-lint-
- name: Check formatting
working-directory: packages/cli-v2
run: cargo fmt --all -- --check
- name: Run clippy
working-directory: packages/cli-v2
run: cargo clippy --all-targets -- -D warnings
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/cli-v2
shared-key: unit-tests
- name: Run unit tests
working-directory: packages/cli-v2
run: cargo test --lib
e2e-tests:
name: E2E Tests
# Only run on merge to main/release branches, not on PRs
if: github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/cli-v2
shared-key: e2e-tests
- name: Install Chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- name: Run E2E tests
working-directory: packages/cli-v2
env:
RUN_E2E_TESTS: "true"
run: cargo test --test e2e