summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2026-06-05 14:34:27 +0700
committerGitHub <[email protected]>2026-06-05 14:34:27 +0700
commit9dea2c8f397c004d3f3288bac3c0df9c842fe713 (patch)
tree7095735fded76df9947241a5a86efdda82f91664
parentddc065dc9fd929fcc94b0993c3af4b56877b1cd6 (diff)
ci: carry metrics baseline forward on no-code-change pushes (#3678)
* ci: carry metrics baseline forward on no-code-change pushes The code-metrics job is gated on code_changed and only uploads the metrics-tinyusb artifact on push, so a workflow/docs-only push to master (e.g. removing an unrelated workflow) leaves the latest master Build run without a baseline. PRs download the baseline from the latest master run, so the size comparison then finds nothing and silently falls back to absolute sizes. Add a small metrics-carry-forward job that, on a non-code-change push, downloads the previous metrics-tinyusb artifact and re-publishes it, so the latest run always carries a usable baseline. Carry-forward runs re-upload too, so the baseline chains across consecutive no-code pushes (bounded by artifact retention).
-rw-r--r--.github/workflows/build.yml30
1 files changed, 30 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index af0191149..e5075f46f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -193,6 +193,36 @@ jobs:
path: metrics_compare.md
# ---------------------------------------
+ # Keep the metrics baseline available on no-code-change pushes
+ # The code-metrics job only runs (and uploads metrics-tinyusb) when code changed, so a
+ # workflow/docs-only push to master would leave the latest run without a baseline for PRs
+ # to compare against. Carry the previous artifact forward so the baseline is never missing.
+ # ---------------------------------------
+ metrics-carry-forward:
+ needs: [ check-paths ]
+ if: github.event_name == 'push' && needs.check-paths.outputs.code_changed != 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Download previous metrics baseline from this branch
+ uses: dawidd6/action-download-artifact@v11
+ with:
+ workflow: build.yml
+ workflow_conclusion: '' # any conclusion, matching the PR-side baseline download
+ search_artifacts: true # scan back past runs that lack the artifact (e.g. earlier no-code pushes)
+ branch: ${{ github.ref_name }}
+ name: metrics-tinyusb
+ path: .
+ if_no_artifact_found: warn
+ continue-on-error: true # best-effort: never make a no-code push red
+
+ - name: Re-publish baseline so the latest run keeps it
+ if: hashFiles('metrics.json') != ''
+ uses: actions/upload-artifact@v7
+ with:
+ name: metrics-tinyusb
+ path: metrics.json
+
+ # ---------------------------------------
# Build Make/CMake on Windows/MacOS
# ---------------------------------------
build-os: