From c6c20877fff82ab0a5ceeb32711b1a63f6d91870 Mon Sep 17 00:00:00 2001 From: Shirona1337 Date: Sun, 24 May 2026 16:06:02 +0800 Subject: [PATCH] ci(loader): cache vcpkg installed/ via actions/cache, drop x-gha The previous run still rebuilt Qt from source on the second push. vcpkg's x-gha binary cache backend relies on the v1 GitHub Actions cache API and the ACTIONS_CACHE_URL / ACTIONS_RUNTIME_TOKEN secrets exported via actions/github-script. On the current windows-2022 image the v1 API is being phased out (the new ACTIONS_RESULTS_URL is what's reachable), so x-gha quietly missed on every run. Switch to a path-based actions/cache@v4 entry: - path: vcpkg\installed + vcpkg-archives - key: vcpkg-qt-${runner.os}-${hash(native/vcpkg.json)} - restore-keys: vcpkg-qt-${runner.os}- (warm start on a vcpkg.json bump) vcpkg.installed is the deployed Qt tree CMake's manifest mode inspects; if it already contains qtbase[widgets] the first vcpkg install call is a no-op and CMake configure finishes in seconds. vcpkg-archives gets fed via the new VCPKG_BINARY_SOURCES=clear;files,...\vcpkg-archives,readwrite binary source so transitive package binaries are also persisted across runs - useful when vcpkg.json changes and only some libs need rebuilding. Also drop the now-unused "Export GitHub Actions cache tokens" step (no x-gha backend, no tokens needed). Co-Authored-By: Claude Opus 4.7 --- .github/workflows/build-loader.yml | 37 ++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-loader.yml b/.github/workflows/build-loader.yml index f1f4cc9..1e15de8 100644 --- a/.github/workflows/build-loader.yml +++ b/.github/workflows/build-loader.yml @@ -22,7 +22,15 @@ jobs: # wins over a job-level env in PowerShell expansions. We export # the right VCPKG_ROOT into $GITHUB_ENV inside the clone step # so every later step sees our copy. - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + # + # We rely on actions/cache for the installed Qt artifacts; the + # vcpkg x-gha backend depends on the v1 GitHub Actions cache API + # which has been deprecated, and a fresh runner image often does + # not have ACTIONS_RESULTS_URL set for non-Node actions yet. + # Setting "files" as the binary source means vcpkg will still + # populate ${VCPKG_ROOT}/archives, which actions/cache then + # snapshots along with installed/. + VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}\\vcpkg-archives,readwrite" steps: - name: Checkout @@ -49,17 +57,6 @@ jobs: with: arch: x64 - # Expose ACTIONS_CACHE_URL / ACTIONS_RUNTIME_TOKEN to subsequent - # steps so vcpkg's x-gha cache backend works. These are set by - # the runner but only exposed to actions via the toolkit; we - # forward them manually for the shell-based vcpkg calls below. - - name: Export GitHub Actions cache tokens - uses: actions/github-script@v7 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - name: Clone & bootstrap vcpkg shell: pwsh run: | @@ -74,6 +71,22 @@ 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 + uses: actions/cache@v4 + with: + path: | + vcpkg\installed + vcpkg-archives + key: vcpkg-qt-${{ runner.os }}-${{ hashFiles('native/vcpkg.json') }} + restore-keys: | + vcpkg-qt-${{ runner.os }}- + - name: Install UPX shell: pwsh run: choco install upx -y --no-progress