Skip to content

build: validate PRs and mirror release matrix in CI#12

Merged
nedseb merged 2 commits into
mainfrom
ci/improve-validation
Apr 28, 2026
Merged

build: validate PRs and mirror release matrix in CI#12
nedseb merged 2 commits into
mainfrom
ci/improve-validation

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Apr 28, 2026

Summary

The current CI only triggers on push-to-main/manual dispatch, builds a single ubuntu-latest image, and runs no lints. This PR addresses each:

  • Validate PRs before merge. Add a pull_request trigger so changes get a green CI check before being merged into main, instead of after.
  • Match the release matrix. Switch the build job from ubuntu-latest to a matrix of ubuntu-22.04 + ubuntu-24.04, the same OSes release.yaml targets. Avoids the kind of version-specific surprise (e.g. missing libudev-dev, glibc differences) that PR feat: wireless stack flashing for STM32WB5xxG #5 hit.
  • Surface lint signal. Add a separate lint job running cargo fmt --check and cargo clippy --release --locked --all-targets.

The lint job is informational (continue-on-error: true) for now: there are currently 41 clippy warnings and several files are not fmt-clean, so making it blocking would force a big cleanup commit. The signal still shows up in the Checks tab so we can address it in a follow-up PR and flip the flag to blocking once it's clean.

Test plan

  • CI runs on this very PR (sanity check that the new pull_request trigger fires).
  • Both matrix jobs Build (ubuntu-22.04) and Build (ubuntu-24.04) complete with cargo build --release --locked.
  • Lint (informational) job runs and exits green even with non-zero clippy/fmt counts.
  • After merge, push-to-main still triggers the same set (existing behavior preserved).

Follow-ups (not in this PR)

  • Cleanup commit running cargo fmt --all once.
  • Cleanup PR to address the 41 clippy warnings, then drop continue-on-error: true so lint becomes blocking.

Three issues with the previous CI:

- Triggered only on push-to-main and workflow_dispatch, so PRs were
  never validated before merge — code only got verified after it had
  already landed. PR #5 was effectively merged unchecked.

- Built on ubuntu-latest (currently ubuntu-24.04) while releases
  target both ubuntu-22.04 and ubuntu-24.04. A version-specific
  glibc/libudev issue could break the release without warning.

- No clippy or rustfmt at all, so style and obvious bugs went
  uncaught.

Add `pull_request` trigger, build matrix on the same OSes the release
matrix uses, and a separate lint job running clippy + fmt. The lint
job is `continue-on-error: true` for now because the codebase has 41
clippy warnings and isn't currently fmt-clean — making them blocking
would force a large cleanup PR. They'll show up in the checks tab so
maintainers see the trend, and a follow-up PR can flip them to
blocking once the warnings are addressed.
Copilot AI review requested due to automatic review settings April 28, 2026 10:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CI to validate pull requests and align CI build targets with the release workflow’s Linux OS matrix, while adding non-blocking lint signal.

Changes:

  • Add pull_request trigger to run CI checks pre-merge.
  • Replace single ubuntu-latest build with a matrix build on ubuntu-22.04 and ubuntu-24.04.
  • Add an informational lint job running cargo fmt --check and cargo clippy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yaml
Comment on lines +38 to +40
- name: Install packages
run: sudo apt install libatk1.0-dev pkg-config libgtk-3-dev libudev-dev

Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This apt install step may block on an interactive confirmation prompt and can fail on runners without an updated package index. In CI it's more reliable to run an update first and install with -y (and usually prefer apt-get for scripting). Consider applying the same pattern to the build job as well.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0384285 — both jobs now run apt-get update followed by apt-get install -y … so they refresh the index and never block on a prompt.

Comment thread .github/workflows/ci.yaml Outdated
@@ -19,5 +26,28 @@ jobs:
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After installing Rust via rustup, the workflow doesn't add $HOME/.cargo/bin to PATH, so subsequent steps may end up using whatever cargo is preinstalled on the runner (or fail if none is present). Export the rustup-installed toolchain location (e.g., via GITHUB_PATH) so cargo build reliably uses the intended toolchain.

Suggested change
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0384285 — moot now: switching to dtolnay/rust-toolchain@stable handles GITHUB_PATH for us, so the build job actually uses the toolchain we set up instead of whatever the runner had pre-installed.

Comment thread .github/workflows/ci.yaml
Comment on lines 26 to 28
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Piping a remote script into sh (curl ... | sh) makes the CI environment dependent on an unpinned external script at runtime. For better supply-chain security and reproducibility, consider using a dedicated action to install Rust (or pin the toolchain via a checked-in rust-toolchain.toml and a setup action).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0384285 — both jobs now use dtolnay/rust-toolchain@stable instead of piping sh.rustup.rs into sh. No more unpinned external script at runtime.

Three issues flagged on PR #12:

- apt installs lacked `-y` and didn't refresh the index, so they could
  block on a prompt or hit a stale cache. Switched to
  `apt-get update` + `apt-get install -y` for both jobs.

- The build job ran `curl ... | sh -s -- -y` to install Rust but never
  exported `$HOME/.cargo/bin` to `GITHUB_PATH`. Subsequent steps were
  silently using whatever cargo the runner had pre-installed instead
  of the freshly installed toolchain — coincidentally fine, but wrong.

- Piping a remote script into sh ties CI to an unpinned external
  endpoint at every run. Both jobs now use `dtolnay/rust-toolchain@stable`,
  the de-facto standard action used by the Rust project itself.

Net effect: CI is shorter, reproducible, and consistent across both
build and lint jobs.
@nedseb nedseb merged commit d787a58 into main Apr 28, 2026
3 checks passed
@nedseb nedseb deleted the ci/improve-validation branch April 28, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants