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.
This commit is contained in:
Magne Sjaastad
2026-08-31 22:21:52 +02:00
parent 14a4aa0f62
commit b16c29b2e8
3 changed files with 46 additions and 2 deletions
+6 -2
View File
@@ -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
@@ -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)
@@ -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")