From b16c29b2e8bdb0c0e383924296cd48e45b105752 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 31 Aug 2026 15:23:33 +0200 Subject: [PATCH] CI: Build vcpkg ports release-only to cut cold-cache time vcpkg only reads VCPKG_BUILD_TYPE from the triplet file, so the -DVCPKG_BUILD_TYPE=release passed to the top-level CMake call never had any effect and every port was built in both debug and release. On a cold cache that is roughly half of an 85 minute vcpkg step. Add release-only overlay triplets for x64-windows and x64-linux and select them from the workflow matrix. They are separate triplets rather than an override of the stock ones so local developer builds keep their debug dependencies. VCPKG_HOST_TRIPLET is set alongside the target triplet, otherwise the 12 host-tool ports (openssl and protobuf among them) would be built a second time under the stock triplet. The triplet is part of the vcpkg cache key since it changes every binary's ABI hash. --- .github/workflows/ResInsightWithCache.yml | 8 +++++-- .../x64-linux-release.cmake | 16 +++++++++++++ .../x64-windows-release.cmake | 24 +++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 ThirdParty/vcpkg-overlay-triplets/x64-linux-release.cmake create mode 100644 ThirdParty/vcpkg-overlay-triplets/x64-windows-release.cmake diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 72b9873e04..f043288aa0 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -31,6 +31,7 @@ jobs: publish-to-pypi: false, enable-asserts: false, vcpkg-bootstrap: bootstrap-vcpkg.bat, + vcpkg-triplet: x64-windows-release, qt-version: 6.10.1, ri-unit-test-path: "ApplicationLibCode/UnitTests/ResInsight-tests", } @@ -45,6 +46,7 @@ jobs: publish-to-pypi: true, enable-asserts: false, vcpkg-bootstrap: bootstrap-vcpkg.sh, + vcpkg-triplet: x64-linux-release, qt-version: 6.7.0, ri-unit-test-path: "ApplicationLibCode/UnitTests/ResInsight-tests", } @@ -59,6 +61,7 @@ jobs: publish-to-pypi: false, enable-asserts: true, vcpkg-bootstrap: bootstrap-vcpkg.sh, + vcpkg-triplet: x64-linux-release, qt-version: 6.7.0, ri-unit-test-path: "ApplicationLibCode/UnitTests/ResInsight-tests", } @@ -241,7 +244,7 @@ jobs: id: vcpkg-cache uses: CeetronSolutions/vcpkg-cache@copilot/optimize-cache-storage-structure with: - cache-key: ${{ runner.os }}-${{ matrix.config.cxx }}-${{ steps.image-version.outputs.version }}-${{ steps.compiler-hash.outputs.hash }}-${{ steps.vcpkg-sha.outputs.sha }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }} + cache-key: ${{ runner.os }}-${{ matrix.config.cxx }}-${{ steps.image-version.outputs.version }}-${{ steps.compiler-hash.outputs.hash }}-${{ matrix.config.vcpkg-triplet }}-${{ steps.vcpkg-sha.outputs.sha }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }} prefix: vcpkg-${{ matrix.config.cxx}}/ - name: Print CMake version @@ -264,7 +267,8 @@ jobs: CXX: ${{ matrix.config.cxx }} run: > cmake -S . -B cmakebuild - -DVCPKG_BUILD_TYPE=release + -DVCPKG_TARGET_TRIPLET=${{ matrix.config.vcpkg-triplet }} + -DVCPKG_HOST_TRIPLET=${{ matrix.config.vcpkg-triplet }} -DCMAKE_INSTALL_PREFIX=cmakebuild/install -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true diff --git a/ThirdParty/vcpkg-overlay-triplets/x64-linux-release.cmake b/ThirdParty/vcpkg-overlay-triplets/x64-linux-release.cmake new file mode 100644 index 0000000000..a1ec407cfa --- /dev/null +++ b/ThirdParty/vcpkg-overlay-triplets/x64-linux-release.cmake @@ -0,0 +1,16 @@ +# Release-only variant of vcpkg's x64-linux triplet, used by CI. +# See x64-windows-release.cmake for the rationale; the only differences here +# are the library linkage and target system. + +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_BUILD_TYPE release) + +# CMake 4.x removed compatibility with cmake_minimum_required(VERSION < 3.5). +# See x64-osx.cmake for the full rationale. Must be kept in sync with the +# x64-linux triplet this one shadows. +list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_POLICY_VERSION_MINIMUM=3.5") + +set(VCPKG_CMAKE_SYSTEM_NAME Linux) diff --git a/ThirdParty/vcpkg-overlay-triplets/x64-windows-release.cmake b/ThirdParty/vcpkg-overlay-triplets/x64-windows-release.cmake new file mode 100644 index 0000000000..10033540fa --- /dev/null +++ b/ThirdParty/vcpkg-overlay-triplets/x64-windows-release.cmake @@ -0,0 +1,24 @@ +# Release-only variant of vcpkg's x64-windows triplet, used by CI. +# +# Why this exists: +# vcpkg builds every port in both debug and release unless VCPKG_BUILD_TYPE +# says otherwise, and that variable is only read from the triplet file -- +# passing -DVCPKG_BUILD_TYPE=release to the top-level CMake call has no +# effect on the ports vcpkg builds. CI only ever links release binaries, so +# the debug half is pure cost: on a cold cache it is roughly half of an +# 85 minute vcpkg step (grpc, arrow, openssl and protobuf dominate). +# +# Kept as a separate triplet rather than folded into x64-windows so local +# developer builds keep their debug dependencies. + +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_PROVIDED_FORTRAN ON) + +set(VCPKG_BUILD_TYPE release) + +# CMake 4.x removed compatibility with cmake_minimum_required(VERSION < 3.5). +# See x64-osx.cmake for the full rationale. Must be kept in sync with the +# x64-windows triplet this one shadows. +list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_POLICY_VERSION_MINIMUM=3.5")