CI: derive arch/source mapping from PlatformIO instead of hardcoding - #11161
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe CI matrix generator now derives source-platform and family-base mappings from PlatformIO metadata, applies them during changed-file selection, and uses an allowlist for emitted levels. The PR workflow always passes the changed-files path, with expanded unit tests covering the derived behavior. ChangesCI matrix narrowing
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant GitHub Actions
participant generate_ci_matrix.py
participant PlatformIO metadata
participant CI matrix
GitHub Actions->>generate_ci_matrix.py: pass changed-files path
generate_ci_matrix.py->>PlatformIO metadata: load environments and includes
PlatformIO metadata-->>generate_ci_matrix.py: provide source and base-ini mappings
generate_ci_matrix.py->>CI matrix: select and emit narrowed environments
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bin/generate_ci_matrix.py`:
- Around line 131-152: Update base_ini_platform_incl and select_changed so an
arch-base .ini with multiple direct platform includes is represented as an
ambiguous mapping and causes Tier-3 full fallback (None), rather than being
omitted and scoped to one top-level directory. Preserve the existing
single-include family mapping and no-include scoped behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fa3eeead-d5a2-4df9-9159-4781ad0f29bd
📒 Files selected for processing (3)
.github/workflows/main_matrix.ymlbin/generate_ci_matrix.pybin/test_generate_ci_matrix.py
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.
5e74d7b
into
meshtastic:feature/surgical-ci
Builds on #11151. Three of the hardcoded constants in
generate_ci_matrix.pycan be derived from PlatformIO, which makes the change-detection self-maintaining when a board/arch is added:platform/<subdir> -> archfrombuild_src_filter. Each env re-includes its tree via+<platform/X>, so the reverse-map (including the ESP32 family self-grouping) is read from config. DropsESP32_FAMILYandPLATFORM_SRC_TOPDIRSentirely, and fixessrc/platform/extra_variants/which was unmapped and fell back to a full build.[platformio] extra_configsfor the env-definition ini globs instead of a hardcoded 2-glob tuple. Anti-rot / future-proofing; no behavior change on the current tree._emittableis now an allowlist (None/pr/extra) so a retired or typo'dboard_levelfails closed rather than silently building. (Relevant now thatcommunityis being retired in this PR.)EXTRA/[[ -s ]]bash plumbing -- the generator no-ops on an absent/empty--changed-files, so it is passed unconditionally.Verified against real PlatformIO: full, PR, and check sets plus every changed-file scenario produce identical matrices to this PR's head (zero under-build). 28/28 unit tests pass.
Targeted at
feature/surgical-ciso a merge folds straight into #11151. Happy to reshape or split however you prefer.Summary by CodeRabbit
Bug Fixes
Tests