name: CI on: push: branches: [main, experiment/*] pull_request: branches: [main] jobs: test: name: Tests & Quality Checks runs-on: macos-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Full history for CodeScene - name: Setup pnpm uses: pnpm/action-setup@v4 with: version: 10 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' cache: 'pnpm' - name: Setup Rust uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy, llvm-tools-preview - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - name: Install dependencies run: pnpm install --frozen-lockfile # ── 1. Tests ────────────────────────────────────────────────────────── - name: Run frontend tests run: pnpm test - name: Run Rust tests run: cargo test --manifest-path=src-tauri/Cargo.toml # ── 2. Coverage (enforced — fails build if thresholds not met) ──────── - name: Frontend coverage (≥70% lines/functions/branches/statements) run: pnpm test:coverage # Thresholds configured in vite.config.ts — exits non-zero if coverage drops - name: Rust coverage (≥85% lines) run: | cargo llvm-cov \ --manifest-path src-tauri/Cargo.toml \ --fail-under-lines 85 # cargo-llvm-cov exits non-zero if line coverage drops below 85% # ── 3. Code Health (CodeScene) ─────────────────────────────────────── # CodeScene PR reviews are handled via webhook integration configured # in the CodeScene dashboard — not via a GitHub Action. # No CI step needed here; CodeScene posts review comments directly on PRs # and can block merges via its own GitHub App status check. # ── 4. Documentation check (warning only — does not fail build) ─────── - name: Check docs are updated continue-on-error: true run: | if git log -1 --pretty=%B | grep -i '\[skip docs\]' > /dev/null; then echo "⏭️ Documentation check skipped" exit 0 fi if git diff --name-only origin/main | grep -E '^(src/|src-tauri/)' > /dev/null; then if ! git diff --name-only origin/main | grep -E '^docs/' > /dev/null; then echo "⚠️ Code files changed but docs/ not updated" git diff --name-only origin/main | grep -E '^(src/|src-tauri/)' echo "If this change affects architecture/abstractions/theme documented in docs/, update them." echo "To suppress: include [skip docs] in your commit message." fi fi echo "✅ Documentation check passed" # ── 5. Lint & format ────────────────────────────────────────────────── - name: Lint frontend run: pnpm lint continue-on-error: true # NOTE: codebase has ~60 pre-existing lint errors (no-explicit-any, react hooks, etc.) # tracked in Todoist — fix before removing continue-on-error - name: Clippy (Rust) run: cargo clippy --manifest-path=src-tauri/Cargo.toml -- -D warnings - name: Format check (Rust) run: cargo fmt --manifest-path=src-tauri/Cargo.toml -- --check