mirror of
https://github.com/storytold/filmcraft.git
synced 2026-11-19 08:53:21 +01:00
CI (Windows): clippy and tests of the crates with Windows-only code (#4649)
* CI (Windows): clippy and tests of the crates with Windows-only code A Windows leg through the shared gate and changed-paths workflows, as LightCraft has: pull requests and pushes to main that touch the Windows code (WASAPI audio, the graphics test start, Media Foundation / D3D11 decoding, their manifests and the lockfile), and pull requests labelled full-ci. Nothing ran these crates' tests on Windows before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(filmcraft): accept a reset when the control server drops an expired connection The first Windows run of the new CI leg failed unterminated_request_releases_its_slot: Windows ended the timed-out connection with a reset (os error 10054), not a close, so read_to_string returned ConnectionReset. Either way the client got no reply. Bytes read before a reset stay in the string, so the no-stale-reply check still applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ui-egui): let the drag-while-playing test wait for frames on a busy runner The Windows leg (#4649) failed program_monitor_plays_on_while_a_value_is_dragged once: in 90 passes (~1.5 s) the workers finished no frame at a newer revision, so only frame 23 showed. It passed in the run before. The test now drags until five frames have shown, for up to ~10 s, so a picture held for the whole drag (the #1673 bug) still fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci(windows): run the Windows leg's tests under nextest `cargo test` runs all of a binary's tests in one process, so they share rayon's global pool and one test's work waits behind another's. The UI binary's drag-while-playing test failed on one of two attempts at the same commit (run 43007266199). On a Windows 11 sandbox it passed in six runs: alone, with the whole binary, pinned to 1, 2 or 4 cores, and with a one-thread rayon pool. The last run did fail another timing-bound test (proxy creation, no proxies after ~8 s), which shows how tests in one process hold each other up. The Linux gate (`cargo xtask ci`) already uses nextest: each test in its own process, with .config/nextest.toml's groups. The gate installs cargo-nextest 0.9.150 on every OS, and the targets are the same (--lib --bins --tests; no doctests on either leg's test step). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci(windows): fix main's first Windows-only clippy error; drop the moved h264 crate The Windows leg's first run against current main stopped at crates/engine/src/lib.rs: `let mut dir = DirBuilder::new()` (#4264) is only mutated on Unix, where it sets the folder's mode, so on Windows `-D warnings` turns the unused `mut` into an error. The builder is now made per platform. Nothing compiled Windows code on main until this leg. crates/h264 moved to craft-libs (504fe9fc5), so `-p filmcraft-h264` no longer matches a package and `crates/h264/*` no longer exists: both are removed from the leg. On a Windows 11 sandbox at main merged into this branch (c7ef3f96) with this change: `cargo fmt --all --check` passes, the leg's clippy command for its six packages passes, and filmcraft-engine's lib tests pass (907). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(nextest): run the real-time play_ahead tests with nothing beside them On the Windows leg, two play_ahead tests failed with silence where frames were due: plays_every_frame_in_order_from_the_start at frame 27648, and a_device_with_other_channels_plays_the_channels_both_have at frame 1024, two callbacks in, after a 30 ms head start in which the mixer should have filled its 200 ms lead at once. The mixer thread only sleeps when its ring is full, so it wasn't scheduled: nextest runs a test process per core, and these tests need a thread on time against a wall-clock device. They get the same rule as render's mixer_perf. The other 2531 tests passed, the drag-while-playing test among them (run 43270273462). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com>
This commit is contained in:
5 files changed
+104
-4
No files matched your search
@@ -16,3 +16,10 @@ test-group = "nvenc"
|
||||
[[profile.default.overrides]]
|
||||
filter = "package(filmcraft-render) and binary(mixer_perf)"
|
||||
threads-required = "num-test-threads"
|
||||
|
||||
# Real-time audio: a wall-clock device takes a period every 10.7 ms, and the mixer thread must
|
||||
# stay ahead of it. With other tests' processes busy on every core, the thread isn't scheduled in
|
||||
# time and the device plays silence (Windows runners, #4649), so nothing runs beside them.
|
||||
[[profile.default.overrides]]
|
||||
filter = "package(filmcraft-ui-egui) and binary(play_ahead)"
|
||||
threads-required = "num-test-threads"
|
||||
@@ -0,0 +1,76 @@
|
||||
name: CI (Windows)
|
||||
|
||||
# The Windows leg of the gate: clippy and the tests of the crates with Windows-only code, on pull
|
||||
# requests and pushes to main that touch that code, and on pull requests labelled `full-ci`.
|
||||
# The Linux gate (ci.yml) still runs everything else on every pull request.
|
||||
#
|
||||
# Most bug reports come from Windows, and code there differs: WASAPI audio (the scrub output and
|
||||
# playback, #2633), the graphics test start and the registry driver lookup (#1061), Media
|
||||
# Foundation and D3D11 decoding (crates/platform). Nothing else runs these crates' tests on
|
||||
# Windows. Not the full `cargo xtask ci`: on a cold windows-latest runner that is well over an
|
||||
# hour, and its wasm, layering and asset steps don't differ by platform.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
# `labeled`: adding `full-ci` starts it. Other labels skip (see concurrency and the scope job).
|
||||
types: [opened, synchronize, reopened, labeled]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# Its own group, so the Windows leg never cancels the Linux gate. A newer push to a PR branch
|
||||
# cancels its older run; a label other than `full-ci` gets a group of its own, so it cancels nothing.
|
||||
concurrency:
|
||||
group: ci-windows-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}${{ github.event.action == 'labeled' && github.event.label.name != 'full-ci' && format('-label-{0}', github.run_id) || '' }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
windows-scope:
|
||||
if: github.event.action != 'labeled' || github.event.label.name == 'full-ci'
|
||||
uses: storytold/craft-common-actions/.github/workflows/changed-paths.yml@main
|
||||
with:
|
||||
label: full-ci
|
||||
# The crates and files with `cfg(windows)` code or Windows-only behaviour, and what decides
|
||||
# how they build: their manifests, the lockfile and cargo's configuration (a dependency bump
|
||||
# can break only Windows).
|
||||
paths: |
|
||||
.github/workflows/ci-windows.yml
|
||||
apps/filmcraft/*
|
||||
crates/platform/*
|
||||
crates/media/*
|
||||
crates/engine/src/autosave*
|
||||
crates/engine/Cargo.toml
|
||||
crates/gpu/*
|
||||
crates/testkit/*
|
||||
crates/ui-egui/src/frames.rs
|
||||
crates/ui-egui/src/scrub.rs
|
||||
crates/ui-egui/src/hooks.rs
|
||||
crates/ui-egui/src/app/playback.rs
|
||||
crates/ui-egui/src/app/playback/*
|
||||
crates/ui-egui/src/app/prefs.rs
|
||||
crates/ui-egui/tests/it/scrub_*
|
||||
crates/ui-egui/Cargo.toml
|
||||
Cargo.toml
|
||||
Cargo.lock
|
||||
.cargo/*
|
||||
|
||||
gate-windows:
|
||||
needs: windows-scope
|
||||
if: needs.windows-scope.outputs.matched == 'true'
|
||||
# Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
|
||||
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
|
||||
with:
|
||||
os: '["windows-latest"]'
|
||||
# Same craft-fonts commit as ci.yml and release.yml.
|
||||
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
|
||||
timeout-minutes: 120
|
||||
# The tests run under nextest (the gate installs it), as in `cargo xtask ci` on Linux: each
|
||||
# test in a process of its own, with .config/nextest.toml's groups. Under `cargo test` the
|
||||
# tests of one binary share a process, rayon's global pool included, so one test's work
|
||||
# waits behind another's and the timing-bound UI tests fail now and then.
|
||||
windows-command: |
|
||||
pkgs=(-p filmcraft -p filmcraft-platform -p filmcraft-media -p filmcraft-engine -p filmcraft-gpu -p filmcraft-ui-egui)
|
||||
cargo clippy "${pkgs[@]}" --all-targets --locked --keep-going -- -D warnings
|
||||
cargo nextest run "${pkgs[@]}" --locked --lib --bins --tests --no-fail-fast
|
||||
@@ -142,7 +142,13 @@ fn timed_out_connection_releases_slot(partial: &[u8]) {
|
||||
let completion = finished.recv_timeout(Duration::from_secs(5));
|
||||
let mut unsolicited = String::new();
|
||||
if completion.is_ok() {
|
||||
client.read_to_string(&mut unsolicited).unwrap();
|
||||
// Windows can end the expired connection with a reset instead of a close. Either way no
|
||||
// reply came, and bytes read before a reset stay in `unsolicited` for the check below.
|
||||
match client.read_to_string(&mut unsolicited) {
|
||||
Ok(_) => {}
|
||||
Err(e) if matches!(e.kind(), std::io::ErrorKind::ConnectionReset | std::io::ErrorKind::ConnectionAborted) => {}
|
||||
Err(e) => panic!("reading after the server closed the connection failed: {e}"),
|
||||
}
|
||||
}
|
||||
// Always unblock and join the test worker before asserting, even on the unfixed server.
|
||||
let unexpected_command = rx.try_recv().is_ok();
|
||||
|
||||
@@ -123,9 +123,15 @@ pub fn private_temp_dir() -> std::io::Result<std::path::PathBuf> {
|
||||
*cached = Some((path.clone(), None));
|
||||
return Ok(path);
|
||||
}
|
||||
let mut dir = std::fs::DirBuilder::new();
|
||||
// Owner-only on Unix. Elsewhere there's no mode to set, and a `mut` would be unused.
|
||||
#[cfg(unix)]
|
||||
std::os::unix::fs::DirBuilderExt::mode(&mut dir, 0o700);
|
||||
let dir = {
|
||||
let mut dir = std::fs::DirBuilder::new();
|
||||
std::os::unix::fs::DirBuilderExt::mode(&mut dir, 0o700);
|
||||
dir
|
||||
};
|
||||
#[cfg(not(unix))]
|
||||
let dir = std::fs::DirBuilder::new();
|
||||
// `create` fails when the name exists, so a folder someone else made is never accepted
|
||||
match dir.create(&path) {
|
||||
Ok(()) => {
|
||||
|
||||
@@ -312,12 +312,17 @@ fn program_monitor_plays_on_while_a_value_is_dragged() {
|
||||
d.harness.state_mut().play(1.0);
|
||||
let mut frames = std::collections::BTreeSet::new();
|
||||
let mut newest = at_rest.revision;
|
||||
for i in 0..90 {
|
||||
// Drag until five frames have shown, for up to ~10 s: on a busy CI runner the workers can take
|
||||
// longer than a second and a half to finish frames. A picture held for the whole drag still fails.
|
||||
for i in 0..600 {
|
||||
// one change and one UI pass, as a mouse move while dragging the value
|
||||
d.exec("effects.setParam", json!({"clip": clip, "effect": "crop", "param": "left", "value": (i % 30) as f64}));
|
||||
let shown = d.harness.state().program_picture().unwrap();
|
||||
frames.insert(shown.frame);
|
||||
newest = newest.max(shown.revision);
|
||||
if frames.len() >= 5 && newest > at_rest.revision {
|
||||
break;
|
||||
}
|
||||
std::thread::sleep(std::time::Duration::from_millis(16));
|
||||
}
|
||||
assert!(frames.len() >= 5, "the picture kept playing during the drag: frames shown {frames:?}");
|
||||
|
||||
Reference in new issue
Block a user