Update ci pipeline to allow switching between msvc versions

This commit is contained in:
JCW
2026-06-11 13:29:53 +01:00
parent 09c36d066e
commit 69aadde85c
6 changed files with 71 additions and 4 deletions

View File

@@ -22,6 +22,10 @@ inputs:
description: "The sanitizers to enable."
required: false
default: ""
compiler_version:
description: "Override the Conan compiler.version (e.g. msvc '194' or '195'). Leave empty to auto-detect."
required: false
default: ""
runs:
using: composite
@@ -34,9 +38,15 @@ runs:
BUILD_TYPE: ${{ inputs.build_type }}
LOG_VERBOSITY: ${{ inputs.log_verbosity }}
SANITIZERS: ${{ inputs.sanitizers }}
COMPILER_VERSION: ${{ inputs.compiler_version }}
run: |
COMPILER_VERSION_SETTING=()
if [ -n "${COMPILER_VERSION}" ]; then
COMPILER_VERSION_SETTING=(--settings:all compiler.version="${COMPILER_VERSION}")
fi
conan install \
--profile:all ci \
"${COMPILER_VERSION_SETTING[@]}" \
--build="${BUILD_OPTION}" \
--options:host='&:tests=True' \
--options:host='&:xrpld=True' \

View File

@@ -102,6 +102,20 @@ class PlatformConfig:
self.build_type = [self.build_type]
@dataclasses.dataclass
class Toolset:
"""One entry in windows.json's 'toolsets' array (Windows only).
Each toolset selects a Visual Studio version: the CMake generator drives
the configure step, and compiler_version pins the matching Conan msvc
toolset so dependencies are built against the same compiler.
"""
name: str # short config-name suffix, e.g. "vs2022"
generator: str # CMake generator, e.g. "Visual Studio 17 2022"
compiler_version: str = "" # Conan msvc compiler.version, e.g. "194"
@dataclasses.dataclass
class PlatformFile:
"""Shape of macos.json and windows.json."""
@@ -109,6 +123,7 @@ class PlatformFile:
platform: str # e.g. "macos/arm64" or "windows/amd64"
runner: list[str] # GitHub Actions runner labels
configs: list[PlatformConfig]
toolsets: list[Toolset] = dataclasses.field(default_factory=list)
@classmethod
def load(cls, path: Path) -> "PlatformFile":
@@ -117,6 +132,7 @@ class PlatformFile:
platform=data["platform"],
runner=data["runner"],
configs=[PlatformConfig(**c) for c in data["configs"]],
toolsets=[Toolset(**t) for t in data.get("toolsets", [])],
)
@@ -144,6 +160,8 @@ class MatrixEntry:
sanitizers: str
image: str = "" # container image; empty for macOS/Windows (runs natively)
compiler: str = "" # compiler name ("gcc" or "clang"); empty for macOS/Windows
generator: str = "" # CMake generator; empty selects Ninja (Linux/macOS)
compiler_version: str = "" # Conan msvc compiler.version; empty auto-detects
@dataclasses.dataclass
@@ -248,24 +266,35 @@ def expand_platform_matrix(
"""Expand a PlatformFile (macOS or Windows) into matrix entries.
Configs that exclude the current event are skipped.
When toolsets are defined (Windows), the configs are expanded over the
cross-product with the toolsets so each config is built against every
Visual Studio version. Platforms without toolsets (macOS) use a single
implicit toolset with no generator override (the build defaults to Ninja).
"""
platform_name, arch = pf.platform.split("/")
is_windows = platform_name == "windows"
toolsets = pf.toolsets or [Toolset(name="", generator="", compiler_version="")]
entries: list[MatrixEntry] = []
for cfg in pf.configs:
for toolset, cfg in itertools.product(toolsets, pf.configs):
if not runs_on_event(cfg.exclude_event_types, event):
continue
for build_type in cfg.build_type:
name_parts = [platform_name, arch, toolset.name, build_type.lower()]
entries.append(
MatrixEntry(
config_name=f"{platform_name}-{arch}-{build_type.lower()}",
config_name="-".join(p for p in name_parts if p),
cmake_args=get_cmake_args(build_type, cfg.extra_cmake_args),
cmake_target="install" if is_windows else "all",
build_only=cfg.build_only,
build_type=build_type,
architecture=Architecture(platform=pf.platform, runner=pf.runner),
sanitizers="",
generator=toolset.generator,
compiler_version=toolset.compiler_version,
)
)
return entries

View File

@@ -1,6 +1,18 @@
{
"platform": "windows/amd64",
"runner": ["self-hosted", "Windows", "devbox"],
"runner": ["self-hosted", "Windows", "devbox-jcw-test"],
"toolsets": [
{
"name": "vs2022",
"generator": "Visual Studio 17 2022",
"compiler_version": "194"
},
{
"name": "vs2026",
"generator": "Visual Studio 18 2026",
"compiler_version": "195"
}
],
"configs": [
{ "build_type": "Release" },
{

View File

@@ -63,6 +63,18 @@ on:
type: string
default: ""
generator:
description: "The CMake generator to use. Leave empty to use Ninja (Linux/macOS)."
required: false
type: string
default: ""
compiler_version:
description: "Override the Conan compiler.version (Windows Visual Studio toolset). Leave empty to auto-detect."
required: false
type: string
default: ""
secrets:
CODECOV_TOKEN:
description: "The Codecov token to use for uploading coverage reports."
@@ -150,6 +162,7 @@ jobs:
# amount of logs. For other OSes, the "verbose" logs are more useful.
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
sanitizers: ${{ inputs.sanitizers }}
compiler_version: ${{ inputs.compiler_version }}
- name: Configure CMake
working-directory: ${{ env.BUILD_DIR }}
@@ -158,7 +171,7 @@ jobs:
CMAKE_ARGS: ${{ inputs.cmake_args }}
run: |
cmake \
-G '${{ runner.os == 'Windows' && 'Visual Studio 17 2022' || 'Ninja' }}' \
-G '${{ inputs.generator != '' && inputs.generator || 'Ninja' }}' \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
${CMAKE_ARGS} \

View File

@@ -50,5 +50,7 @@ jobs:
config_name: ${{ matrix.config_name }}
sanitizers: ${{ matrix.sanitizers }}
compiler: ${{ matrix.compiler || '' }}
generator: ${{ matrix.generator || '' }}
compiler_version: ${{ matrix.compiler_version || '' }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -105,6 +105,7 @@ jobs:
# amount of logs. For other OSes, the "verbose" logs are more useful.
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
sanitizers: ${{ matrix.sanitizers }}
compiler_version: ${{ matrix.compiler_version || '' }}
- name: Log into Conan remote
if: ${{ github.repository == 'XRPLF/rippled' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}