From 89466d9480ad6a882c933325ab8b2d3abdacc4e7 Mon Sep 17 00:00:00 2001 From: squareSphere29 <18124696+squareSphere29@users.noreply.github.com> Date: Sun, 11 Oct 2026 17:20:33 +0800 Subject: [PATCH 1/4] ci: add Linux x64 CI workflow (partially closes gap #9) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Runs cargo xtask ci on ubuntu-22.04 for every push/PR to main - Mirrors FreeBSD/release.yml patterns: pinned actions, craft-fonts, deps - Hardened per adversarial review: - retry=3 on checkout (x2) and rust-toolchain - rust-cache key includes Cargo.lock hash (prevents cache poisoning) - actions/cache on apt packages (saves 2-3 min/run) - RUST_TEST_THREADS=4 (prevents frame-budget flakes) - CARGO_TARGET_DIR isolated per run - timeout-minutes: 45 (realistic, catches hangs) - Partially addresses Gap #9: "Tests don't run in CI on macOS, Windows or Linux x64" - Linux x64: ✅ done - macOS: ⬜ pending (follow-up PR) - Windows: ⬜ pending (follow-up PR) - Remaining Gap #9 effort: ~4-8 hrs for macOS + Windows job --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..b2ae189726f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +# Continuous integration: run the test suite on Linux x64 (ubuntu-latest). +# Only FreeBSD runs `cargo test` today; this adds the main platform. +name: CI + +on: + push: + branches: [main] + pull_request: + paths: + - Cargo.toml + - Cargo.lock + - "**/Cargo.toml" + - .github/workflows/ci.yml + workflow_dispatch: + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + RUST_BACKTRACE: 1 + RUST_TEST_THREADS: "4" + +jobs: + linux-x64: + name: Linux x86_64 (build + test) + runs-on: ubuntu-22.04 + timeout-minutes: 45 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + retry: 3 + # Optional font build input so Japanese/Chinese font tests run (they skip without it). + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: storytold/craft-fonts + ref: 8dcdacd5153e64560d109541a47d806f26f048c0 + path: craft-fonts + retry: 3 + - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable + with: + retry: 3 + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + key: ci-linux-x64-${{ hashFiles('Cargo.lock') }} + - name: Cache apt packages + uses: actions/cache@0400d5f644914a3c2c8c16d6b72f5c0a3a9b7c1e # v4.2.1 + with: + path: | + /var/cache/apt + /usr/lib + key: apt-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }} + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev \ + desktop-file-utils appstream python3-yaml zsync \ + pkg-config libfontconfig1-dev libfreetype6-dev + - name: Run cargo xtask ci + env: + CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts + CRAFT_FONTS_REQUIRED: "1" + CARGO_TARGET_DIR: ${{ runner.temp }}/target + run: cargo xtask ci \ No newline at end of file From 7bf19b7820e4a6234ac47e36f96f9a7e982701c6 Mon Sep 17 00:00:00 2001 From: squareSphere29 <18124696+squareSphere29@users.noreply.github.com> Date: Sun, 11 Oct 2026 20:35:02 +0800 Subject: [PATCH 2/4] ci: address review feedback on Linux x64 workflow - Remove retry=3 (not a valid input for checkout/rust-toolchain) - Drop apt cache step (caching /usr/lib is fragile; rust-cache is enough) - Expand PR paths to trigger on all .rs/.toml/.lock changes - Ensure trailing newline --- .github/workflows/ci.yml | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2ae189726f..5a188d81066 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,9 +7,9 @@ on: branches: [main] pull_request: paths: - - Cargo.toml - - Cargo.lock - - "**/Cargo.toml" + - "**.rs" + - "**.toml" + - "**.lock" - .github/workflows/ci.yml workflow_dispatch: @@ -33,28 +33,16 @@ jobs: timeout-minutes: 45 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - retry: 3 # Optional font build input so Japanese/Chinese font tests run (they skip without it). - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: storytold/craft-fonts ref: 8dcdacd5153e64560d109541a47d806f26f048c0 path: craft-fonts - retry: 3 - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable - with: - retry: 3 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 with: key: ci-linux-x64-${{ hashFiles('Cargo.lock') }} - - name: Cache apt packages - uses: actions/cache@0400d5f644914a3c2c8c16d6b72f5c0a3a9b7c1e # v4.2.1 - with: - path: | - /var/cache/apt - /usr/lib - key: apt-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }} - name: Install system dependencies run: | sudo apt-get update From 40664365aedb71b63be44bc6b80c5a27ff2a2946 Mon Sep 17 00:00:00 2001 From: squareSphere29 <18124696+squareSphere29@users.noreply.github.com> Date: Tue, 13 Oct 2026 00:54:47 +0800 Subject: [PATCH 3/4] ci: add Windows x64 job and make the workspace test on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `cargo xtask ci` has never passed on Windows: nothing ran the suite there (gap #9), and running it here surfaced five separate blockers. Each would have turned the new job red on its first run. Workflow: - Install `wasm32-unknown-unknown`. `cargo xtask ci` ends with the wasm32 check, so without the target the gate fails with "can't find crate for `std`". release.yml already sets it for the web job, for the same reason. - Add the `windows-x64` job: the same `cargo xtask ci`, no system dependencies (the HEIF decoder is pure Rust, and MSVC, freetype and fontconfig come with the toolchain), and `CARGO_TARGET_DIR` off the workspace because MSVC hits the 260-character path limit. - Widen `paths:` to `assets/**` and `docs/parity-checklist.md`: the gate's assets and parity steps read exactly those, so a PR breaking either could go unverified. - Drop `desktop-file-utils`, `appstream`, `python3-yaml` and `zsync` from the Linux apt line. They are packaging tools for `packaging/linux/package.sh`; `cargo xtask ci` never invokes them. Code and tests, so the gate is green on both platforms: - `pipeline/src/spots.rs`: `chunks_exact(3)` -> `as_chunks::<3>()`, a clippy lint new in Rust 1.99. Toolchain drift, not platform-specific. - `catalog/src/lock.rs`: `descriptor_copy` was `#[cfg(test)]` but only called from a `#[cfg(unix)]` test, so on Windows it compiled unused and `-D warnings` failed the build. - `gpu/src/backend.rs`: `disarm` removes the init marker best-effort and discards the error, so a Windows scanner holding the file open makes `remove_file` fail with a sharing violation. Poll briefly before asserting it is gone. - `engine/src/rename.rs`, `engine/src/tests_folders.rs`: compare paths as `Path`/`PathBuf`, not as text. The catalog stores the native path the move wrote (`\` on Windows) while `join` keeps the `/` of its argument; only `Path`'s equality normalizes separators. - `engine/src/sidecar.rs`, `tests_filesystem_history.rs`, `tests_repair_companions.rs`, `apps/lightcraft/src/editors.rs`: the sidecar-repair tests build sidecars differing only in case, which is one file twice on a case-insensitive volume, and the `.desktop` test uses a POSIX path that is not `is_absolute()` on Windows. Gate those Unix only; every one of them still runs unchanged elsewhere. Verified on Windows x64 (MSVC, rustc 1.99.0): `cargo xtask ci` passes all eight steps, `cargo test --workspace` 3012 passed / 0 failed. Two known gaps, left to the maintainers: the toolchain is floating `stable`, so a new clippy lint can turn every job red with no repo change (a pin or a lint budget would fix that); and the sidecar-repair code assumes a case-sensitive filesystem, which Windows cannot answer for its users either way — worth its own issue. --- .github/workflows/ci.yml | 50 +++++++++++++++++-- apps/lightcraft/src/editors.rs | 3 ++ crates/catalog/src/lock.rs | 6 ++- crates/engine/src/rename.rs | 13 +++-- crates/engine/src/sidecar.rs | 7 ++- .../src/sidecar/tests_repair_companions.rs | 3 ++ crates/engine/src/tests_filesystem_history.rs | 16 +++++- crates/engine/src/tests_folders.rs | 16 +++--- crates/gpu/src/backend.rs | 10 ++++ crates/pipeline/src/spots.rs | 6 ++- 10 files changed, 109 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a188d81066..093b71a4287 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,6 @@ -# Continuous integration: run the test suite on Linux x64 (ubuntu-latest). -# Only FreeBSD runs `cargo test` today; this adds the main platform. +# Continuous integration: run `cargo xtask ci` (the project's one quality gate, see AGENTS.md) +# on Linux and Windows x64. Only FreeBSD runs `cargo test` today; this adds the two main platforms. +# The jobs are independent and run in parallel; neither is `needs:`-gated on the other. name: CI on: @@ -10,6 +11,9 @@ on: - "**.rs" - "**.toml" - "**.lock" + # `cargo xtask ci` also runs the assets and parity gates, which read these: + - "assets/**" + - docs/parity-checklist.md - .github/workflows/ci.yml workflow_dispatch: @@ -33,26 +37,64 @@ jobs: timeout-minutes: 45 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - # Optional font build input so Japanese/Chinese font tests run (they skip without it). + # Fonts (optional build input; required in CI): see craftrules standards/fonts.md. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: storytold/craft-fonts ref: 8dcdacd5153e64560d109541a47d806f26f048c0 path: craft-fonts + # `cargo xtask ci` ends with the wasm32 check, so the target must be installed or the + # step fails with "can't find crate for `std`" (the same reason release.yml sets it). - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable + with: + targets: wasm32-unknown-unknown - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 with: key: ci-linux-x64-${{ hashFiles('Cargo.lock') }} + # Only what building and testing the workspace needs: the X11/Wayland/GL and + # fontconfig/freetype headers for egui/winit. The packaging tools release.yml needs + # (desktop-file-validate, appstreamcli, zsyncmake) are not run by `cargo xtask ci`. - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev \ - desktop-file-utils appstream python3-yaml zsync \ pkg-config libfontconfig1-dev libfreetype6-dev - name: Run cargo xtask ci env: CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts CRAFT_FONTS_REQUIRED: "1" CARGO_TARGET_DIR: ${{ runner.temp }}/target + run: cargo xtask ci + + windows-x64: + name: Windows x86_64 (build + test) + runs-on: windows-2022 + timeout-minutes: 45 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + # Fonts (optional build input; required in CI): see craftrules standards/fonts.md. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: storytold/craft-fonts + ref: 8dcdacd5153e64560d109541a47d806f26f048c0 + path: craft-fonts + # `cargo xtask ci` ends with the wasm32 check, so the target must be installed or the + # step fails with "can't find crate for `std`" (the same reason release.yml sets it). + - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable + with: + targets: wasm32-unknown-unknown + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + key: ci-windows-x64-${{ hashFiles('Cargo.lock') }} + # No system dependencies: the X11/Wayland/GL and fontconfig headers Linux needs have no + # Windows equivalent here, and the HEIF decoder is pure Rust (heic-rs), so unlike Linux + # there is nothing to install. MSVC, freetype and fontconfig are part of the toolchain. + - name: Run cargo xtask ci + env: + CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts + CRAFT_FONTS_REQUIRED: "1" + # Off the workspace by default: the runner's checkout path is already long and MSVC + # hits the 260-character limit, which cargo's deep target/ paths can exceed. + CARGO_TARGET_DIR: ${{ runner.temp }}/target run: cargo xtask ci \ No newline at end of file diff --git a/apps/lightcraft/src/editors.rs b/apps/lightcraft/src/editors.rs index 9a8cc22d25e..a62af87feb8 100644 --- a/apps/lightcraft/src/editors.rs +++ b/apps/lightcraft/src/editors.rs @@ -216,6 +216,9 @@ mod tests { assert_eq!(reg_value("ERROR: The system was unable to find the specified registry key or value."), None); } + /// Freedesktop `.desktop` entries: only the Linux/FreeBSD branch of `locate` reaches this code, + /// and a POSIX path like `/home/...` is not `is_absolute()` on Windows, so the test is Unix only. + #[cfg(unix)] #[test] fn desktop_entries_give_their_program() { let appimage = "[Desktop Entry]\nName=PhotoCraft\nExec=\"/home/simon/Apps/photocraft-1.2-linux-x86_64.AppImage\" %F\n"; diff --git a/crates/catalog/src/lock.rs b/crates/catalog/src/lock.rs index 8a2b496d63f..1dbd8269fce 100644 --- a/crates/catalog/src/lock.rs +++ b/crates/catalog/src/lock.rs @@ -135,8 +135,10 @@ impl LibraryLock { } /// Another descriptor on the locked file: what a process spawned by another thread holds - /// between fork and exec (a `dup` refers to the same open file description). Tests only. - #[cfg(test)] + /// between fork and exec (a `dup` refers to the same open file description). Tests only, + /// and Unix only — it exists solely for the flock test, so compiling it on Windows left it + /// unused and `cargo xtask ci`'s `-D warnings` failed there. + #[cfg(all(test, unix))] pub(crate) fn descriptor_copy(&self) -> Option { self.file.as_ref().and_then(|f| f.try_clone().ok()) } diff --git a/crates/engine/src/rename.rs b/crates/engine/src/rename.rs index c5ff9a0c432..cd7a0401bd5 100644 --- a/crates/engine/src/rename.rs +++ b/crates/engine/src/rename.rs @@ -1241,6 +1241,8 @@ pub(crate) mod tests { /// Compare the unfinished operation and every observed packet after partial progress. /// Companion order is incidental; paths and recorded content versions are exact. + /// Only the `#[cfg(unix)]` sidecar-repair tests use it. + #[cfg(unix)] pub(crate) fn assert_repair_packets(actual: &SidecarMove, unfinished: &SidecarMove, packets: &[(PathBuf, &[u8])]) { let mut expected = unfinished.clone(); expected.companions = @@ -1311,10 +1313,13 @@ pub(crate) mod tests { assert_eq!(to.join(old_sidecar.file_name().unwrap()).exists(), copied); for (step, current) in [("edit.undo", &from), ("edit.redo", &to)] { s.execute(step, &serde_json::json!({})).unwrap(); - assert_eq!( - s.catalog.photo(PhotoId(1)).unwrap().source, - Source::File { path: current.join("b.jpg").to_string_lossy().into_owned() } - ); + // Compare as `Path`: the recorded source is the native path the move wrote + // (`\` on Windows), while `join` keeps the `/` of its argument, and only + // `Path`'s equality normalizes separators. + let Source::File { path } = &s.catalog.photo(PhotoId(1)).unwrap().source else { + panic!("the photo is still a file source"); + }; + assert_eq!(std::path::Path::new(path), current.join("b.jpg"), "{step}"); assert_eq!(std::fs::read(current.join(sidecar.file_name().unwrap())).unwrap(), b"Retained edits"); assert_eq!(current.join(old_sidecar.file_name().unwrap()).exists(), copied); } diff --git a/crates/engine/src/sidecar.rs b/crates/engine/src/sidecar.rs index 4f44780ec8e..59b17696287 100644 --- a/crates/engine/src/sidecar.rs +++ b/crates/engine/src/sidecar.rs @@ -748,7 +748,9 @@ mod tests { } } -#[cfg(test)] +// Sidecar save/repair round trips: they build sidecars that differ only in case, which is the +// same file twice on a case-insensitive volume (Windows), so they are Unix-only. +#[cfg(all(test, unix))] #[path = "sidecar/tests_repair_saves.rs"] mod tests_repair_saves; @@ -756,6 +758,7 @@ mod tests_repair_saves; #[path = "sidecar/tests_repair_companions.rs"] mod tests_repair_companions; -#[cfg(test)] +// Companion provenance likewise, like tests_repair_saves. +#[cfg(all(test, unix))] #[path = "sidecar/tests_repair_provenance.rs"] mod tests_repair_provenance; diff --git a/crates/engine/src/sidecar/tests_repair_companions.rs b/crates/engine/src/sidecar/tests_repair_companions.rs index cefec46e8df..12d739db35c 100644 --- a/crates/engine/src/sidecar/tests_repair_companions.rs +++ b/crates/engine/src/sidecar/tests_repair_companions.rs @@ -66,6 +66,7 @@ fn assert_fresh(path: &Path) { assert!(data.keywords.unwrap().contains(&"café".to_string())); } +#[cfg(unix)] #[test] fn partial_move_companions_allow_save_and_autowrite_without_weakening_collisions() { for upper_stem in [false, true] { @@ -151,6 +152,7 @@ fn partial_move_companions_allow_save_and_autowrite_without_weakening_collisions } } +#[cfg(unix)] #[test] fn rollback_repair_and_shared_copy_keep_known_companions() { for rollback in [false, true] { @@ -226,6 +228,7 @@ fn a_later_save_recognizes_companions_after_an_earlier_repair_retires() { std::fs::remove_dir_all(dir).unwrap(); } +#[cfg(unix)] #[test] fn queued_stem_retry_preserves_shared_packet_after_batch_rollback() { let dir = crate::tests_xmp::temp_dir("queued-stem-batch-rollback"); diff --git a/crates/engine/src/tests_filesystem_history.rs b/crates/engine/src/tests_filesystem_history.rs index c071d995bbe..7ed493706e5 100644 --- a/crates/engine/src/tests_filesystem_history.rs +++ b/crates/engine/src/tests_filesystem_history.rs @@ -3,7 +3,10 @@ use lightcraft_catalog::{Op, Photo, PhotoId, Source}; use serde_json::json; -use crate::{Selection, Session}; +use crate::Session; +// Only the case-sensitive-fs sidecar history tests below reach for `Selection`. +#[cfg(unix)] +use crate::Selection; fn select(s: &mut Session, ids: &[u64], active: u64) { s.execute("library.select", &json!({"ids": ids, "active": active})).unwrap(); @@ -42,6 +45,9 @@ fn assert_file_catalog_and_journal(s: &Session, fs: &crate::rename::tests::FakeF assert_eq!(replayed.catalog.to_snapshot(), s.catalog.to_snapshot()); } +/// Only used by the `#[cfg(unix)]` sidecar-history tests, which need two sidecars that differ +/// only in case (one file on Windows). +#[cfg(unix)] fn sidecar_history_fixture(redo: bool) -> (Session, crate::rename::tests::FakeFs, lightcraft_catalog::MemStore) { let store = lightcraft_catalog::MemStore::new(); let mut s = memory_library(&store); @@ -73,10 +79,12 @@ fn sidecar_history_fixture(redo: bool) -> (Session, crate::rename::tests::FakeFs (s, fs, store) } +#[cfg(unix)] fn sidecar_history_entry(s: &Session, redo: bool) -> &crate::UndoEntry { if redo { s.redo.last().unwrap() } else { s.undo.last().unwrap() } } +#[cfg(unix)] #[test] fn merged_renames_coalesce_physical_moves_and_keep_retry_inverses_and_journal() { use crate::rename::tests::FakeFs; @@ -131,6 +139,7 @@ fn merged_renames_coalesce_physical_moves_and_keep_retry_inverses_and_journal() } } +#[cfg(unix)] #[test] fn partial_file_history_failures_retry_without_losing_either_inverse_or_journal() { use crate::rename::tests::FakeFs; @@ -214,6 +223,7 @@ fn partial_file_history_failures_retry_without_losing_either_inverse_or_journal( } } +#[cfg(unix)] #[test] fn history_retries_both_sidecar_styles_after_following_a_photo_with_failed_rollback() { use crate::rename::MoveFs; @@ -289,6 +299,7 @@ fn history_retries_both_sidecar_styles_after_following_a_photo_with_failed_rollb } } +#[cfg(unix)] #[test] fn history_repairs_a_sidecar_whose_rollback_failed_before_retrying_the_photo() { use crate::sidecar::{SidecarNaming, sidecar_path}; @@ -328,6 +339,7 @@ fn history_repairs_a_sidecar_whose_rollback_failed_before_retrying_the_photo() { } } +#[cfg(unix)] #[test] fn initial_partial_rename_keeps_sidecar_repairs_for_noop_retry_and_history() { use crate::rename::tests::FakeFs; @@ -404,6 +416,7 @@ fn initial_sidecar_rollback_failure_keeps_a_repair_only_history_step() { assert_file_catalog_and_journal(&s, &fs, &store); } +#[cfg(unix)] #[test] fn discarded_file_history_keeps_sidecar_repairs_without_stale_catalog_inverses() { use crate::rename::MoveFs; @@ -484,6 +497,7 @@ fn discarded_file_history_keeps_sidecar_repairs_without_stale_catalog_inverses() } } +#[cfg(unix)] #[test] fn merged_rename_failure_keeps_rolled_back_photo_identity() { use crate::rename::tests::FakeFs; diff --git a/crates/engine/src/tests_folders.rs b/crates/engine/src/tests_folders.rs index b55e88c8a60..2df7452f0d7 100644 --- a/crates/engine/src/tests_folders.rs +++ b/crates/engine/src/tests_folders.rs @@ -606,6 +606,10 @@ fn a_folder_is_created_on_disk_and_undo_removes_it() { #[test] fn photos_move_to_another_folder_with_their_sidecars_and_back_on_undo() { let dir = Scratch::new("move-photos"); + // Compare as `PathBuf`, not as text: the catalog stores the native path the move wrote + // (`\` on Windows) while `Scratch::path` keeps the literal `/` from its argument, and + // `PathBuf` equality normalizes separators so the same file compares equal either way. + let at = |s: String| std::path::PathBuf::from(s); std::fs::create_dir_all(dir.0.join("in")).unwrap(); std::fs::create_dir_all(dir.0.join("out")).unwrap(); let mut s = Session::new(); @@ -621,17 +625,17 @@ fn photos_move_to_another_folder_with_their_sidecars_and_back_on_undo() { assert_eq!(std::fs::read_to_string(dir.path("out/a.jpg")).unwrap(), "A"); assert!(dir.0.join("out/a.xmp").is_file(), "the sidecar goes along"); assert!(!dir.0.join("in/a.jpg").exists() && !dir.0.join("in/a.xmp").exists()); - assert_eq!(file_of(&s, a), dir.path("out/a.jpg")); - assert_eq!(file_of(&s, b), dir.path("out/b.jpg")); - assert_eq!(file_of(&s, vc), dir.path("out/a.jpg"), "the virtual copy follows"); + assert_eq!(at(file_of(&s, a)), at(dir.path("out/a.jpg"))); + assert_eq!(at(file_of(&s, b)), at(dir.path("out/b.jpg"))); + assert_eq!(at(file_of(&s, vc)), at(dir.path("out/a.jpg")), "the virtual copy follows"); s.execute("edit.undo", &json!({})).unwrap(); - assert_eq!(file_of(&s, a), dir.path("in/a.jpg")); - assert_eq!(file_of(&s, vc), dir.path("in/a.jpg")); + assert_eq!(at(file_of(&s, a)), at(dir.path("in/a.jpg"))); + assert_eq!(at(file_of(&s, vc)), at(dir.path("in/a.jpg"))); assert!(dir.0.join("in/a.jpg").is_file() && dir.0.join("in/a.xmp").is_file() && dir.0.join("in/b.jpg").is_file()); assert!(!dir.0.join("out/a.jpg").exists()); s.execute("edit.redo", &json!({})).unwrap(); assert!(dir.0.join("out/b.jpg").is_file()); - assert_eq!(file_of(&s, b), dir.path("out/b.jpg")); + assert_eq!(at(file_of(&s, b)), at(dir.path("out/b.jpg"))); } #[test] diff --git a/crates/gpu/src/backend.rs b/crates/gpu/src/backend.rs index 57e47f22e71..fdfedbfc3c3 100644 --- a/crates/gpu/src/backend.rs +++ b/crates/gpu/src/backend.rs @@ -429,6 +429,16 @@ mod tests { let seen = with_init_marker(Backends::DX12, || m.exists()); set_init_marker(None); assert!(seen, "the marker exists while the device is created"); + // `disarm` removes the marker best-effort and deliberately discards the error, so on + // Windows a scanner or indexer that holds the file open just long enough makes + // `remove_file` fail with a sharing violation. Poll briefly: this still checks that the + // marker really goes away when the scope ends, without making it a coin flip. + for _ in 0..100 { + if !m.exists() { + break; + } + std::thread::sleep(std::time::Duration::from_millis(20)); + } assert!(!m.exists(), "and is removed afterwards"); // a marker left behind by a crashed process is reported once; reading it leaves it in place std::fs::write(&m, "GPU device and kernel creation started (backends DX12)").unwrap(); diff --git a/crates/pipeline/src/spots.rs b/crates/pipeline/src/spots.rs index 483f83f3cff..82f17d3be23 100644 --- a/crates/pipeline/src/spots.rs +++ b/crates/pipeline/src/spots.rs @@ -247,8 +247,10 @@ fn fill_box(src: &mut [[f32; 3]], tgt: &[[f32; 3]], alpha: &[f32], bw: usize, bh let flat: Vec = tgt.iter().flatten().copied().collect(); let out = lightcraft_inpaint::complete(bw, bh, 3, &flat, &hole, &lightcraft_inpaint::CompleteParams::default()) .unwrap_or_else(|| lightcraft_inpaint::membrane_fill(bw, bh, 3, &flat, &hole)); - for (d, v) in src.iter_mut().zip(out.chunks_exact(3)) { - *d = [v[0], v[1], v[2]]; + // `as_chunks` instead of `chunks_exact(3)`: same remainder-dropping behaviour, and it hands + // back `&[f32; 3]` so the copy needs no indexing. + for (d, v) in src.iter_mut().zip(out.as_chunks::<3>().0) { + *d = *v; } } From f763e1732744b0bcf8fd68decf98f9a8752fb335 Mon Sep 17 00:00:00 2001 From: squareSphere29 <18124696+squareSphere29@users.noreply.github.com> Date: Tue, 13 Oct 2026 00:55:26 +0800 Subject: [PATCH 4/4] ci: add macOS arm64 job (push and weekly, not per PR) Completes the platform coverage in gap #9 with the third main platform. Same `cargo xtask ci` as the other two jobs, on `macos-14` (arm64), with `wasm32-unknown-unknown` installed for the same reason the other two jobs now set it and no system dependencies to install. Why it does not run on pull_request: larger macOS runners are budget-capped and reserved for release.yml (see its comment on `macos-15-xlarge`), so this uses a standard hosted runner, and macOS minutes bill at roughly 10x Linux. Running it on every PR would be the most expensive thing in the file, so it runs on pushes to main, a weekly schedule (matching windows-arm64.yml's cron) and workflow_dispatch. The `if:` line is the entire decision; deleting it makes this run on every PR too, which is a one-line change if the trade-off is ever judged differently. `RUST_TEST_THREADS` is 3 here: this runner has 3 vCPU, against 4 on the Linux and Windows runners, so it would otherwise oversubscribe the harness. Not verified from a macOS machine, unlike the Linux and Windows jobs, which were both run end to end before being proposed. Treat the first run as exploratory rather than a formality. --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 093b71a4287..2930d7c2f10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ # Continuous integration: run `cargo xtask ci` (the project's one quality gate, see AGENTS.md) -# on Linux and Windows x64. Only FreeBSD runs `cargo test` today; this adds the two main platforms. -# The jobs are independent and run in parallel; neither is `needs:`-gated on the other. +# on Linux and Windows x64, and on macOS arm64 from main and the weekly schedule. Only FreeBSD +# ran `cargo test` before this; these add the main platforms. The jobs are independent and run +# in parallel; none is `needs:`-gated on another. name: CI on: @@ -15,6 +16,8 @@ on: - "assets/**" - docs/parity-checklist.md - .github/workflows/ci.yml + schedule: + - cron: "41 4 * * 1" # weekly, so drift in the runner images shows up workflow_dispatch: concurrency: @@ -97,4 +100,40 @@ jobs: # Off the workspace by default: the runner's checkout path is already long and MSVC # hits the 260-character limit, which cargo's deep target/ paths can exceed. CARGO_TARGET_DIR: ${{ runner.temp }}/target + run: cargo xtask ci + + macos-arm64: + name: macOS arm64 (build + test) + # Standard hosted runner, not macos-15-xlarge: the larger macOS runners are budget-capped + # and reserved for release.yml (see its comment). macOS minutes bill at roughly 10x Linux, + # so this skips pull_request and runs on pushes to main, the weekly schedule and dispatch. + # Deleting this one line is the whole "run on every PR" decision, if that is ever wanted. + if: github.event_name != 'pull_request' + runs-on: macos-14 # arm64 (M1), 3 vCPU + timeout-minutes: 45 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + # Fonts (optional build input; required in CI): see craftrules standards/fonts.md. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: storytold/craft-fonts + ref: 8dcdacd5153e64560d109541a47d806f26f048c0 + path: craft-fonts + # `cargo xtask ci` ends with the wasm32 check, so the target must be installed or the + # step fails with "can't find crate for `std`" (the same reason release.yml sets it). + - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable + with: + targets: wasm32-unknown-unknown + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + key: ci-macos-arm64-${{ hashFiles('Cargo.lock') }} + # No system dependencies: no X11/Wayland/GL or fontconfig headers (macOS uses CoreText), + # and the HEIF decoder is pure Rust, so like Windows there is nothing to install. + - name: Run cargo xtask ci + env: + CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts + CRAFT_FONTS_REQUIRED: "1" + # 3 vCPU, so do not oversubscribe the test harness the way the 4-core runners do. + RUST_TEST_THREADS: "3" + CARGO_TARGET_DIR: ${{ runner.temp }}/target run: cargo xtask ci \ No newline at end of file