diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bef15d1..1145b532 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,6 @@ jobs: # Same craft-fonts commit as release.yml. craft-fonts-ref: aced4137c022f1f587624d48e81ec77e1914a9cc os: '["ubuntu-24.04","windows-latest"]' - toolchain: "1.96.0" # xtask ci runs cargo test (including doctests), not cargo nextest. tools: "" packages: >- diff --git a/Cargo.toml b/Cargo.toml index 692bd9f4..cb9745b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -117,6 +117,13 @@ opt-level = 1 lto = "thin" codegen-units = 1 +# Fast optimized verification: each test executable otherwise repeats cross-crate LTO. +# `false` keeps thin LTO within each crate; release packaging keeps the profile above. +[profile.verify] +inherits = "release" +lto = false +codegen-units = 16 + [profile.wasm-release] inherits = "release" opt-level = "s" diff --git a/docs/testing-ci.md b/docs/testing-ci.md index 7db9ae07..4fb8d5fd 100644 --- a/docs/testing-ci.md +++ b/docs/testing-ci.md @@ -12,6 +12,31 @@ Run a feature module with a test-name filter, for example: cargo test -p texturecraft-engine --test it bake:: ``` +For faster optimized local verification, run the same workspace tests and doctests +with the `verify` profile: + +```sh +cargo test --workspace --profile verify +``` + +`verify` inherits the release profile's optimization level and runtime checks, but +uses 16 codegen units and `lto = false`. Cargo retains thin LTO within each crate +without repeating cross-crate LTO for every test executable. The existing test +selection and ignore attributes still apply. Keep the target directory between +runs so Cargo can reuse unchanged build artifacts. + +To compile the normal application binaries alongside the test binaries before +running them: + +```sh +cargo build --workspace --bins --tests --profile verify +cargo test --workspace --profile verify +``` + +This profile is for local verification. Use `--release` for release validation and +performance measurements; its compiler settings remain unchanged. The regular +debug test profile and CI gates also remain unchanged. + The standalone engine `session` target and UI `ui_snapshots` target remain available for the commands in `AGENTS.md`. Existing ignore attributes are unchanged. Tests in the shared executable can run concurrently across modules; diff --git a/xtask/src/main.rs b/xtask/src/main.rs index ccbdc2c7..2ff6178a 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -15,7 +15,7 @@ usage: cargo xtask commands: layers enforce the crate dependency layering (xtask/src/layers.rs) wasm cargo check --target wasm32-unknown-unknown for the wasm crates and the web app - ci fmt --check, clippy -D warnings, test, layers, wasm (stops at the first failure) + ci fmt --check, layers, clippy -D warnings, test, wasm (stops at the first failure) version [set X.Y.Z[-pre]] print the workspace version, or set it (Cargo.toml + Cargo.lock) ico ... @@ -154,11 +154,12 @@ fn cmd_ci() -> Result<(), String> { } }; type Step = (&'static str, Box Result<(), String>>); + // Reject invalid dependency layering before spending time compiling and running the workspace. let steps: Vec = vec![ ("fmt", Box::new(cargo_step(&["fmt", "--all", "--", "--check"]))), + ("layers", Box::new(cmd_layers)), ("clippy", Box::new(cargo_step(&["clippy", "--workspace", "--all-targets", "--", "-D", "warnings"]))), ("test", Box::new(cargo_step(&["test", "--workspace"]))), - ("layers", Box::new(cmd_layers)), ("wasm", Box::new(cmd_wasm)), ]; for (i, (name, step)) in steps.iter().enumerate() {