CI: skip main builds for tagged or docs-only commits
Firmware / build (push) Successful in 3m56s

A main push now skips itself when its commit already carries a v* tag (the tag
build covers it - release with git push --follow-tags) or when it only changes
wiki/** or *.md. Checked inside the job, so tag builds are never path-filtered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 23:58:32 +02:00
parent 51fd4a868a
commit 29711fa25e
4 changed files with 40 additions and 2 deletions
+33 -1
View File
@@ -19,6 +19,12 @@ name: Firmware
#
# Releases go through the Gitea API with plain curl (actions/upload-artifact
# is unreliable on this runner - same pattern as parking_solution).
#
# A main push skips itself (step "Skip?") when (a) the commit already carries a
# v* tag - the tag build covers it; release with ONE push so the tag exists
# when this runs: git push --follow-tags origin main - or (b) it only
# changes docs (wiki/**, *.md). Done in-job rather than with paths-ignore so a
# tag build can never be skipped by a path filter. Tag builds always run.
on:
push:
@@ -33,7 +39,29 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Skip?
env:
BEFORE: ${{ github.event.before }}
run: |
SKIP=false
if [ "${GITHUB_REF#refs/tags/}" = "${GITHUB_REF}" ] && [ "${GITHUB_EVENT_NAME}" = "push" ]; then
# (a) already tagged v* ? (annotated tags list their commit as <tag>^{})
if git ls-remote --tags origin 'v*' | grep -q "^${GITHUB_SHA}"; then
echo "commit ${GITHUB_SHA:0:7} is tagged - the tag build covers it"; SKIP=true
# (b) docs only? Needs the previous head; a new branch / force push just builds.
elif [ -n "$BEFORE" ] && [ "$BEFORE" != "0000000000000000000000000000000000000000" ] &&
git fetch -q --depth=1 origin "$BEFORE" 2>/dev/null; then
CHANGED=$(git diff --name-only "$BEFORE" "$GITHUB_SHA")
echo "changed files:"; echo "$CHANGED"
if [ -n "$CHANGED" ] && ! echo "$CHANGED" | grep -qvE '^wiki/|\.md$'; then
echo "docs-only change - no firmware build"; SKIP=true
fi
fi
fi
echo "SKIP=${SKIP}" >> "$GITHUB_ENV"
- name: Version
if: env.SKIP != 'true'
run: |
if [ "${GITHUB_REF#refs/tags/}" != "${GITHUB_REF}" ]; then
VERSION="${GITHUB_REF_NAME}"
@@ -46,6 +74,7 @@ jobs:
echo "version: ${VERSION}"
- name: Cache PlatformIO
if: env.SKIP != 'true'
uses: actions/cache@v4
with:
path: |
@@ -55,6 +84,7 @@ jobs:
key: pio-${{ hashFiles('platformio.ini') }}
- name: Install PlatformIO
if: env.SKIP != 'true'
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
@@ -62,6 +92,7 @@ jobs:
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Build
if: env.SKIP != 'true'
run: |
export PLATFORMIO_BUILD_FLAGS="-DFW_VERSION=\\\"${VERSION}\\\""
pio run
@@ -72,7 +103,7 @@ jobs:
ls -la dist/
- name: Sign + manifest (tags only)
if: startsWith(github.ref, 'refs/tags/')
if: env.SKIP != 'true' && startsWith(github.ref, 'refs/tags/')
env:
BMW_NISSAN_FIRMWARE_SIGNING_KEY: ${{ secrets.BMW_NISSAN_FIRMWARE_SIGNING_KEY }}
run: |
@@ -93,6 +124,7 @@ jobs:
cat dist/manifest.txt
- name: Publish release
if: env.SKIP != 'true'
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
API: ${{ github.api_url }}
+1 -1
View File
@@ -231,7 +231,7 @@ Settings persist across power cycles via ESP32 NVS (Non-Volatile Storage):
### OTA updates (`ota` console)
`src/modules/ota_update.cpp` pulls signed firmware from this repo's Gitea releases (`include/config/ota_config.h`: server, repo, Let's Encrypt roots, signing public key). Manual only: `ota status | check | install [force] | rollback` - the future password-gated Diagnostics screen will call the same code. Install is refused unless parked (engine off, shaft still, lever not in a drive gear; silent bus = parked), checked before download and again before the slot switch. The manifest's ECDSA P-256 signature over `patrol-a|version|sha256` is checked before download; the streamed image must match that sha256. `verifyRollbackLater()` is overridden so a new image stays pending until `Ota::tick()` confirms it after 30 s - a reset before that rolls back. CI: `.gitea/workflows/firmware.yml` (push `main` -> rolling unsigned pre-release `main-latest`; tag `v*` -> signed release, needs repo secret `BMW_NISSAN_FIRMWARE_SIGNING_KEY`). Never put secrets in firmware source - the repo and its release binaries are public. Jobs run inside the loop task (8 KB stack) with mbedtls routed to PSRAM - internal RAM is too tight for a TLS task (15.9 KB free, largest block 7.6 KB with Wi-Fi up). `wifi join <ssid> [pass] | status | off` (in `wifi_manager.cpp`) joins a network from the console. Details: `wiki/pages/ota-updates.md`.
`src/modules/ota_update.cpp` pulls signed firmware from this repo's Gitea releases (`include/config/ota_config.h`: server, repo, Let's Encrypt roots, signing public key). Manual only: `ota status | check | install [force] | rollback` - the future password-gated Diagnostics screen will call the same code. Install is refused unless parked (engine off, shaft still, lever not in a drive gear; silent bus = parked), checked before download and again before the slot switch. The manifest's ECDSA P-256 signature over `patrol-a|version|sha256` is checked before download; the streamed image must match that sha256. `verifyRollbackLater()` is overridden so a new image stays pending until `Ota::tick()` confirms it after 30 s - a reset before that rolls back. CI: `.gitea/workflows/firmware.yml` (push `main` -> rolling unsigned pre-release `main-latest`; tag `v*` -> signed release, needs repo secret `BMW_NISSAN_FIRMWARE_SIGNING_KEY`). Release with one push so only the tag build runs: `git tag -a vX.Y.Z -m "..." && git push --follow-tags origin main` (a main push skips itself when its commit is tagged, or when it only touches `wiki/**` / `*.md`). Never put secrets in firmware source - the repo and its release binaries are public. Jobs run inside the loop task (8 KB stack) with mbedtls routed to PSRAM - internal RAM is too tight for a TLS task (15.9 KB free, largest block 7.6 KB with Wi-Fi up). `wifi join <ssid> [pass] | status | off` (in `wifi_manager.cpp`) joins a network from the console. Details: `wiki/pages/ota-updates.md`.
### ESP-NOW link
+4
View File
@@ -125,3 +125,7 @@ Bench (home, both controllers on laptop USB, no car): A running USB-flashed `dev
## [2026-09-26] build | Display quick fixes (v0.1.2)
User reported heavy flicker during OTA and on Gauge Tuning taps, and laggy swipes. Diagnosis: flash and PSRAM share the MSPI cache; every flash write (OTA, or the NVS save on each Tuning tap) stalls the PSRAM framebuffer the RGB panel streams from, with no bounce buffer (ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE=0) - a known ESP32-S3 RGB issue. Swipes: every transition was LV_SCR_LOAD_ANIM_FADE_ON 100 ms - a full 1024x600 software re-render + alpha blend per frame. Also: the Debug "FPS" counts loop() passes (loop sleeps 100 ms), not rendering - real render FPS has never been measured. Quick fixes: instant screen switches; Tunables NVS writes deferred to 3 s idle / leaving Tuning; backlight off during OTA writes with before/after notices; firmware version label bottom-right on every screen. Real cure (bounce buffers + SPIRAM_XIP_FROM_PSRAM via custom_sdkconfig, needs internal RAM freed first) is planned as one measured bench session with open-questions #13.
## [2026-09-26] build | CI: no duplicate / docs-only builds; v0.1.3
v0.1.3 released (OTA download loop no longer aborts on a momentary TLS connected()==false; a forced reinstall had stalled at 570 B once, retry succeeded). Pushing main then the tag ran two identical builds, and every wiki commit rebuilt firmware: the workflow's new "Skip?" step makes a main push skip itself when its commit carries a v* tag or only touches wiki/** / *.md (in-job, so tag builds are never path-filtered). Release with `git push --follow-tags origin main`. Logic dry-run locally against the real remote (tagged/untagged/docs/mixed cases).
+2
View File
@@ -24,6 +24,8 @@ Controller A `ota install` ◄──────┘ (parked, Wi-Fi joined)
new image PENDING_VERIFY → confirmed after 30 s uptime, else bootloader rolls back
```
**To release:** `git tag -a vX.Y.Z -m "..." && git push --follow-tags origin main` — one push, one (tag) build: a `main` push skips itself when its commit already has a `v*` tag, and when it only changes `wiki/**` or `*.md` (checked inside the job, so a tag build is never skipped by a path filter).
Push to `main` (no tag) builds a rolling **pre-release `main-latest`** — unsigned, no manifest, for bench/USB testing. `/releases/latest` skips pre-releases, so the car is never offered it `(repo)`.
## Status: VERIFIED end-to-end `(verified 2026-09-26, bench, USB power, Wi-Fi Personal1)`