mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-23 10:18:30 +08:00
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:
8
.github/workflows/flash_analysis.yml
vendored
8
.github/workflows/flash_analysis.yml
vendored
@@ -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:
|
||||
|
||||
@@ -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")),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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, "🟢 ")):
|
||||
|
||||
Reference in New Issue
Block a user