diff --git a/.github/actions/xahau-ga-dependencies/action.yml b/.github/actions/xahau-ga-dependencies/action.yml index f11a26c03..f3f422944 100644 --- a/.github/actions/xahau-ga-dependencies/action.yml +++ b/.github/actions/xahau-ga-dependencies/action.yml @@ -69,49 +69,6 @@ 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: python - run: | - import yaml - import re - from pathlib import Path - import subprocess - - # Extract Clang version from compiler-id (e.g., "clang-18-libcxx" -> "18") - compiler_id = "${{ inputs.compiler-id }}" - match = re.match(r'^clang-(\d+)', compiler_id) - - if not match: - print(f"No Clang version found in compiler-id: {compiler_id}") - exit(0) - - clang_version = match.group(1) - print(f"Detected Clang version {clang_version} from compiler-id") - - settings_path = Path.home() / '.conan' / 'settings.yml' - - # Initialize Conan if settings.yml doesn't exist yet - if not settings_path.exists(): - print("Conan not initialized, creating default profile...") - subprocess.run(['conan', 'profile', 'new', 'default', '--detect'], check=False) - - 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") - - name: Install dependencies shell: bash run: | diff --git a/.github/actions/xahau-patch-conan-clang-versions/action.yml b/.github/actions/xahau-patch-conan-clang-versions/action.yml new file mode 100644 index 000000000..9e9b2139a --- /dev/null +++ b/.github/actions/xahau-patch-conan-clang-versions/action.yml @@ -0,0 +1,53 @@ +name: patch-conan-clang-versions +description: 'Patch Conan settings.yml to support newer Clang versions' + +inputs: + compiler-id: + description: 'Unique identifier: compiler-version-stdlib[-gccversion] (e.g. clang-18-libcxx)' + required: true + +runs: + using: 'composite' + steps: + - name: Add Clang version support to Conan if needed + if: contains(inputs.compiler-id, 'clang-') + shell: python + run: | + import yaml + import re + from pathlib import Path + + # Extract Clang version from compiler-id (e.g., "clang-18-libcxx" -> "18") + compiler_id = "${{ inputs.compiler-id }}" + match = re.match(r'^clang-(\d+)', compiler_id) + + if not match: + print(f"No Clang version found in compiler-id: {compiler_id}") + exit(0) + + clang_version = match.group(1) + print(f"Detected Clang version {clang_version} from compiler-id") + + settings_path = Path.home() / '.conan' / 'settings.yml' + + # Check if settings.yml exists + if not settings_path.exists(): + print(f"ERROR: Conan settings.yml not found at {settings_path}") + print("Conan must be initialized before patching settings") + exit(1) + + 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") \ No newline at end of file diff --git a/.github/workflows/xahau-ga-nix.yml b/.github/workflows/xahau-ga-nix.yml index 6bf42acae..f063f2632 100644 --- a/.github/workflows/xahau-ga-nix.yml +++ b/.github/workflows/xahau-ga-nix.yml @@ -250,6 +250,11 @@ jobs: # Display profile for verification conan profile show default + - name: Patch Conan for newer Clang versions + uses: ./.github/actions/xahau-patch-conan-clang-versions + with: + compiler-id: ${{ matrix.compiler_id }} + - name: Check environment run: | echo "PATH:"