From ef40a7f3515d68574444f0a493a4a36cb6977559 Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Thu, 30 Oct 2025 16:41:43 +0700 Subject: [PATCH] refactor: move Conan profile creation after cache restore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PROBLEM: Profile was created before cache restore, then immediately overwritten by cached profile. This meant we were using a potentially stale cached profile instead of fresh configuration. SOLUTION: Move profile creation into dependencies action after restore - Dependencies action now takes compiler params as inputs - Profile created AFTER cache restore (overwrites any cached profile) - Ensures fresh profile with correct compiler settings for each job CHANGES: - Dependencies action: Add inputs (os, arch, compiler, compiler_version, cc, cxx) - Dependencies action: Add 'Configure Conan' step after cache restore - Dependencies action: Support both Linux and macOS profile generation - Nix workflow: Remove 'Configure Conan' step, pass compiler params - macOS workflow: Detect compiler version, pass to dependencies action Benefits: ✅ Profile always fresh and correct for current matrix config ✅ Cache still includes .conan.db and other important files ✅ Self-contained dependencies action (easier to understand) ✅ Works for both Linux (with explicit cc/cxx) and macOS (auto-detect) --- .../actions/xahau-ga-dependencies/action.yml | 74 +++++++++++++++++++ .github/workflows/xahau-ga-macos.yml.disabled | 35 +++------ .github/workflows/xahau-ga-nix.yml | 38 +--------- 3 files changed, 89 insertions(+), 58 deletions(-) diff --git a/.github/actions/xahau-ga-dependencies/action.yml b/.github/actions/xahau-ga-dependencies/action.yml index b63fbcb38..33ab718a7 100644 --- a/.github/actions/xahau-ga-dependencies/action.yml +++ b/.github/actions/xahau-ga-dependencies/action.yml @@ -25,6 +25,28 @@ inputs: description: 'Main branch name for restore keys' required: false default: 'dev' + os: + description: 'Operating system (Linux, Macos)' + required: false + default: 'Linux' + arch: + description: 'Architecture (x86_64, armv8)' + required: false + default: 'x86_64' + compiler: + description: 'Compiler type (gcc, clang, apple-clang)' + required: true + compiler_version: + description: 'Compiler version (11, 13, 14, etc.)' + required: true + cc: + description: 'C compiler executable (gcc-13, clang-14, etc.), empty for macOS' + required: false + default: '' + cxx: + description: 'C++ compiler executable (g++-14, clang++-14, etc.), empty for macOS' + required: false + default: '' stdlib: description: 'C++ standard library for Conan configuration (note: also in compiler-id)' required: true @@ -63,6 +85,58 @@ runs: aws-access-key-id: ${{ inputs.aws-access-key-id }} aws-secret-access-key: ${{ inputs.aws-secret-access-key }} + - name: Configure Conan + shell: bash + run: | + # Create the default profile directory if it doesn't exist + mkdir -p ~/.conan2/profiles + + # Determine the correct libcxx based on stdlib parameter + if [ "${{ inputs.stdlib }}" = "libcxx" ]; then + LIBCXX="libc++" + else + LIBCXX="libstdc++11" + fi + + # Create profile with our specific settings + # This overwrites any cached profile to ensure fresh configuration + cat > ~/.conan2/profiles/default <> ~/.conan2/profiles/default <> ~/.conan2/profiles/default < ~/.conan2/profiles/default <> $GITHUB_OUTPUT + echo "Detected Apple Clang version: ${COMPILER_VERSION}" - name: Install dependencies uses: ./.github/actions/xahau-ga-dependencies @@ -133,6 +113,13 @@ jobs: compiler-id: clang cache_version: ${{ env.CACHE_VERSION }} main_branch: ${{ env.MAIN_BRANCH_NAME }} + os: Macos + arch: armv8 + compiler: apple-clang + compiler_version: ${{ steps.detect-compiler.outputs.compiler_version }} + stdlib: libcxx + aws-access-key-id: ${{ secrets.XAHAUD_GITHUB_ACTIONS_CACHE_NIQ_AWS_KEY_ID }} + aws-secret-access-key: ${{ secrets.XAHAUD_GITHUB_ACTIONS_CACHE_NIQ_AWS_ACCESS_KEY }} - name: Build uses: ./.github/actions/xahau-ga-build diff --git a/.github/workflows/xahau-ga-nix.yml b/.github/workflows/xahau-ga-nix.yml index 0339357fb..49404d1e3 100644 --- a/.github/workflows/xahau-ga-nix.yml +++ b/.github/workflows/xahau-ga-nix.yml @@ -238,40 +238,6 @@ jobs: hash_dir: true compiler_check: content - - name: Configure Conan - run: | - # Create the default profile directory if it doesn't exist - mkdir -p ~/.conan2/profiles - - # Determine the correct libcxx based on stdlib parameter - if [ "${{ matrix.stdlib }}" = "libcxx" ]; then - LIBCXX="libc++" - else - LIBCXX="libstdc++11" - fi - - # Create profile with our specific settings - cat > ~/.conan2/profiles/default <