From e559008fc8e07c95fa08925519bbe637e9bb8713 Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Tue, 19 Aug 2025 13:59:23 +0700 Subject: [PATCH] fix: use Python shell for Conan settings patch - Switch to shell: python since PyYAML is pre-installed on Ubuntu - Move export statement before Python heredoc so env var is available - Adjust PR matrix logic: only release/candidate PRs get full matrix - PRs to dev now use minimal matrix (most are feature branches) [ci-nix-full-matrix] --- .../actions/xahau-ga-dependencies/action.yml | 29 +++++++------------ .github/workflows/xahau-ga-nix.yml | 4 +-- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/actions/xahau-ga-dependencies/action.yml b/.github/actions/xahau-ga-dependencies/action.yml index 52a73960b..e04209091 100644 --- a/.github/actions/xahau-ga-dependencies/action.yml +++ b/.github/actions/xahau-ga-dependencies/action.yml @@ -71,25 +71,23 @@ runs: - name: Add Clang version support to Conan if needed if: contains(inputs.compiler-id, 'clang-') - shell: bash + shell: python 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 + import re from pathlib import Path - import os - clang_version = os.environ.get('CLANG_VERSION', '') - if not clang_version: - print("No Clang version detected") + # 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' with open(settings_path, 'r') as f: settings = yaml.safe_load(f) @@ -106,11 +104,6 @@ runs: 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 diff --git a/.github/workflows/xahau-ga-nix.yml b/.github/workflows/xahau-ga-nix.yml index 5ef322898..cf3315275 100644 --- a/.github/workflows/xahau-ga-nix.yml +++ b/.github/workflows/xahau-ga-nix.yml @@ -113,8 +113,8 @@ jobs: use_full = True elif event_name == "pull_request": # For PRs, base_ref is just the branch name (e.g., "dev", not "refs/heads/dev") - # Check if the PR targets a main branch - use_full = base_ref in ["dev", "release", "candidate"] + # Check if the PR targets release or candidate (more critical branches) + use_full = base_ref in ["release", "candidate"] else: # For pushes, ref is the full reference (e.g., "refs/heads/dev") use_full = ref in main_branches