From 448ea769ebe51f50daabd6c99c3ff9b2742c1073 Mon Sep 17 00:00:00 2001 From: bherbruck Date: Sat, 10 Oct 2026 15:06:58 +0000 Subject: [PATCH] CI builds tests and lints with a ci profile instead of --release Light optimisation (deps at 2), line tables only, no LTO, debug assertions off (truck's debug-only checks reject valid geometry, the only reason tests used --release). Cold full `cargo xtask ci`: 14 min with all 647 tests passing; the oracle, step-corpus and app builds stay on --release. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT --- .github/workflows/ci.yml | 6 +++--- CONTRIBUTING.md | 10 ++++++---- Cargo.toml | 15 +++++++++++++++ xtask/src/main.rs | 4 ++-- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15b89774..27468dde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: key: native-clippy - - run: cargo clippy --workspace --all-targets --release --locked -- -D warnings + - run: cargo clippy --workspace --all-targets --profile ci --locked -- -D warnings tests: name: Native Linux tests @@ -105,9 +105,9 @@ jobs: with: key: native-tests - name: Compile tests - run: cargo test --workspace --release --locked --no-run + run: cargo test --workspace --profile ci --locked --no-run - name: Run tests - run: cargo test --workspace --release --locked + run: cargo test --workspace --profile ci --locked # Preserve the existing check name for branch protection, including docs-only PRs. ci: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67601f1a..b06a05fd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ build you also need `rustup target add wasm32-unknown-unknown` and [`trunk`](htt ```sh git clone https://github.com/bherbruck/solvecraft && cd solvecraft cargo run --release -p solvecraft -- --sample # desktop app with a sample part -cargo test --workspace --release # unit, engine and UI-scenario tests +cargo test --workspace --profile ci # unit, engine and UI-scenario tests cargo xtask ci # everything a PR must pass (see below) ``` @@ -81,7 +81,7 @@ the most complete description of the house style. | What | Where | Run | |---|---|---| -| Unit and engine tests | next to the code, or `*_tests.rs` files | `cargo test --workspace --release` | +| Unit and engine tests | next to the code, or `*_tests.rs` files | `cargo test --workspace --profile ci` | | UI scenarios | `crates/ui-egui/tests/scenarios/*.json` | part of `cargo test` | | Fusion oracle | `cargo xtask oracle` | needs the local oracle data (see below) | @@ -102,8 +102,10 @@ press keys, then assert on the result. A new `.json` file in that folder is picked up automatically. To record a bug before it's fixed, put `{"pending": "why"}` in the scenario, and remove it in the PR that fixes the bug. -**Release mode matters.** CI runs the tests with `--release`. truck has debug-only assertions -that can fail on valid geometry, so if a test fails only in debug, say so in the PR. +**Use the `ci` profile.** CI runs the tests with `--profile ci`: light optimisation, line tables, +no LTO, and debug assertions off (truck has debug-only assertions that reject valid geometry). It +builds several times faster than `--release`. If a test fails only in a plain debug build, say so +in the PR. **The Fusion oracle** is a set of 76 reference parts, each built in Fusion from a recipe. SolveCraft rebuilds the same recipe and compares volume, area and topology counts with Fusion's diff --git a/Cargo.toml b/Cargo.toml index 6da43de1..6401fdec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,6 +72,21 @@ opt-level = 2 [profile.dev] opt-level = 1 +# Tests and lints (`cargo xtask ci`, GitHub CI): quick to build, quick enough to run. Light +# optimisation, line tables only (file:line in backtraces), no LTO. Debug assertions are off because +# truck's debug-only checks reject valid geometry (seam edges, closed edges); that was the only +# reason the tests used to build with --release, which cost most of CI's time. +[profile.ci] +inherits = "dev" +opt-level = 1 +debug = "line-tables-only" +debug-assertions = false +overflow-checks = true +incremental = false + +[profile.ci.package."*"] +opt-level = 2 + [profile.release] opt-level = 3 lto = "thin" diff --git a/xtask/src/main.rs b/xtask/src/main.rs index f871a552..ae230c60 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -322,10 +322,10 @@ fn cmd_ci() -> Result<(), String> { c.args(["fmt", "--all", "--", "--check"]); run(c, "cargo fmt --check")?; let mut c = cargo(); - c.args(["clippy", "--workspace", "--all-targets", "--release", "--", "-D", "warnings"]); + c.args(["clippy", "--workspace", "--all-targets", "--profile", "ci", "--", "-D", "warnings"]); run(c, "cargo clippy -D warnings")?; let mut c = cargo(); - c.args(["test", "--workspace", "--release"]); + c.args(["test", "--workspace", "--profile", "ci"]); run(c, "cargo test")?; assets::run(&root())?; licences::run(&root(), true)?;