#41 - Every pull request runs the app's checks, the Python comparison and the firmware build #44

Merged
eliott merged 3 commits from test/41-ci-workflows into main 2026-11-20 23:23:09 +01:00
Owner

Every pull request into main is now checked on Forgejo before it is merged. Nothing changes for someone using the scanner: this is about catching a broken build, a failing test or a detection that drifted from the Python before it reaches a release.

Closes #41

How it works

  • app.yml, when the app's code, page, icons or Cargo files change: cargo fmt --check, cargo clippy --all-targets -D warnings and cargo test on Linux, node --check ui/app.js (the page's script is never run by the tests), and Clippy for x86_64-pc-windows-gnu, so the cfg(windows) code (console, settings and scans folders, hidden folders, gphoto2 without a window) is compiled too. The GNU target builds on Linux with MinGW; the installer's MSVC target still needs Windows.
  • parity.yml, when src/detect.rs, src/centering.rs, src/image.rs, examples/parity.rs, reference/ or tools/parity.py change: runs tools/parity.py, which fails when the Rust and the Python stop agreeing.
  • firmware.yml, when firmware/ changes: arduino-cli compile --fqbn arduino:avr:uno with the Stepper and Servo libraries.
  • .forgejo/actions/rust is shared by the two Rust workflows: it installs the web view's libraries, Rust 1.100.0 (pinned, so a new Rust release and its new lints can't fail an unrelated pull request), and restores the cargo cache keyed on Cargo.lock.
  • The Rust jobs name their container (node:24-trixie) instead of relying on the runner's default image, because libwebkit2gtk-4.1-dev comes from Debian.
  • Downloads are pinned: actions by commit SHA, arduino-cli and uv by version and SHA-256, the AVR core and the libraries by version.
  • To make the new checks pass: cargo fmt on two files, four Clippy warnings fixed (an unused PREVIEW_SIDE removed, an index loop turned into array::from_fn, a needless ..Default::default()).
  • Two new tests in src/image.rs: the reduced-size JPEG decode picks 1/2, 1/4 or 1/8 so both sides stay long enough, and load_shot scales to the analysis width, keeps the levels and never widens a picture.

Tested

  • cargo test: 308 passed. cargo fmt --check and cargo clippy --all-targets -- -D warnings clean on Rust 1.99.1.
  • Every step of the three workflows run by hand in a node:24-trixie container with Rust 1.100.0: fmt, Clippy, 306 tests (before the two new ones), node --check, Windows Clippy, parity (SAME) and the firmware compile all passed.
  • pnpm build in site/ passes with the new CONTRIBUTING.md.

Not tested

  • The workflows themselves on the Forgejo runner: this pull request is their first run. Whether the runner accepts the container: image and has a cache server for actions/cache will show there; without a cache server the jobs still run, without the cache.
  • The Windows MSVC build and the installer (packaging/windows/build.ps1): still made by hand on Windows.
  • No hardware involved.
Every pull request into `main` is now checked on Forgejo before it is merged. Nothing changes for someone using the scanner: this is about catching a broken build, a failing test or a detection that drifted from the Python before it reaches a release. Closes #41 ## How it works - `app.yml`, when the app's code, page, icons or Cargo files change: `cargo fmt --check`, `cargo clippy --all-targets -D warnings` and `cargo test` on Linux, `node --check ui/app.js` (the page's script is never run by the tests), and Clippy for `x86_64-pc-windows-gnu`, so the `cfg(windows)` code (console, settings and scans folders, hidden folders, gphoto2 without a window) is compiled too. The GNU target builds on Linux with MinGW; the installer's MSVC target still needs Windows. - `parity.yml`, when `src/detect.rs`, `src/centering.rs`, `src/image.rs`, `examples/parity.rs`, `reference/` or `tools/parity.py` change: runs `tools/parity.py`, which fails when the Rust and the Python stop agreeing. - `firmware.yml`, when `firmware/` changes: `arduino-cli compile --fqbn arduino:avr:uno` with the Stepper and Servo libraries. - `.forgejo/actions/rust` is shared by the two Rust workflows: it installs the web view's libraries, Rust **1.100.0** (pinned, so a new Rust release and its new lints can't fail an unrelated pull request), and restores the cargo cache keyed on `Cargo.lock`. - The Rust jobs name their container (`node:24-trixie`) instead of relying on the runner's default image, because `libwebkit2gtk-4.1-dev` comes from Debian. - Downloads are pinned: actions by commit SHA, arduino-cli and uv by version and SHA-256, the AVR core and the libraries by version. - To make the new checks pass: `cargo fmt` on two files, four Clippy warnings fixed (an unused `PREVIEW_SIDE` removed, an index loop turned into `array::from_fn`, a needless `..Default::default()`). - Two new tests in `src/image.rs`: the reduced-size JPEG decode picks 1/2, 1/4 or 1/8 so both sides stay long enough, and `load_shot` scales to the analysis width, keeps the levels and never widens a picture. ## Tested - `cargo test`: 308 passed. `cargo fmt --check` and `cargo clippy --all-targets -- -D warnings` clean on Rust 1.99.1. - Every step of the three workflows run by hand in a `node:24-trixie` container with Rust 1.100.0: fmt, Clippy, 306 tests (before the two new ones), `node --check`, Windows Clippy, parity (`SAME`) and the firmware compile all passed. - `pnpm build` in `site/` passes with the new CONTRIBUTING.md. ## Not tested - The workflows themselves on the Forgejo runner: this pull request is their first run. Whether the runner accepts the `container:` image and has a cache server for `actions/cache` will show there; without a cache server the jobs still run, without the cache. - The Windows MSVC build and the installer (`packaging/windows/build.ps1`): still made by hand on Windows. - No hardware involved.
- cargo fmt on src/server.rs and src/session.rs.
- The levels of each channel are measured with array::from_fn instead of an index loop.
- PREVIEW_SIDE was unused since the preview shrinks with negative::levels_shrink: removed.
- An Options literal that set every field no longer spreads the defaults.
- jpeg_luma picks 1/2, 1/4 or 1/8 so that both sides stay at least as long as asked.
- load_shot scales to the analysis width, keeps the levels of the picture, and never widens it.
test: check the app, the Python parity and the firmware on every pull request into main
All checks were successful
app / linux (pull_request) Successful in 5m51s
app / windows (pull_request) Successful in 2m55s
firmware / compile (pull_request) Successful in 23s
parity / parity (pull_request) Successful in 7m9s
website / build (pull_request) Successful in 44s
113d57f9d5
- app.yml: cargo fmt, clippy -D warnings and cargo test on Linux, node --check on the page's script, and clippy for x86_64-pc-windows-gnu so the cfg(windows) code is compiled too.
- parity.yml: tools/parity.py when the detection, the image reading or the reference change.
- firmware.yml: arduino-cli compiles the sketch for the Uno when the firmware changes.
- .forgejo/actions/rust: the web view's libraries, Rust 1.100.0 pinned, and the cargo cache, shared by both Rust workflows.
- CONTRIBUTING.md says what the pull request checks run.

Closes #41
eliott merged commit 0383d94228 into main 2026-11-20 23:23:09 +01:00
eliott deleted branch test/41-ci-workflows 2026-11-20 23:23:09 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
RollNote/rollscan!44
No description provided.