diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa3c78c6..a5583993 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,6 +87,60 @@ jobs: run: npx tsc --noEmit working-directory: standalone - - name: Cargo check - run: cargo check + # `cargo test` rather than `cargo check`: the crate carries unit tests + # (path/session/sidecar resolution in lib.rs) that no job ran, so they + # compiled at most as `cargo check` and never executed. Building the test + # harness also links, which `check` does not. + - name: Cargo test + run: cargo test + working-directory: standalone/src-tauri + + standalone-platform-check: + # The job above runs on Linux only, so it compiles none of the crate's + # `#[cfg(windows)]` / `#[cfg(target_os = "macos")]` code — two whole modules + # (clipboard_win.rs, pe_subsystem.rs), the platform arms throughout lib.rs + # and build.rs, and the unit tests gated with them. Without this job their + # first compile is the Windows / macOS leg of release.yml, which runs only on + # a `v*` tag: a typo in Windows-only Rust surfaces as a failed release rather + # than as a failed PR. Deliberately a separate job from the smoketest above, + # so that job keeps its registered check name. + name: Standalone Platform Check (${{ matrix.platform }}) + strategy: + # Each platform's compile is independent; a Windows failure must not hide + # what macOS would have said. + fail-fast: false + matrix: + platform: [windows-latest, macos-latest] + runs-on: ${{ matrix.platform }} + + # A hung compile on a premium-billed runner must not ride the 6-hour job + # default. Cold-cache runs land at ~2min (macOS) and ~5min (Windows). + timeout-minutes: 20 + + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + # Same pin-driven setup as the smoketest above: build.rs fails unless the + # Node.js on PATH matches package.json's devEngines.runtime.version. + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version-file: package.json + + - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable + + # Windows and macOS runners bill at a multiple of Linux, so the dependency + # compile is cached rather than paid on every PR. + - name: Rust cache + uses: swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 + with: + workspaces: standalone/src-tauri + + # No pnpm install and no TypeScript check here. The TS check is + # platform-independent and the smoketest above already runs it; and the Rust + # build never reads node_modules — build.rs needs only `node` on PATH (it + # resolves the binary with `node -p process.execPath`) plus the root + # package.json version pin. This job exists for the Rust the smoketest + # cannot see. + - name: Cargo test + run: cargo test working-directory: standalone/src-tauri