fix(ci): persist vcpkg binary archives so qtbase stops rebuilding
The Qt cache hit every run yet qtbase was still compiled from source (~32 min) each time. Two root causes: 1. The cache path included vcpkg\installed, but the build runs `gradlew clean` which deletes native/build/vcpkg_installed (the manifest-mode install dir). vcpkg restores packages from the file-backed binary cache (vcpkg-archives), which is the only thing that lets it skip a rebuild — and it restored 0 packages. 2. vcpkg-archives was never persisted across runs: the cache key was static (hash of vcpkg.json, which rarely changes), and actions/cache never overwrites an existing key. So every run got a cache hit on restore (empty archives), rebuilt qtbase, repopulated vcpkg-archives, then hit "cache hit, not saving" at Post — throwing the rebuilt archive away. Infinite rebuild loop. Fix: cache only vcpkg-archives (drop the ~1.2 GB dead vcpkg\installed), and rotate the key with github.run_id so Post always saves a fresh entry, with layered restore-keys to warm-start from the newest prior archive. The next build still primes the archive once (~32 min); subsequent builds restore qtbase and finish in minutes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -110,20 +110,30 @@ jobs:
|
||||
"VCPKG_ROOT=$vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Write-Host "Exported VCPKG_ROOT=$vcpkg to GITHUB_ENV"
|
||||
|
||||
# Cache the resolved Qt install + the file-backed binary archive.
|
||||
# Key is keyed on vcpkg.json so any dependency change invalidates;
|
||||
# restore-keys lets a vcpkg.json bump still warm-start from the
|
||||
# previous build's archives. installed/ alone makes CMake's manifest
|
||||
# mode skip rebuilding qtbase; archives/ also fills back transitive
|
||||
# deps if a partial rebuild is needed.
|
||||
- name: Cache vcpkg installed + archives
|
||||
# Cache the vcpkg *binary archives* — the only thing that lets vcpkg skip
|
||||
# rebuilding qtbase. The build runs `gradlew clean`, which deletes
|
||||
# native/build/ (and thus the manifest install dir native/build/vcpkg_installed),
|
||||
# so on every run vcpkg re-resolves the manifest and restores packages from
|
||||
# this file-backed binary cache. If it's empty, qtbase is compiled from
|
||||
# source (~32 min). (We previously cached vcpkg\installed too, but in
|
||||
# manifest mode that tree is never consulted for the rebuild decision — only
|
||||
# the binary archive is — so it was ~1.2 GB of dead weight.)
|
||||
#
|
||||
# The key MUST rotate per run: actions/cache never overwrites an existing
|
||||
# key, so a static key froze whatever archives the first run captured (none)
|
||||
# and every later run hit "cache hit, not saving" at Post — discarding the
|
||||
# qtbase archive it had just rebuilt, guaranteeing a fresh 32-min rebuild
|
||||
# forever. Appending run_id makes Post always save a new entry; the layered
|
||||
# restore-keys warm-start from the newest prior archive so qtbase is
|
||||
# restored, not rebuilt. (GitHub LRU-evicts old entries within the 10 GB
|
||||
# budget; the archive is only a few hundred MB.)
|
||||
- name: Cache vcpkg binary archives
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
vcpkg\installed
|
||||
vcpkg-archives
|
||||
key: vcpkg-qt-${{ runner.os }}-${{ hashFiles('native/vcpkg.json') }}
|
||||
path: vcpkg-archives
|
||||
key: vcpkg-qt-${{ runner.os }}-${{ hashFiles('native/vcpkg.json') }}-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
vcpkg-qt-${{ runner.os }}-${{ hashFiles('native/vcpkg.json') }}-
|
||||
vcpkg-qt-${{ runner.os }}-
|
||||
|
||||
- name: Install UPX
|
||||
|
||||
Reference in New Issue
Block a user