From a585ad9dd64b4c3c33a4744e076980e292bceefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stolarczuk?= Date: Thu, 17 Jul 2025 16:25:28 +0200 Subject: [PATCH] [CI] Add caching of vcpkg binaries in Win workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We cache only 'vcpkg/packages' dir as it's all that's needed. The speed up is from ~10 mins of deps downloading and building to a few seconds. Binaries, though, may be incompatible between different machines and Windows, so cache per w'flow and machine. Co-authored-by: RafaƂ Rudnicki --- .github/workflows/nightly.yml | 188 ++++++++++++------- .github/workflows/reusable_basic.yml | 35 +++- .github/workflows/reusable_codeql.yml | 37 +++- .github/workflows/reusable_compatibility.yml | 27 ++- .github/workflows/reusable_fast.yml | 27 ++- .github/workflows/reusable_gpu.yml | 29 ++- .github/workflows/reusable_sanitizers.yml | 3 +- 7 files changed, 263 insertions(+), 83 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index db93fa53bb..aaaae6ddce 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -130,11 +130,20 @@ jobs: with: fetch-depth: 0 - - name: Set VCPKG_PATH without hwloc - if: matrix.static_hwloc == 'ON' - run: echo "VCPKG_PATH=${{env.VCPKG_PATH_NO_HWLOC}}" >> $env:GITHUB_ENV + - name: Restore vcpkg cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: cache + with: + path: vcpkg_pkgs_cache.zip + key: vcpkg-generators-windows-latest-${{ hashFiles('vcpkg.json') }} + + - name: Unpack vcpkg cache + if: steps.cache.outputs.cache-hit == 'true' + run: | + Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{env.BUILD_DIR}}/vcpkg -Force - name: Initialize vcpkg + if: steps.cache.outputs.cache-hit != 'true' uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 with: vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 @@ -142,8 +151,13 @@ jobs: vcpkgJsonGlob: '**/vcpkg.json' - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' run: vcpkg install --triplet x64-windows + - name: Set VCPKG_PATH without hwloc + if: matrix.static_hwloc == 'ON' + run: echo "VCPKG_PATH=${{env.VCPKG_PATH_NO_HWLOC}}" >> $env:GITHUB_ENV + - name: Install Ninja if: matrix.generator == 'Ninja' uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6 @@ -222,6 +236,18 @@ jobs: working-directory: ${{github.workspace}}/examples/fetch_content/build run: ctest -V + - name: Prepare vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + Compress-Archive -Path ${{env.BUILD_DIR}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest + + - name: Save vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{github.workspace}}/vcpkg_pkgs_cache.zip + key: ${{ steps.cache.outputs.cache-primary-key }} + # Build and test UMF with Intel C++ Compiler (ICX) on Windows Windows-icx: env: @@ -241,71 +267,97 @@ jobs: runs-on: ${{matrix.os}} steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 - - - name: Initialize vcpkg - uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 - with: - vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 - vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg - vcpkgJsonGlob: '**/vcpkg.json' - - - name: Install dependencies - run: vcpkg install --triplet x64-windows - - - name: Install Ninja - uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6 - - - name: Download icx compiler - env: - # Link source: https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler-download.html - CMPLR_LINK: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/15a35578-2f9a-4f39-804b-3906e0a5f8fc/w_dpcpp-cpp-compiler_p_2024.2.1.83_offline.exe" - run: | - Invoke-WebRequest -Uri "${{ env.CMPLR_LINK }}" -OutFile compiler_install.exe - - - name: Install icx compiler - shell: cmd - run: | - start /b /wait .\compiler_install.exe -s -x -f extracted --log extract.log - extracted\bootstrapper.exe -s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 ^ - -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=. - - - name: Configure build - shell: cmd - run: | - call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" - call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" - cmake ^ - -B ${{env.BUILD_DIR}} ^ - -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}" ^ - -DCMAKE_C_COMPILER=${{matrix.compiler.c}} ^ - -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} ^ - -G Ninja ^ - -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} ^ - -DUMF_FORMAT_CODE_STYLE=OFF ^ - -DUMF_DEVELOPER_MODE=ON ^ - -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON ^ - -DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON ^ - -DUMF_BUILD_CUDA_PROVIDER=ON ^ - -DUMF_TESTS_FAIL_ON_SKIP=ON - - - name: Build UMF - shell: cmd - run: | - call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" - call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" - cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j %NUMBER_OF_PROCESSORS% - - - name: Run tests - shell: cmd - working-directory: ${{env.BUILD_DIR}} - run: | - call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" - call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" - ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Restore vcpkg cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: cache + with: + path: vcpkg_pkgs_cache.zip + key: vcpkg-icx-${{matrix.os}}-${{ hashFiles('vcpkg.json') }} + + - name: Unpack vcpkg cache + if: steps.cache.outputs.cache-hit == 'true' + run: | + Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{env.BUILD_DIR}}/vcpkg -Force + + - name: Initialize vcpkg + if: steps.cache.outputs.cache-hit != 'true' + uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 + with: + vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 + vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg + vcpkgJsonGlob: '**/vcpkg.json' + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: vcpkg install --triplet x64-windows + + - name: Install Ninja + uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6 + + - name: Download icx compiler + env: + # Link source: https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler-download.html + CMPLR_LINK: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/15a35578-2f9a-4f39-804b-3906e0a5f8fc/w_dpcpp-cpp-compiler_p_2024.2.1.83_offline.exe" + run: | + Invoke-WebRequest -Uri "${{ env.CMPLR_LINK }}" -OutFile compiler_install.exe + + - name: Install icx compiler + shell: cmd + run: | + start /b /wait .\compiler_install.exe -s -x -f extracted --log extract.log + extracted\bootstrapper.exe -s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 ^ + -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=. + + - name: Configure build + shell: cmd + run: | + call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" + call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" + cmake ^ + -B ${{env.BUILD_DIR}} ^ + -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}" ^ + -DCMAKE_C_COMPILER=${{matrix.compiler.c}} ^ + -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} ^ + -G Ninja ^ + -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} ^ + -DUMF_FORMAT_CODE_STYLE=OFF ^ + -DUMF_DEVELOPER_MODE=ON ^ + -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON ^ + -DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON ^ + -DUMF_BUILD_CUDA_PROVIDER=ON ^ + -DUMF_TESTS_FAIL_ON_SKIP=ON + + - name: Build UMF + shell: cmd + run: | + call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" + call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" + cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j %NUMBER_OF_PROCESSORS% + + - name: Run tests + shell: cmd + working-directory: ${{env.BUILD_DIR}} + run: | + call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" + call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" + ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test + + - name: Prepare vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + Compress-Archive -Path ${{env.BUILD_DIR}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest + + - name: Save vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{github.workspace}}/vcpkg_pkgs_cache.zip + key: ${{ steps.cache.outputs.cache-primary-key }} # Scenarios where UMF_LINK_HWLOC_STATICALLY is set to OFF and hwloc is not installed in the system # The hwloc library is fetched implicitly diff --git a/.github/workflows/reusable_basic.yml b/.github/workflows/reusable_basic.yml index 2c6e725900..7980e29397 100644 --- a/.github/workflows/reusable_basic.yml +++ b/.github/workflows/reusable_basic.yml @@ -311,27 +311,40 @@ jobs: with: arch: x64 + - name: Restore vcpkg cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: cache + with: + path: vcpkg_pkgs_cache.zip + key: vcpkg-basic-${{matrix.os}}-${{ hashFiles('vcpkg.json') }} + + - name: Unpack vcpkg cache + if: steps.cache.outputs.cache-hit == 'true' + run: | + Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{github.workspace}}/vcpkg -Force + - name: Initialize vcpkg + if: steps.cache.outputs.cache-hit != 'true' uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 with: vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 vcpkgDirectory: ${{github.workspace}}/vcpkg vcpkgJsonGlob: '**/vcpkg.json' - # Install the dependencies and add the bin folders to the PATH for older - # versions of CMake to correctly locate the libraries - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: vcpkg install --triplet x64-windows + + # Older versions of CMake require this step to correctly locate dependencies + - name: Add vcpkg bin dirs to PATH run: | - vcpkg install --triplet x64-windows $env:Path = "${{env.VCPKG_PATH_BIN}};$env:Path" echo "PATH=$env:Path" >> $env:GITHUB_ENV - shell: pwsh - name: Get UMF version run: | $version = (git describe --tags --abbrev=0 | Select-String -Pattern '\d+\.\d+\.\d+').Matches.Value echo "UMF_VERSION=$version" >> $env:GITHUB_ENV - shell: pwsh - name: Configure build (Debug) run: > @@ -442,6 +455,18 @@ jobs: run: ${{github.workspace}}/.github/scripts/check_dll_flags.ps1 ${{env.BUILD_RELEASE_DIR}}/src/proxy_lib/Release/umf_proxy.dll shell: pwsh + - name: Prepare vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + Compress-Archive -Path ${{github.workspace}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest + + - name: Save vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{github.workspace}}/vcpkg_pkgs_cache.zip + key: ${{ steps.cache.outputs.cache-primary-key }} + windows-dynamic_build_hwloc: name: "Windows dynamic UMF + static hwloc" strategy: diff --git a/.github/workflows/reusable_codeql.yml b/.github/workflows/reusable_codeql.yml index b45c515640..af3ec72ab7 100644 --- a/.github/workflows/reusable_codeql.yml +++ b/.github/workflows/reusable_codeql.yml @@ -45,19 +45,34 @@ jobs: with: languages: cpp - - name: "[Win] Initialize vcpkg" + - name: "[Win] Restore vcpkg cache" if: matrix.os == 'windows-latest' + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: cache + with: + path: vcpkg_pkgs_cache.zip + key: vcpkg-codeql-${{matrix.os}}-${{ hashFiles('vcpkg.json') }} + + - name: "[Win] Unpack vcpkg cache" + if: matrix.os == 'windows-latest' && steps.cache.outputs.cache-hit == 'true' + run: | + Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{env.BUILD_DIR}}/vcpkg -Force + + - name: "[Win] Initialize vcpkg" + if: matrix.os == 'windows-latest' && steps.cache.outputs.cache-hit != 'true' uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 with: vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg vcpkgJsonGlob: '**/vcpkg.json' - - name: "[Win] Install dependencies" + - name: "[Win] Install vcpkg dependencies" + if: matrix.os == 'windows-latest' && steps.cache.outputs.cache-hit != 'true' + run: vcpkg install --triplet x64-windows + + - name: "[Win] Install Python requirements" if: matrix.os == 'windows-latest' - run: | - vcpkg install --triplet x64-windows - python3 -m pip install -r third_party/requirements.txt + run: python3 -m pip install -r third_party/requirements.txt - name: "[Lin] Install apt packages" if: matrix.os == 'ubuntu-latest' @@ -93,3 +108,15 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 + + - name: "[Win] Prepare vcpkg cache" + if: matrix.os == 'windows-latest' && steps.cache.outputs.cache-hit != 'true' + run: | + Compress-Archive -Path ${{env.BUILD_DIR}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest + + - name: "[Win] Save vcpkg cache" + if: matrix.os == 'windows-latest' && steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{github.workspace}}/vcpkg_pkgs_cache.zip + key: ${{ steps.cache.outputs.cache-primary-key }} diff --git a/.github/workflows/reusable_compatibility.yml b/.github/workflows/reusable_compatibility.yml index 60a7e0a244..5315132d38 100644 --- a/.github/workflows/reusable_compatibility.yml +++ b/.github/workflows/reusable_compatibility.yml @@ -136,7 +136,20 @@ jobs: ref: refs/tags/${{inputs.tag}} path: ${{github.workspace}}/tag_version + - name: Restore vcpkg cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: cache + with: + path: vcpkg_pkgs_cache.zip + key: vcpkg-compat-windows-latest-${{ hashFiles('tag_version/vcpkg.json') }} + + - name: Unpack vcpkg cache + if: steps.cache.outputs.cache-hit == 'true' + run: | + Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{github.workspace}}/vcpkg -Force + - name: Initialize vcpkg + if: steps.cache.outputs.cache-hit != 'true' uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 with: vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 @@ -145,9 +158,9 @@ jobs: # NOTE we use vcpkg setup from "tag" version - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' working-directory: ${{github.workspace}}/tag_version run: vcpkg install --triplet x64-windows - shell: pwsh # Specifies PowerShell as the shell for running the script. - name: Checkout latest UMF version uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -254,6 +267,18 @@ jobs: } } + - name: Prepare vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + Compress-Archive -Path ${{github.workspace}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest + + - name: Save vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{github.workspace}}/vcpkg_pkgs_cache.zip + key: ${{ steps.cache.outputs.cache-primary-key }} + gpu: name: GPU Ubuntu # run only on upstream; forks will not have the HW diff --git a/.github/workflows/reusable_fast.yml b/.github/workflows/reusable_fast.yml index 63bbc85d0f..3a33604680 100644 --- a/.github/workflows/reusable_fast.yml +++ b/.github/workflows/reusable_fast.yml @@ -108,7 +108,20 @@ jobs: with: fetch-depth: 0 + - name: Restore vcpkg cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: cache + with: + path: vcpkg_pkgs_cache.zip + key: vcpkg-fast-windows-latest-${{ hashFiles('vcpkg.json') }} + + - name: Unpack vcpkg cache + if: steps.cache.outputs.cache-hit == 'true' + run: | + Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{env.BUILD_DIR}}/vcpkg -Force + - name: Initialize vcpkg + if: steps.cache.outputs.cache-hit != 'true' uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 with: vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 @@ -116,8 +129,8 @@ jobs: vcpkgJsonGlob: '**/vcpkg.json' - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' run: vcpkg install --triplet x64-windows - shell: pwsh # Specifies PowerShell as the shell for running the script. - name: Configure CMake if: matrix.simple_cmake == 'OFF' @@ -164,3 +177,15 @@ jobs: run: | get-command ${{github.workspace}}/build/bin/Release/umf.dll | format-list get-command ${{github.workspace}}/build/src/proxy_lib/Release/umf_proxy.dll | format-list + + - name: Prepare vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + Compress-Archive -Path ${{env.BUILD_DIR}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest + + - name: Save vcpkg cache + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{github.workspace}}/vcpkg_pkgs_cache.zip + key: ${{ steps.cache.outputs.cache-primary-key }} diff --git a/.github/workflows/reusable_gpu.yml b/.github/workflows/reusable_gpu.yml index d7c4453c93..f0d1bcda80 100644 --- a/.github/workflows/reusable_gpu.yml +++ b/.github/workflows/reusable_gpu.yml @@ -73,8 +73,21 @@ jobs: if: matrix.os == 'Ubuntu' run: .github/scripts/get_system_info.sh - - name: "[Win] Initialize vcpkg" + - name: "[Win] Restore vcpkg cache" if: matrix.os == 'Windows' + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: cache + with: + path: vcpkg_pkgs_cache.zip + key: vcpkg-gpu-${{inputs.runner}}-windows-${{ hashFiles('vcpkg.json') }} + + - name: "[Win] Unpack vcpkg cache" + if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit == 'true' + run: | + Expand-Archive -Path ${{github.workspace}}/vcpkg_pkgs_cache.zip -DestinationPath ${{github.workspace}}/vcpkg -Force + + - name: "[Win] Initialize vcpkg" + if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 with: vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025 @@ -82,7 +95,7 @@ jobs: vcpkgJsonGlob: '**/vcpkg.json' - name: "[Win] Install dependencies" - if: matrix.os == 'Windows' + if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' run: vcpkg install --triplet x64-windows # note: disable all providers except the one being tested @@ -176,3 +189,15 @@ jobs: with: name: ${{env.COVERAGE_NAME}}-shared-${{matrix.shared_library}} path: ${{env.COVERAGE_DIR}} + + - name: "[Win] Prepare vcpkg cache" + if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' + run: | + Compress-Archive -Path ${{github.workspace}}/vcpkg/packages -DestinationPath ${{github.workspace}}/vcpkg_pkgs_cache.zip -Force -CompressionLevel Fastest + + - name: "[Win] Save vcpkg cache" + if: matrix.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ${{github.workspace}}/vcpkg_pkgs_cache.zip + key: ${{ steps.cache.outputs.cache-primary-key }} diff --git a/.github/workflows/reusable_sanitizers.yml b/.github/workflows/reusable_sanitizers.yml index 28d2088e9f..0af7828abb 100644 --- a/.github/workflows/reusable_sanitizers.yml +++ b/.github/workflows/reusable_sanitizers.yml @@ -74,7 +74,8 @@ jobs: run: | ctest --output-on-failure - # TODO restore ASAN tests on Windows + # TODO: restore ASAN tests on Windows + # TODO: ... and when restored - add cache support for vcpkg packages !!! #windows-build: # env: # VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows"