Skip to content

Actions: Surgical CI - Only run PRs upon actual change - #11151

Draft
vidplace7 wants to merge 14 commits into
developfrom
feature/surgical-ci
Draft

Actions: Surgical CI - Only run PRs upon actual change#11151
vidplace7 wants to merge 14 commits into
developfrom
feature/surgical-ci

Conversation

@vidplace7

@vidplace7 vidplace7 commented Jul 22, 2026

Copy link
Copy Markdown
Member

This pull request introduces several improvements to the CI workflow and makes minor configuration changes to two board variants. The main workflow now dynamically narrows the build and check matrices to only the files affected by a pull request, improving efficiency. It also adds a stable "ci-gate" job for branch protection, ensuring that all relevant builds and checks pass before merging. Additionally, two board variants are reclassified from "community" to "extra".

CI Workflow Improvements:

  • The build matrix in .github/workflows/main_matrix.yml now uses tj-actions/changed-files to detect changed files and narrows the build and static analysis jobs to only the affected variants on pull requests, reducing unnecessary builds.
  • Introduced a stable ci-gate job that aggregates the results of all build and check jobs, providing a single status check for branch protection. This ensures merges only happen when all relevant jobs succeed.
  • The gather-artifacts job is now skipped on pull requests, as narrowed builds may not produce all expected artifacts, and this job is only needed for release and nightly workflows.
  • Updated documentation in the manifest download step to clarify handling of missing or narrowed-out environments in size reporting.

Board Variant Configuration:

  • Changed board_level from community to extra in variants/rp2350/diy/pico2_w5500_e22/platformio.ini and variants/rp2350/diy/wiznet_5500_evb_pico2_e22p/platformio.ini, reclassifying these variants. [1] [2]

@vidplace7 vidplace7 added the github_actions Pull requests that update GitHub Actions code label Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 36d5b98f-41b3-413d-899f-a8bdb9125d51

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/surgical-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@ayysasha

Copy link
Copy Markdown

Really like the surgical-CI direction. I took a pass at making the arch/source mapping lean on PlatformIO instead of the hardcoded tables, since that was the part most likely to rot as boards get added -- companion PR against your branch here: #11161.

It derives the platform -> arch map from build_src_filter (drops ESP32_FAMILY / PLATFORM_SRC_TOPDIRS), reads extra_configs for the ini globs, and makes _emittable fail closed now that community is gone. Matrix output is identical to your head across every scenario I tested (full / PR / check / all changed-file cases); 28/28 unit tests pass. Happy to fold it in or split it however you prefer.

@vidplace7
vidplace7 force-pushed the feature/surgical-ci branch 2 times, most recently from 6ec3b78 to cf1c6bd Compare July 24, 2026 13:20
vidplace7 and others added 7 commits July 24, 2026 17:33
That's not a thing!
Builds on the surgical-CI change so the change-detection is self-maintaining
when a board or arch is added:

- Derive platform/<subdir> -> arch top-dirs from each env's build_src_filter
  (+<platform/X> re-includes). The ESP32 family self-groups, so ESP32_FAMILY
  and PLATFORM_SRC_TOPDIRS are dropped entirely. Also fixes src/platform/
  extra_variants/, which was unmapped and fell back to a full build.
- Read [platformio] extra_configs for the env-definition ini globs instead of
  a hardcoded 2-glob tuple (anti-rot; no behavior change on the current tree).
- Make _emittable an allowlist (None/pr/extra) so a retired or typo'd
  board_level fails closed rather than silently building.
- Workflow: the generator now no-ops on an absent/empty --changed-files, so
  drop the EXTRA / [[ -s ]] bash plumbing and pass it unconditionally.

Verified against real PlatformIO: full, PR, and check matrices plus every
changed-file scenario produce identical output to the PR head. 28/28 unit
tests pass.
Follow-up to the derive-from-PlatformIO change, closing two review findings:

- base_ini_platform_incl() now uses the same extra_configs-derived globs as
  env_definition_dirs (via a shared board_ini_globs() helper) instead of the
  hardcoded fallback. Previously the two .ini scans could diverge: a new
  extra_configs glob would be picked up by the env-definition scan but not the
  arch-base scan, so a family base in a new location could be scoped to a single
  top-dir -> under-build. No behavior change on the current tree.
