4242 os-version : [2022, 2025]
4343 crypto : [OpenSSL, BCrypt]
4444 env :
45- LOCAL_VCPKG_ROOT : ${{ github.workspace }}/vcpkg
45+ VCPKG_ROOT : ${{ github.workspace }}/vcpkg
46+ VCPKG_DEFAULT_BINARY_CACHE : ${{ github.workspace }}/vcpkg-bincache
47+ VCPKG_BINARY_SOURCES : clear;files,${{ github.workspace }}/vcpkg-bincache,readwrite
4648 steps :
4749 - uses : actions/checkout@main
4850
@@ -54,14 +56,29 @@ jobs:
5456 # install of vcpkg, and we don't want that
5557 - uses : ilammy/msvc-dev-cmd@v1
5658
59+ - name : Force workflow VCPKG_ROOT
60+ run : |
61+ "VCPKG_ROOT=${{ github.workspace }}/vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
62+ shell : pwsh
63+
5764 - name : Setup local vcpkg
5865 run : |
59- git clone https://github.com/microsoft/vcpkg.git "${{ env.LOCAL_VCPKG_ROOT }}"
60- cd /d "${{ env.LOCAL_VCPKG_ROOT }}"
66+ git clone https://github.com/microsoft/vcpkg.git "${{ env.VCPKG_ROOT }}"
67+ cd /d "${{ env.VCPKG_ROOT }}"
6168 git checkout c3867e714dd3a51c272826eea77267876517ed99
6269 call bootstrap-vcpkg.bat -disableMetrics
6370 shell : cmd
6471
72+ - name : Restore vcpkg caches
73+ uses : actions/cache@v4
74+ with :
75+ path : |
76+ ${{ env.VCPKG_ROOT }}/downloads
77+ ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
78+ key : vcpkg-${{ runner.os }}-${{ matrix.os-version }}-${{ matrix.crypto }}-c3867e714dd3a51c272826eea77267876517ed99-${{ hashFiles('vcpkg.json') }}
79+ restore-keys : |
80+ vcpkg-${{ runner.os }}-${{ matrix.os-version }}-${{ matrix.crypto }}-
81+
6582 # Mark all directories as safe so checkouts performed in CMakeLists.txt don't cause "unsafe repository" errors.
6683 # See https://github.com/actions/checkout/issues/766
6784 - name : Configure Git
@@ -70,14 +87,14 @@ jobs:
7087
7188 - name : vcpkg check / install dependencies
7289 working-directory : ' ${{ github.workspace }}'
73- run : ' "${{env.LOCAL_VCPKG_ROOT }}\vcpkg" install --triplet=x64-windows'
90+ run : ' "${{env.VCPKG_ROOT }}\vcpkg" install --vcpkg-root "${{env.VCPKG_ROOT}}" --triplet=x64-windows'
7491 shell : cmd
7592
7693 - name : Install dependencies and generate project files
7794 run : |
7895 mkdir build
7996 cd build
80- cmake -S .. -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_TOOLS=ON "-DCMAKE_TOOLCHAIN_FILE=${{env.LOCAL_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" -DUSE_CRYPTO=${{matrix.crypto}}
97+ cmake -S .. -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_TOOLS=ON "-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" -DUSE_CRYPTO=${{matrix.crypto}}
8198 shell : cmd
8299
83100 - name : Build projects
0 commit comments