From 7ced4de6f23bdf1acbf66397cf9efbe78d1c10c4 Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Tue, 19 Aug 2025 13:54:46 +0700 Subject: [PATCH] feat: add clang-18 support with generic version detection - Add clang-18-libcxx configuration (6 compiler configs total) - Generic Conan settings patcher: auto-detects Clang version from compiler-id - Works for any future Clang version without code changes - Change minimal matrix to use clang-14 instead of clang-17 (faster) - Sort Conan version list numerically when adding new versions [ci-nix-full-matrix] --- .../actions/xahau-ga-dependencies/action.yml | 43 +++++++++++++++++++ .github/workflows/xahau-ga-nix.yml | 23 +++++++--- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/.github/actions/xahau-ga-dependencies/action.yml b/.github/actions/xahau-ga-dependencies/action.yml index f3f422944..52a73960b 100644 --- a/.github/actions/xahau-ga-dependencies/action.yml +++ b/.github/actions/xahau-ga-dependencies/action.yml @@ -69,6 +69,49 @@ runs: conan export external/snappy snappy/1.1.10@xahaud/stable conan export external/soci soci/4.0.3@xahaud/stable + - name: Add Clang version support to Conan if needed + if: contains(inputs.compiler-id, 'clang-') + shell: bash + run: | + # Extract Clang version from compiler-id (e.g., "clang-18-libcxx" -> "18") + COMPILER_ID="${{ inputs.compiler-id }}" + CLANG_VERSION=$(echo "$COMPILER_ID" | sed -n 's/^clang-\([0-9]\+\).*/\1/p') + + if [ -n "$CLANG_VERSION" ]; then + echo "Detected Clang version $CLANG_VERSION from compiler-id" + pip install PyYAML + python << EOF + import yaml + from pathlib import Path + import os + + clang_version = os.environ.get('CLANG_VERSION', '') + if not clang_version: + print("No Clang version detected") + exit(0) + + settings_path = Path.home() / '.conan' / 'settings.yml' + with open(settings_path, 'r') as f: + settings = yaml.safe_load(f) + + # Add the detected version to clang versions if not already there + clang_versions = settings['compiler']['clang']['version'] + if clang_version not in clang_versions: + clang_versions.append(clang_version) + # Sort versions numerically + clang_versions.sort(key=lambda x: int(x) if x.isdigit() else float('inf')) + + with open(settings_path, 'w') as f: + yaml.dump(settings, f, default_flow_style=False, sort_keys=False) + print(f"Added Clang {clang_version} support to Conan settings") + else: + print(f"Clang {clang_version} already supported in Conan settings") + EOF + export CLANG_VERSION + else + echo "No Clang version found in compiler-id: $COMPILER_ID" + fi + - name: Install dependencies shell: bash run: | diff --git a/.github/workflows/xahau-ga-nix.yml b/.github/workflows/xahau-ga-nix.yml index 542470e65..5ef322898 100644 --- a/.github/workflows/xahau-ga-nix.yml +++ b/.github/workflows/xahau-ga-nix.yml @@ -24,7 +24,7 @@ jobs: import json import os - # Full matrix with all 5 compiler configurations + # Full matrix with all 6 compiler configurations # Each configuration includes all parameters needed by the build job full_matrix = [ { @@ -73,13 +73,24 @@ jobs: "compiler_version": 17, "stdlib": "libcxx", "configuration": "Debug" + }, + { + # Clang 18 - testing if it's faster than Clang 17 with libc++ + # Requires patching Conan v1 settings.yml to add version 18 + "compiler_id": "clang-18-libcxx", + "compiler": "clang", + "cc": "clang-18", + "cxx": "clang++-18", + "compiler_version": 18, + "stdlib": "libcxx", + "configuration": "Debug" } ] - # Minimal matrix for PRs and feature branches (newest gcc + newest clang) + # Minimal matrix for PRs and feature branches minimal_matrix = [ - full_matrix[1], # gcc-13 - full_matrix[4] # clang-17 + full_matrix[1], # gcc-13 (middle-ground gcc) + full_matrix[2] # clang-14 (mature, stable clang) ] # Determine which matrix to use based on the target branch @@ -111,9 +122,9 @@ jobs: # Select the appropriate matrix if use_full: if force_full: - print(f"Using FULL matrix (5 configs) - forced by [ci-nix-full-matrix] tag") + print(f"Using FULL matrix (6 configs) - forced by [ci-nix-full-matrix] tag") else: - print(f"Using FULL matrix (5 configs) - targeting main branch") + print(f"Using FULL matrix (6 configs) - targeting main branch") matrix = full_matrix else: print(f"Using MINIMAL matrix (2 configs) - feature branch/PR")