- base_ini_platform_incl() maps each base .ini to the SET of platform trees it
  re-includes (was: only bases with exactly one +<platform/X>). A base that
  re-includes multiple trees now fans out to all of them in Tier 2b, a safe
  superset, rather than being silently dropped (which scoped it to one top-dir
  -> under-build). Fails open, not closed.

Verified: 31/31 unit tests (3 new: multi-include mapping, Tier 2b superset,
board_ini_globs). Real-PlatformIO matrix output identical to the PR-head
baseline across full/PR/check sets and every changed-file scenario; the
extra_variants scenario is the expected 47-env superset. No under-build.
@vidplace7
vidplace7 force-pushed the feature/surgical-ci branch from cf1c6bd to 196db1e Compare July 24, 2026 21:33
caveman99 added a commit that referenced this pull request Jul 30, 2026
Release attachment moves to the matrix rework in #11151. The MSI is still
built and uploaded as a CI artifact.
caveman99 added a commit that referenced this pull request Jul 30, 2026
Release attachment moves to the matrix rework in #11151. The MSI is still
built and uploaded as a CI artifact.
@vidplace7 vidplace7 changed the title Actions: Only run PRs upon actual change Actions: Surgical CI - Only run PRs upon actual change Jul 30, 2026
pull Bot pushed a commit to CrazyForks/firmware that referenced this pull request Jul 31, 2026
* Package meshtasticd for Windows as an MSI

Adds a --service flag connecting meshtasticd to the Service Control
Manager, a WiX MSI installing it as an auto-start LocalSystem service with
config in %ProgramData%\Meshtastic, and a CI step attaching the MSI to
releases.

* Address review comments

Bind workflow expressions to env vars in run: bodies, and build the
service status per call with an atomic checkpoint.

* Fix service stop state and CI lint

Latch the stop under a mutex so a startup report cannot walk the state
back. Ignore the new workflows in semgrep and checkov, as main_matrix
already is.

* Drop the checkov ignore for the winget workflow

Resolve the newest release inside the job instead of taking
workflow_dispatch inputs, so CKV_GHA_7 no longer fires and checkov stays
active on the file.

* Carry the MSI architecture into the winget manifest

Parse it from the asset name instead of defaulting to x64, and fail on a
multi-arch release rather than validating one at random.

* Restore release/.gitignore

* Leave the main matrix alone

Release attachment moves to the matrix rework in meshtastic#11151. The MSI is still
built and uploaded as a CI artifact.

---------

Co-authored-by: Austin <vidplace7@gmail.com>
@vidplace7

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request
Changes were made in #11305 that change the behavior of board_level.
board_level = <not present> previously acted as an implicit "release" build; now it is explicit. Preserve this behaviour, otherwise prefer the changes in this PR.

Resolves conflicts from #11305 which made board_level explicit.
- Keep PR's sophisticated select_changed logic in generate_ci_matrix.py
- Update EMITTABLE_LEVELS to use 'release' instead of None
- Add board_level validation in load_all_envs (fail fast on missing/unknown levels)
- Update build_outlist to match 'release' explicitly instead of not-set
- Update tests to use level='release' for release boards
- Accept auto-merged board_level = release additions to ~100 variant files

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request
Changes were made in #11305 that change the behavior of board_level.
board_level = <not present> previously acted a...

Resolved in dd071fe. The conflict was in bin/generate_ci_matrix.py — all ~100 variant platformio.ini files from #11305 auto-merged cleanly.

For the Python conflict, the PR's sophisticated select_changed / load_all_envs logic was preserved while applying the #11305 semantics:

  • EMITTABLE_LEVELS updated from {None, "pr", "extra"} to {"pr", "release", "extra"}None is no longer valid
  • board_level validation added in load_all_envs() — fails fast with a clear error if any env is missing or uses an unrecognized value
  • build_outlist() updated to match env["board_level"] == "release" explicitly instead of not env["board_level"]
  • Tests updated to use level="release" for release boards and to assert that level=None now fails closed

All 32 unit tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants