From c172b3680d71796118af93203b532b48c9a83b5e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 16 Oct 2026 18:26:06 +0700 Subject: [PATCH] perf(ci): persist bounded ESP-IDF ccache objects while preserving exact-head firmware builds --- .github/workflows/esp32p4-smv-injector.yml | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/esp32p4-smv-injector.yml b/.github/workflows/esp32p4-smv-injector.yml index e8ed9963f..5921793e0 100644 --- a/.github/workflows/esp32p4-smv-injector.yml +++ b/.github/workflows/esp32p4-smv-injector.yml @@ -53,6 +53,12 @@ jobs: if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} runs-on: ubuntu-latest timeout-minutes: 25 + env: + # ESP-IDF image already enables ccache. Persist only compiler objects, + # never firmware images or sourceCommit manifests. + CCACHE_DIR: ${{ github.workspace }}/.cache/ccache + CCACHE_MAXSIZE: 350M + CCACHE_COMPILERCHECK: content container: image: espressif/idf:v5.5.4 defaults: @@ -66,6 +72,25 @@ jobs: # synthetic merge SHA that may change between queue and build. ref: ${{ github.event.pull_request.head.sha || github.sha }} + # QML-only commits share a bounded compiler-object cache; the firmware + # itself is always rebuilt and stamped with the exact checkout SHA. + - name: Restore ESP-IDF compiler object cache + uses: actions/cache@v4 + with: + path: ${{ env.CCACHE_DIR }} + key: esp32p4-idf554-ccache-v1-${{ runner.os }}-${{ hashFiles('embedded/esp32p4_smv_injector/**', 'include/ariec61850/asn1/**', 'include/ariec61850/ethernet/**', 'include/ariec61850/mms/utc_time.hpp', 'include/ariec61850/time_sync/**', 'include/ariec61850/sampled_values/**', 'src/asn1/**', 'src/ethernet/**', 'src/mms/utc_time.cpp', 'src/time_sync/**', 'src/sampled_values/**', '.github/workflows/esp32p4-smv-injector.yml') }} + restore-keys: | + esp32p4-idf554-ccache-v1-${{ runner.os }}- + + - name: Reset compiler cache statistics + run: | + if command -v ccache >/dev/null 2>&1; then + ccache --zero-stats + echo "Compiler cache ready at ${CCACHE_DIR}" + else + echo 'ccache unavailable; preserve mandatory standard build' + fi + - name: Pin semantic firmware build ID to the exact checkout run: | set -euo pipefail @@ -141,6 +166,13 @@ jobs: - name: Build firmware run: source /opt/esp/idf/export.sh && idf.py build + - name: Report ESP-IDF compiler cache use + if: always() + run: | + if command -v ccache >/dev/null 2>&1; then + ccache --show-stats + fi + - name: Create single-image recovery firmware run: | set -euo pipefail