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]
This commit is contained in:
Nicholas Dudfield
2025-08-19 13:59:23 +07:00
parent 7ced4de6f2
commit e559008fc8
2 changed files with 13 additions and 20 deletions

View File

@@ -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

View File

@@ -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