fix(ci): skip the flash comment for sub-30 B deltas and agent-doc changes (#28806)

The commit hash compiled into px4_firmware_version_binary() changes its code size, so a PR with no code change reported -8 B on v6x and got a comment. Changes that only touch agent instructions also no longer build the targets.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
This commit is contained in:
Jacob Dahl
2026-09-22 15:52:55 -08:00
committed by GitHub
parent 9e9871d403
commit 2ec03ff1c3
3 changed files with 19 additions and 1 deletions

View File

@@ -11,11 +11,19 @@ on:
- 'main'
paths-ignore:
- 'docs/**'
- '.agents/**'
- '.claude/**'
- '**/AGENTS.md'
- '**/CLAUDE.md'
pull_request:
branches:
- '**'
paths-ignore:
- 'docs/**'
- '.agents/**'
- '.claude/**'
- '**/AGENTS.md'
- '**/CLAUDE.md'
jobs:
analyze_flash:

View File

@@ -7,6 +7,10 @@ import os
from pathlib import Path
import subprocess
# The commit hash compiled into px4_firmware_version_binary() changes its code
# size, so identical sources on two commits can differ by up to 16 B.
MIN_REPORTED_DELTA = 30
def memory_usage(elf: Path) -> dict[str, int]:
# Sections rather than program headers: ld may map the ELF header into the
@@ -67,7 +71,8 @@ def summarize(before: dict[str, int], after: dict[str, int]) -> dict:
return {
"flash": format_change(before["flash"], after["flash"]),
"ram": format_change(before["ram"], after["ram"]),
"changed": before != after,
"changed": any(abs(after[key] - before[key]) >= MIN_REPORTED_DELTA
for key in ("flash", "ram")),
}

View File

@@ -110,6 +110,11 @@ SECTIONS
self.assertFalse(summarize({"flash": 1, "ram": 0}, {"flash": 1, "ram": 0})["changed"])
self.assertEqual(format_change(0, 4488), "🔴 +4,488 B (n/a)")
def test_small_deltas_are_not_reported(self):
before = {"flash": 1000, "ram": 1000}
self.assertFalse(summarize(before, {"flash": 992, "ram": 1029})["changed"])
self.assertTrue(summarize(before, {"flash": 970, "ram": 1000})["changed"])
def test_change_indicator(self):
for delta, expected in ((1001, "🔴 "), (1000, "🟡 "), (101, "🟡 "), (100, ""),
(-100, ""), (-101, "🟢 "), (-5000, "🟢 ")):