From bfd175224aef42fe39a31493c5dc30ef3d131757 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Tue, 5 May 2026 04:06:28 +0200 Subject: [PATCH] ci: split frontend and rust quality lanes --- .github/workflows/ci.yml | 94 +++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35d6e6f9..dca5954f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ env: RUST_TARGET_CACHE_VERSION: v2026-04-14-tolaria jobs: - test: - name: Tests & Quality Checks + frontend-quality: + name: Frontend Tests & Quality Checks runs-on: macos-15 steps: @@ -36,28 +36,11 @@ jobs: node-version: '22' cache: 'pnpm' - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt, clippy, llvm-tools-preview - - - name: Cache Rust dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - src-tauri/target - key: ${{ runner.os }}-cargo-${{ env.RUST_TARGET_CACHE_VERSION }}-${{ hashFiles('src-tauri/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-${{ env.RUST_TARGET_CACHE_VERSION }}- - - - name: Install cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov - - name: Install dependencies run: pnpm install --frozen-lockfile + # Keep frontend and Rust quality gates in separate macOS jobs so the + # expensive Rust target cache restore no longer blocks the frontend lane. # ── 0. Build check (catches type errors and bundler failures) ───────── - name: TypeScript type check run: pnpm exec tsc --noEmit @@ -66,8 +49,7 @@ jobs: run: pnpm build # ── 1. Coverage-backed tests ────────────────────────────────────────── - # The coverage commands run the same frontend and Rust test suites, so keep - # them as the canonical test lane instead of running every suite twice. + # The coverage command runs the canonical frontend test suite. - name: Bundle MCP server resources (required by Tauri build) run: node scripts/bundle-mcp-server.mjs @@ -76,25 +58,15 @@ jobs: run: pnpm test:coverage # Thresholds configured in vite.config.ts — exits non-zero if coverage drops - - name: Rust tests + coverage (≥85% lines) - run: | - cargo llvm-cov \ - --manifest-path src-tauri/Cargo.toml \ - --ignore-filename-regex 'lib\.rs|main\.rs|menu\.rs' \ - --lcov \ - --output-path coverage/rust.lcov \ - --fail-under-lines 85 - # cargo-llvm-cov exits non-zero if line coverage drops below 85% - # lib.rs/main.rs/menu.rs are Tauri boilerplate -- not meaningfully unit-testable. - - - name: Upload coverage to Codecov + - name: Upload frontend coverage to Codecov if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository uses: codecov/codecov-action@v5 with: use_oidc: true fail_ci_if_error: true disable_search: true - files: ./coverage/lcov.info,./coverage/rust.lcov + files: ./coverage/lcov.info + flags: frontend verbose: true # OIDC avoids long-lived CODECOV_TOKEN secrets. @@ -158,6 +130,56 @@ jobs: - name: Lint frontend run: pnpm lint + rust-quality: + name: Rust Tests & Quality Checks + runs-on: macos-15 + + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy, llvm-tools-preview + + - name: Cache Rust dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + src-tauri/target + key: ${{ runner.os }}-cargo-${{ env.RUST_TARGET_CACHE_VERSION }}-${{ hashFiles('src-tauri/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-${{ env.RUST_TARGET_CACHE_VERSION }}- + + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + + - name: Rust tests + coverage (≥85% lines) + run: | + mkdir -p coverage + cargo llvm-cov \ + --manifest-path src-tauri/Cargo.toml \ + --ignore-filename-regex 'lib\.rs|main\.rs|menu\.rs' \ + --lcov \ + --output-path coverage/rust.lcov \ + --fail-under-lines 85 + # cargo-llvm-cov exits non-zero if line coverage drops below 85% + # lib.rs/main.rs/menu.rs are Tauri boilerplate -- not meaningfully unit-testable. + + - name: Upload Rust coverage to Codecov + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + uses: codecov/codecov-action@v5 + with: + use_oidc: true + fail_ci_if_error: true + disable_search: true + files: ./coverage/rust.lcov + flags: rust + verbose: true + # OIDC avoids long-lived CODECOV_TOKEN secrets. + - name: Clippy (Rust) run: cargo clippy --manifest-path=src-tauri/Cargo.toml -- -D warnings