From 5bf5d5e3489184ff7ca1616c243f9f521bbf7c6d Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 8 Oct 2026 06:00:32 +0200 Subject: [PATCH] ci: save the resource summary cache after every self-analysis The resource summary cache was restored and saved by one actions/cache step under a key that depends only on the resource models. actions/cache saves only on a primary-key miss, so the entry written on 2026-09-21 was restored by every run and never replaced: a module changed since then cannot reuse it, and since the cache schema moved to v5 (#190) none can. Every self-analysis computed all its resource summaries again. As for the test caches, restore and save are now split, the key carries the run id, and restore-keys restore the latest entry for the same models, then any. The cache is saved even when the self-analysis fails. Refs #193 --- .github/workflows/ci.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe416a3..7b5b722 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,14 +168,18 @@ jobs: # Self-analysis (Linux only) # Resource summary cache — stale entries are harmless (cache key includes - # schema + model + IR hash, so mismatches simply trigger a rebuild). + # schema + model + IR hash, so mismatches simply trigger a rebuild). As for + # the test caches, restore/save are split and the key carries a per-run + # suffix: a stable key would keep the first summaries saved forever. - name: Restore resource summary cache + id: resource-cache if: runner.os == 'Linux' - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: .cache/resource-lifetime - key: resource-cache-${{ runner.os }}-${{ hashFiles('models/resource-lifetime/**') }} + key: resource-cache-${{ runner.os }}-${{ hashFiles('models/resource-lifetime/**') }}-${{ github.run_id }} restore-keys: | + resource-cache-${{ runner.os }}-${{ hashFiles('models/resource-lifetime/**') }}- resource-cache-${{ runner.os }}- - name: Self-analysis (analyze own source code) @@ -194,6 +198,14 @@ jobs: --analyzer-arg=--analysis-profile=fast \ --analyzer-arg=--resource-model=models/resource-lifetime/generic.txt + # Saved even when the self-analysis fails, like the test caches. + - name: Save resource summary cache + if: always() && runner.os == 'Linux' + uses: actions/cache/save@v4 + with: + path: .cache/resource-lifetime + key: ${{ steps.resource-cache.outputs.cache-primary-key }} + - name: Upload SARIF to Code Scanning if: runner.os == 'Linux' && always() && hashFiles('artifacts/self-analysis.sarif') != '' uses: github/codeql-action/upload-sarif@v3