Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

CI builds tests and lints with a ci profile instead of --release

bherbruck448ea769ebe5
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 15b8977438..27468dde6c 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 67601f1ad7..b06a05fd61 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 6da43de187..6401fdecf2 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 f871a552f6..ae230c6042 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)?;