From 5024d8237b2f68c5adb5fc524c0b3632149a7e30 Mon Sep 17 00:00:00 2001 From: Shirona1337 Date: Sun, 24 May 2026 15:00:23 +0800 Subject: [PATCH] ci(loader): override pre-set VCPKG_ROOT via GITHUB_ENV windows-2022 runners with VS Enterprise installed pre-set a system-wide VCPKG_ROOT pointing at "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\vcpkg". That value wins over the job-level `env: VCPKG_ROOT:` in PowerShell expansions, so the previous run tried to git-clone into that read-only path and failed with "destination path ... already exists and is not an empty directory". Drop the job-level VCPKG_ROOT and instead resolve the path to "$GITHUB_WORKSPACE\vcpkg" inside the clone step, then write it back via GITHUB_ENV so every later step (including Gradle's findVcpkg / configureNative) picks up our copy. The build step also dumps VCPKG_ROOT / JAVA_HOME / OPENZEN_BUILD_REVISION up front for quick diagnosis if the override ever drifts again. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/build-loader.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-loader.yml b/.github/workflows/build-loader.yml index 9bb5293..f1f4cc9 100644 --- a/.github/workflows/build-loader.yml +++ b/.github/workflows/build-loader.yml @@ -16,10 +16,12 @@ jobs: timeout-minutes: 180 env: - VCPKG_ROOT: ${{ github.workspace }}\vcpkg - # Push to / pull from the GitHub Actions binary cache so a fresh - # checkout reuses already-built Qt instead of rebuilding from - # source on every push. + # NOTE: do not declare VCPKG_ROOT here. The windows-2022 runner + # ships VS Enterprise which pre-sets a system-wide VCPKG_ROOT + # pointing at its own (empty) vcpkg dir, and that pre-set value + # 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" steps: @@ -61,10 +63,16 @@ jobs: - name: Clone & bootstrap vcpkg shell: pwsh run: | - git clone --depth=1 https://github.com/microsoft/vcpkg.git "$env:VCPKG_ROOT" - & "$env:VCPKG_ROOT\bootstrap-vcpkg.bat" -disableMetrics - Write-Host "vcpkg at $env:VCPKG_ROOT" - & "$env:VCPKG_ROOT\vcpkg.exe" version + $vcpkg = Join-Path $env:GITHUB_WORKSPACE 'vcpkg' + if (Test-Path $vcpkg) { + Write-Host "Reusing existing $vcpkg" + } else { + git clone --depth=1 https://github.com/microsoft/vcpkg.git $vcpkg + } + & "$vcpkg\bootstrap-vcpkg.bat" -disableMetrics + & "$vcpkg\vcpkg.exe" version + "VCPKG_ROOT=$vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + Write-Host "Exported VCPKG_ROOT=$vcpkg to GITHUB_ENV" - name: Install UPX shell: pwsh @@ -85,6 +93,9 @@ jobs: env: OPENZEN_BUILD_REVISION: ${{ steps.rev.outputs.sha }} run: | + Write-Host "VCPKG_ROOT = $env:VCPKG_ROOT" + Write-Host "JAVA_HOME = $env:JAVA_HOME" + Write-Host "OPENZEN_BUILD_REV = $env:OPENZEN_BUILD_REVISION" .\gradlew.bat --no-daemon clean dll upxCompress - name: Show artifact info