mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-10 10:20:47 -06:00
AO1: fast CI profile, looser timing tests
- [profile.ci] (release without LTO, 16 codegen units); `xtask ci` runs clippy and tests with --profile ci instead of --release. - Wall-clock asserts in engine memory_tick, gpu OpenGL decline and script socket tests keep their intent with bounds that survive a loaded machine. - docs/testing.md and CONTRIBUTING.md mention the profile. (cherry picked from commit b45c8a379351ebdfda0d7076ad4b740baf6f2087) (cherry picked from commit fa1ea6a107c4c1936cde89b518a05adc73f2b4b0)
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ You need [Rust](https://rustup.rs/) 1.95 or newer.
|
||||
```sh
|
||||
cargo run -p effectcraft -- --demo # the desktop app, with the demo project
|
||||
cargo test --workspace
|
||||
cargo xtask ci # what every commit must pass
|
||||
cargo xtask ci # what every commit must pass (tests use --profile ci)
|
||||
```
|
||||
|
||||
## Ground rules
|
||||
|
||||
@@ -204,3 +204,10 @@ opt-level = 3
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
codegen-units = 1
|
||||
|
||||
# `cargo xtask ci` builds clippy and tests with this profile. Tests don't need shipping-grade LTO:
|
||||
# thin LTO + one codegen unit across ~69 test binaries made the gate ~1.5 h while the tests run in ~75 s.
|
||||
[profile.ci]
|
||||
inherits = "release"
|
||||
lto = false
|
||||
codegen-units = 16
|
||||
|
||||
@@ -545,11 +545,13 @@ fn open_recent_increment_and_revert() {
|
||||
fn memory_tick_never_waits_for_the_system() {
|
||||
let mut s = Session::default();
|
||||
let t0 = std::time::Instant::now();
|
||||
s.memory_tick();
|
||||
s.memory_tick();
|
||||
for _ in 0..8 {
|
||||
s.memory_tick();
|
||||
}
|
||||
// Reading the system's memory starts PowerShell on Windows (about a second): the UI thread
|
||||
// only takes the last reading.
|
||||
assert!(t0.elapsed() < std::time::Duration::from_millis(200), "{:?}", t0.elapsed());
|
||||
// only takes the last reading. Eight blocking ticks would take ~8 s; the bound is loose so a
|
||||
// loaded machine doesn't flake it.
|
||||
assert!(t0.elapsed() < std::time::Duration::from_secs(4), "{:?}", t0.elapsed());
|
||||
if crate::sysinfo::memory().is_some() {
|
||||
let mut got = None;
|
||||
for _ in 0..200 {
|
||||
|
||||
@@ -146,7 +146,8 @@ fn opengl_adapters_get_cpu_compositing_at_once() {
|
||||
let t = std::time::Instant::now();
|
||||
let error = crate::Gpu::new(&adapter, device, queue).err().expect("no GPU compositor on OpenGL");
|
||||
assert!(error.contains("(Gl)"), "{error}");
|
||||
assert!(t.elapsed() < std::time::Duration::from_secs(1), "{:?}", t.elapsed());
|
||||
// Generous bound (the failure mode took tens of seconds) so a loaded machine doesn't flake it.
|
||||
assert!(t.elapsed() < std::time::Duration::from_secs(10), "{:?}", t.elapsed());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -441,5 +441,6 @@ fn socket_edge_cases() {
|
||||
"net.jsx",
|
||||
);
|
||||
assert_eq!(o.result, json!(0), "{:?}", o.error);
|
||||
assert!(t.elapsed().as_secs_f64() < 5.0);
|
||||
// Doesn't hang; generous so a loaded machine doesn't flake it.
|
||||
assert!(t.elapsed().as_secs_f64() < 30.0, "{:?}", t.elapsed());
|
||||
}
|
||||
|
||||
@@ -51,6 +51,9 @@ Limits: a crate that reads a repo file at run time through a path that is not a
|
||||
sources is not detected, and building a subset of packages can unify features differently from the
|
||||
whole workspace. Run the full `cargo xtask ci` before a release.
|
||||
|
||||
`xtask ci` builds clippy and tests with `--profile ci` (release optimisation without LTO, 16 codegen
|
||||
units, output in `target/ci/`): fast to build, still optimised enough for the pixel and perf tests.
|
||||
|
||||
## What the tests cover
|
||||
|
||||
- **Engine commands** (`crates/engine/src/tests*.rs`): every command family, including undo and
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@
|
||||
//! - `assets`: every asset file (image, icon, font, LUT, audio, video…) has a complete
|
||||
//! `<file>.attribution` sidecar and an entry in `ATTRIBUTION.md` (AGENTS.md §1).
|
||||
//! - `ico <out.ico> <in.png>…`: pack PNGs into a Windows `.ico` (used by `packaging/icons.sh`).
|
||||
//! - `ci`: fmt check, clippy -D warnings, tests, layers, assets, wasm.
|
||||
//! - `ci`: fmt check, clippy -D warnings, tests (`--profile ci`), layers, assets, wasm.
|
||||
//! - `ci --affected [--base REV] [--dry-run]`: the same gates for only the crates the change since
|
||||
//! REV (default: the merge-base with `main`) can affect; see `affected.rs` and docs/testing.md.
|
||||
|
||||
@@ -408,8 +408,8 @@ fn serve_dir(dir: &std::path::Path, port: u16) -> Result<(), String> {
|
||||
fn ci() -> Result<(), String> {
|
||||
let cargo = env!("CARGO");
|
||||
run(Command::new(cargo).args(["fmt", "--check"]))?;
|
||||
run(Command::new(cargo).args(["clippy", "--workspace", "--all-targets", "--release", "--", "-D", "warnings"]))?;
|
||||
run(Command::new(cargo).args(["test", "--workspace", "--release"]))?;
|
||||
run(Command::new(cargo).args(["clippy", "--workspace", "--all-targets", "--profile", "ci", "--", "-D", "warnings"]))?;
|
||||
run(Command::new(cargo).args(["test", "--workspace", "--profile", "ci"]))?;
|
||||
layers()?;
|
||||
assets()?;
|
||||
wasm()
|
||||
|
||||
Reference in New Issue
Block a user