From 65027881eb3dec33791505313fb7d70ce33756f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henning=20P=C3=B6ttker?= <25299532+hpoettker@users.noreply.github.com> Date: Mon, 2 Nov 2026 18:39:10 +0100 Subject: [PATCH] Cache vcpkg dependencies in MSVC build --- .github/workflows/build.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 368f0b38..895e574e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -113,21 +113,38 @@ jobs: run: exit 1 windows_msvc: runs-on: windows-latest + env: + VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}\\vcpkg-cache,readwrite" steps: - uses: actions/checkout@v6 - - - uses: ilammy/msvc-dev-cmd@v1 + + - name: Compute vcpkg cache key + id: vcpkg-key + shell: pwsh + run: | + $commit = git -C "$env:VCPKG_INSTALLATION_ROOT" rev-parse --short HEAD + "key=vcpkg-${{ runner.os }}-$env:ImageVersion-$commit" >> $env:GITHUB_OUTPUT + + - name: Cache vcpkg binaries + uses: actions/cache@v6 + with: + path: ${{ github.workspace }}/vcpkg-cache + key: ${{ steps.vcpkg-key.outputs.key }} + restore-keys: vcpkg-${{ runner.os }}- - name: Install dependencies run: | vcpkg install gettext libiconv libcsv libxlsxwriter zlib --triplet x64-windows vcpkg integrate install + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v3 + - name: Fix library filename and paths for MSVC shell: pwsh run: | - $libDir = "C:\vcpkg\installed\x64-windows\lib" - + $libDir = "$env:VCPKG_INSTALLATION_ROOT\installed\x64-windows\lib" + if (Test-Path "$libDir\iconv.lib") { Copy-Item "$libDir\iconv.lib" "$libDir\libiconv.lib" -Force } @@ -160,8 +177,6 @@ jobs: - name: Test shell: pwsh - env: - PATH: C:\vcpkg\installed\x64-windows\bin;${{ env.PATH }} run: | # pwsh only fails the step on the last command's exit code, so # check each executable explicitly