From 065d0c3e071d3e3400c23658b611d534a8d4ce5b Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Wed, 29 Oct 2025 08:57:21 +0700 Subject: [PATCH] feat(wip): remove currently unused workflows --- .github/workflows/build-in-docker.yml | 95 ----- .../workflows/build-in-docker.yml.disabled | 95 ----- .github/workflows/clang-format.yml | 72 ---- .github/workflows/clang-format.yml.disabled | 72 ---- .github/workflows/levelization.yml | 49 --- .github/workflows/levelization.yml.disabled | 49 --- .../workflows/verify-generated-headers.yml | 36 -- .../verify-generated-headers.yml.disabled | 36 -- .github/workflows/xahau-ga-macos.yml | 149 -------- .github/workflows/xahau-ga-macos.yml.disabled | 149 -------- .github/workflows/xahau-ga-nix.yml | 332 ------------------ .github/workflows/xahau-ga-nix.yml.disabled | 332 ------------------ 12 files changed, 1466 deletions(-) delete mode 100644 .github/workflows/build-in-docker.yml delete mode 100644 .github/workflows/build-in-docker.yml.disabled delete mode 100644 .github/workflows/clang-format.yml delete mode 100644 .github/workflows/clang-format.yml.disabled delete mode 100644 .github/workflows/levelization.yml delete mode 100644 .github/workflows/levelization.yml.disabled delete mode 100644 .github/workflows/verify-generated-headers.yml delete mode 100644 .github/workflows/verify-generated-headers.yml.disabled delete mode 100644 .github/workflows/xahau-ga-macos.yml delete mode 100644 .github/workflows/xahau-ga-macos.yml.disabled delete mode 100644 .github/workflows/xahau-ga-nix.yml delete mode 100644 .github/workflows/xahau-ga-nix.yml.disabled diff --git a/.github/workflows/build-in-docker.yml b/.github/workflows/build-in-docker.yml deleted file mode 100644 index e57dda8b4..000000000 --- a/.github/workflows/build-in-docker.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Build using Docker - -on: - push: - branches: ["dev", "candidate", "release", "jshooks"] - pull_request: - branches: ["dev", "candidate", "release", "jshooks"] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP: 1 - -jobs: - checkout: - runs-on: [self-hosted, vanity] - outputs: - checkout_path: ${{ steps.vars.outputs.checkout_path }} - steps: - - name: Prepare checkout path - id: vars - run: | - SAFE_BRANCH=$(echo "${{ github.ref_name }}" | sed -e 's/[^a-zA-Z0-9._-]/-/g') - CHECKOUT_PATH="${SAFE_BRANCH}-${{ github.sha }}" - echo "checkout_path=${CHECKOUT_PATH}" >> "$GITHUB_OUTPUT" - - - uses: actions/checkout@v4 - with: - path: ${{ steps.vars.outputs.checkout_path }} - clean: true - fetch-depth: 2 # Only get the last 2 commits, to avoid fetching all history - - build: - runs-on: [self-hosted, vanity] - needs: [checkout] - defaults: - run: - working-directory: ${{ needs.checkout.outputs.checkout_path }} - steps: - - name: Set Cleanup Script Path - run: | - echo "JOB_CLEANUP_SCRIPT=$(mktemp)" >> $GITHUB_ENV - - - name: Build using Docker - run: /bin/bash release-builder.sh - - - name: Stop Container (Cleanup) - if: always() - run: | - echo "Running cleanup script: $JOB_CLEANUP_SCRIPT" - /bin/bash -e -x "$JOB_CLEANUP_SCRIPT" - CLEANUP_EXIT_CODE=$? - - if [[ "$CLEANUP_EXIT_CODE" -eq 0 ]]; then - echo "Cleanup script succeeded." - rm -f "$JOB_CLEANUP_SCRIPT" - echo "Cleanup script removed." - else - echo "⚠️ Cleanup script failed! Keeping for debugging: $JOB_CLEANUP_SCRIPT" - fi - - if [[ "${DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP}" == "1" ]]; then - echo "🔍 Checking for leftover containers..." - BUILD_CONTAINERS=$(docker ps --format '{{.Names}}' | grep '^xahaud_cached_builder' || echo "") - - if [[ -n "$BUILD_CONTAINERS" ]]; then - echo "⚠️ WARNING: Some build containers are still running" - echo "$BUILD_CONTAINERS" - else - echo "✅ No build containers found" - fi - fi - - tests: - runs-on: [self-hosted, vanity] - needs: [build, checkout] - defaults: - run: - working-directory: ${{ needs.checkout.outputs.checkout_path }} - steps: - - name: Unit tests - run: /bin/bash docker-unit-tests.sh - - cleanup: - runs-on: [self-hosted, vanity] - needs: [tests, checkout] - if: always() - steps: - - name: Cleanup workspace - run: | - CHECKOUT_PATH="${{ needs.checkout.outputs.checkout_path }}" - echo "Cleaning workspace for ${CHECKOUT_PATH}" - rm -rf "${{ github.workspace }}/${CHECKOUT_PATH}" diff --git a/.github/workflows/build-in-docker.yml.disabled b/.github/workflows/build-in-docker.yml.disabled deleted file mode 100644 index e57dda8b4..000000000 --- a/.github/workflows/build-in-docker.yml.disabled +++ /dev/null @@ -1,95 +0,0 @@ -name: Build using Docker - -on: - push: - branches: ["dev", "candidate", "release", "jshooks"] - pull_request: - branches: ["dev", "candidate", "release", "jshooks"] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP: 1 - -jobs: - checkout: - runs-on: [self-hosted, vanity] - outputs: - checkout_path: ${{ steps.vars.outputs.checkout_path }} - steps: - - name: Prepare checkout path - id: vars - run: | - SAFE_BRANCH=$(echo "${{ github.ref_name }}" | sed -e 's/[^a-zA-Z0-9._-]/-/g') - CHECKOUT_PATH="${SAFE_BRANCH}-${{ github.sha }}" - echo "checkout_path=${CHECKOUT_PATH}" >> "$GITHUB_OUTPUT" - - - uses: actions/checkout@v4 - with: - path: ${{ steps.vars.outputs.checkout_path }} - clean: true - fetch-depth: 2 # Only get the last 2 commits, to avoid fetching all history - - build: - runs-on: [self-hosted, vanity] - needs: [checkout] - defaults: - run: - working-directory: ${{ needs.checkout.outputs.checkout_path }} - steps: - - name: Set Cleanup Script Path - run: | - echo "JOB_CLEANUP_SCRIPT=$(mktemp)" >> $GITHUB_ENV - - - name: Build using Docker - run: /bin/bash release-builder.sh - - - name: Stop Container (Cleanup) - if: always() - run: | - echo "Running cleanup script: $JOB_CLEANUP_SCRIPT" - /bin/bash -e -x "$JOB_CLEANUP_SCRIPT" - CLEANUP_EXIT_CODE=$? - - if [[ "$CLEANUP_EXIT_CODE" -eq 0 ]]; then - echo "Cleanup script succeeded." - rm -f "$JOB_CLEANUP_SCRIPT" - echo "Cleanup script removed." - else - echo "⚠️ Cleanup script failed! Keeping for debugging: $JOB_CLEANUP_SCRIPT" - fi - - if [[ "${DEBUG_BUILD_CONTAINERS_AFTER_CLEANUP}" == "1" ]]; then - echo "🔍 Checking for leftover containers..." - BUILD_CONTAINERS=$(docker ps --format '{{.Names}}' | grep '^xahaud_cached_builder' || echo "") - - if [[ -n "$BUILD_CONTAINERS" ]]; then - echo "⚠️ WARNING: Some build containers are still running" - echo "$BUILD_CONTAINERS" - else - echo "✅ No build containers found" - fi - fi - - tests: - runs-on: [self-hosted, vanity] - needs: [build, checkout] - defaults: - run: - working-directory: ${{ needs.checkout.outputs.checkout_path }} - steps: - - name: Unit tests - run: /bin/bash docker-unit-tests.sh - - cleanup: - runs-on: [self-hosted, vanity] - needs: [tests, checkout] - if: always() - steps: - - name: Cleanup workspace - run: | - CHECKOUT_PATH="${{ needs.checkout.outputs.checkout_path }}" - echo "Cleaning workspace for ${CHECKOUT_PATH}" - rm -rf "${{ github.workspace }}/${CHECKOUT_PATH}" diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml deleted file mode 100644 index 00f860dec..000000000 --- a/.github/workflows/clang-format.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: clang-format - -on: [push, pull_request] - -jobs: - check: - runs-on: ubuntu-22.04 - env: - CLANG_VERSION: 10 - steps: - - uses: actions/checkout@v3 - # - name: Install clang-format - # run: | - # codename=$( lsb_release --codename --short ) - # sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null </dev/null < "$tmp" - diff -u ${{ matrix.target }} "$tmp" diff --git a/.github/workflows/verify-generated-headers.yml.disabled b/.github/workflows/verify-generated-headers.yml.disabled deleted file mode 100644 index 4120f7b7f..000000000 --- a/.github/workflows/verify-generated-headers.yml.disabled +++ /dev/null @@ -1,36 +0,0 @@ -name: Verify Generated Hook Headers - -on: - push: - pull_request: - -jobs: - verify-generated-headers: - strategy: - fail-fast: false - matrix: - include: - - target: hook/error.h - generator: ./hook/generate_error.sh - - target: hook/extern.h - generator: ./hook/generate_extern.sh - - target: hook/sfcodes.h - generator: bash ./hook/generate_sfcodes.sh - - target: hook/tts.h - generator: ./hook/generate_tts.sh - runs-on: ubuntu-latest - name: ${{ matrix.target }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Verify ${{ matrix.target }} - run: | - set -euo pipefail - chmod +x hook/generate_*.sh || true - - tmp=$(mktemp) - trap 'rm -f "$tmp"' EXIT - - ${{ matrix.generator }} > "$tmp" - diff -u ${{ matrix.target }} "$tmp" diff --git a/.github/workflows/xahau-ga-macos.yml b/.github/workflows/xahau-ga-macos.yml deleted file mode 100644 index 66c7e6877..000000000 --- a/.github/workflows/xahau-ga-macos.yml +++ /dev/null @@ -1,149 +0,0 @@ -name: MacOS - GA Runner - -on: - push: - branches: ["dev", "candidate", "release"] - pull_request: - branches: ["dev", "candidate", "release"] - schedule: - - cron: '0 0 * * *' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - test: - strategy: - matrix: - generator: - - Ninja - configuration: - - Debug - runs-on: macos-15 - env: - build_dir: .build - # Bump this number to invalidate all caches globally. - CACHE_VERSION: 1 - MAIN_BRANCH_NAME: dev - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Conan - run: | - brew install conan - # Verify Conan 2 is installed - conan --version - - - name: Install Coreutils - run: | - brew install coreutils - echo "Num proc: $(nproc)" - - - name: Install Ninja - if: matrix.generator == 'Ninja' - run: brew install ninja - - - name: Install Python - run: | - if which python3 > /dev/null 2>&1; then - echo "Python 3 executable exists" - python3 --version - else - brew install python@3.12 - fi - # Create 'python' symlink if it doesn't exist (for tools expecting 'python') - if ! which python > /dev/null 2>&1; then - sudo ln -sf $(which python3) /usr/local/bin/python - fi - - - name: Install CMake - run: | - # Install CMake 3.x to match local dev environments - # With Conan 2 and the policy args passed to CMake, newer versions - # can have issues with dependencies that require cmake_minimum_required < 3.5 - brew uninstall cmake --ignore-dependencies 2>/dev/null || true - - # Download and install CMake 3.31.7 directly - curl -L https://github.com/Kitware/CMake/releases/download/v3.31.7/cmake-3.31.7-macos-universal.tar.gz -o cmake.tar.gz - tar -xzf cmake.tar.gz - - # Move the entire CMake.app to /Applications - sudo mv cmake-3.31.7-macos-universal/CMake.app /Applications/ - - echo "/Applications/CMake.app/Contents/bin" >> $GITHUB_PATH - /Applications/CMake.app/Contents/bin/cmake --version - - - name: Install ccache - run: brew install ccache - - - name: Configure ccache - uses: ./.github/actions/xahau-configure-ccache - with: - max_size: 2G - hash_dir: true - compiler_check: content - is_main_branch: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} - - - name: Check environment - run: | - echo "PATH:" - echo "${PATH}" | tr ':' '\n' - which python && python --version || echo "Python not found" - which conan && conan --version || echo "Conan not found" - which cmake && cmake --version || echo "CMake not found" - clang --version - ccache --version - echo "---- Full Environment ----" - env - - - name: Configure Conan - run: | - # Create the default profile directory if it doesn't exist - mkdir -p ~/.conan2/profiles - - # Detect compiler version - COMPILER_VERSION=$(clang --version | grep -oE 'version [0-9]+' | grep -oE '[0-9]+') - - # Create profile with our specific settings - cat > ~/.conan2/profiles/default < /dev/null 2>&1; then - echo "Python 3 executable exists" - python3 --version - else - brew install python@3.12 - fi - # Create 'python' symlink if it doesn't exist (for tools expecting 'python') - if ! which python > /dev/null 2>&1; then - sudo ln -sf $(which python3) /usr/local/bin/python - fi - - - name: Install CMake - run: | - # Install CMake 3.x to match local dev environments - # With Conan 2 and the policy args passed to CMake, newer versions - # can have issues with dependencies that require cmake_minimum_required < 3.5 - brew uninstall cmake --ignore-dependencies 2>/dev/null || true - - # Download and install CMake 3.31.7 directly - curl -L https://github.com/Kitware/CMake/releases/download/v3.31.7/cmake-3.31.7-macos-universal.tar.gz -o cmake.tar.gz - tar -xzf cmake.tar.gz - - # Move the entire CMake.app to /Applications - sudo mv cmake-3.31.7-macos-universal/CMake.app /Applications/ - - echo "/Applications/CMake.app/Contents/bin" >> $GITHUB_PATH - /Applications/CMake.app/Contents/bin/cmake --version - - - name: Install ccache - run: brew install ccache - - - name: Configure ccache - uses: ./.github/actions/xahau-configure-ccache - with: - max_size: 2G - hash_dir: true - compiler_check: content - is_main_branch: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} - - - name: Check environment - run: | - echo "PATH:" - echo "${PATH}" | tr ':' '\n' - which python && python --version || echo "Python not found" - which conan && conan --version || echo "Conan not found" - which cmake && cmake --version || echo "CMake not found" - clang --version - ccache --version - echo "---- Full Environment ----" - env - - - name: Configure Conan - run: | - # Create the default profile directory if it doesn't exist - mkdir -p ~/.conan2/profiles - - # Detect compiler version - COMPILER_VERSION=$(clang --version | grep -oE 'version [0-9]+' | grep -oE '[0-9]+') - - # Create profile with our specific settings - cat > ~/.conan2/profiles/default < 3 > 2 > 1, Clang will - # pick GCC 11 over our renamed versions. It's dumb but it works! - # - # Example: GCC 12→1, GCC 13→2, GCC 14→3, so Clang picks 11 (highest number) - if [ -n "${{ matrix.clang_gcc_toolchain }}" ] && [ "${{ matrix.compiler_version }}" -lt "16" ]; then - echo "=== Hiding GCC versions newer than ${{ matrix.clang_gcc_toolchain }} for Clang < 16 ===" - target_version=${{ matrix.clang_gcc_toolchain }} - counter=1 # Start with 1 - these will be seen as "GCC version 1, 2, 3" etc - for dir in /usr/lib/gcc/x86_64-linux-gnu/*/; do - if [ -d "$dir" ]; then - version=$(basename "$dir") - # Check if version is numeric and greater than target - if [[ "$version" =~ ^[0-9]+$ ]] && [ "$version" -gt "$target_version" ]; then - echo "Hiding GCC $version -> renaming to $counter (will be seen as GCC version $counter)" - # Safety check: ensure target doesn't already exist - if [ ! -e "/usr/lib/gcc/x86_64-linux-gnu/$counter" ]; then - sudo mv "$dir" "/usr/lib/gcc/x86_64-linux-gnu/$counter" - else - echo "ERROR: Cannot rename GCC $version - /usr/lib/gcc/x86_64-linux-gnu/$counter already exists" - exit 1 - fi - counter=$((counter + 1)) - fi - fi - done - fi - - # Verify what Clang will use - if [ -n "${{ matrix.clang_gcc_toolchain }}" ]; then - echo "=== Verifying GCC toolchain selection ===" - echo "Available GCC versions:" - ls -la /usr/lib/gcc/x86_64-linux-gnu/ | grep -E "^d.*[0-9]+$" || true - - echo "" - echo "Clang's detected GCC installation:" - ${{ matrix.cxx }} -v -E -x c++ /dev/null -o /dev/null 2>&1 | grep "Found candidate GCC installation" || true - fi - - # Install libc++ dev packages if using libc++ (not needed for libstdc++) - if [ "${{ matrix.stdlib }}" = "libcxx" ]; then - sudo apt-get install -y libc++-${{ matrix.compiler_version }}-dev libc++abi-${{ matrix.compiler_version }}-dev - fi - - # Install Conan 2 - pip install --upgrade "conan>=2.0,<3" - - - name: Configure ccache - uses: ./.github/actions/xahau-configure-ccache - with: - max_size: 2G - hash_dir: true - compiler_check: content - is_main_branch: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} - - - 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 <> "$GITHUB_OUTPUT" - echo "Using artifact name: ${ARTIFACT_NAME}" - - - name: Debug build directory - run: | - echo "Checking build directory contents: ${{ env.build_dir }}" - ls -la ${{ env.build_dir }} || echo "Build directory not found or empty" - - - name: Run tests - run: | - # Ensure the binary exists before trying to run - if [ -f "${{ env.build_dir }}/rippled" ]; then - ${{ env.build_dir }}/rippled --unittest --unittest-jobs $(nproc) - else - echo "Error: rippled executable not found in ${{ env.build_dir }}" - exit 1 - fi diff --git a/.github/workflows/xahau-ga-nix.yml.disabled b/.github/workflows/xahau-ga-nix.yml.disabled deleted file mode 100644 index 8e5c4c4c6..000000000 --- a/.github/workflows/xahau-ga-nix.yml.disabled +++ /dev/null @@ -1,332 +0,0 @@ -name: Nix - GA Runner - -on: - push: - branches: ["dev", "candidate", "release"] - pull_request: - branches: ["dev", "candidate", "release"] - schedule: - - cron: '0 0 * * *' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - matrix-setup: - runs-on: ubuntu-latest - container: python:3-slim - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - name: Generate build matrix - id: set-matrix - shell: python - run: | - import json - import os - - # Full matrix with all 6 compiler configurations - # Each configuration includes all parameters needed by the build job - full_matrix = [ - { - "compiler_id": "gcc-11-libstdcxx", - "compiler": "gcc", - "cc": "gcc-11", - "cxx": "g++-11", - "compiler_version": 11, - "stdlib": "libstdcxx", - "configuration": "Debug" - }, - { - "compiler_id": "gcc-13-libstdcxx", - "compiler": "gcc", - "cc": "gcc-13", - "cxx": "g++-13", - "compiler_version": 13, - "stdlib": "libstdcxx", - "configuration": "Debug" - }, - { - "compiler_id": "clang-14-libstdcxx-gcc11", - "compiler": "clang", - "cc": "clang-14", - "cxx": "clang++-14", - "compiler_version": 14, - "stdlib": "libstdcxx", - "clang_gcc_toolchain": 11, - "configuration": "Debug" - }, - { - "compiler_id": "clang-16-libstdcxx-gcc13", - "compiler": "clang", - "cc": "clang-16", - "cxx": "clang++-16", - "compiler_version": 16, - "stdlib": "libstdcxx", - "clang_gcc_toolchain": 13, - "configuration": "Debug" - }, - { - "compiler_id": "clang-17-libcxx", - "compiler": "clang", - "cc": "clang-17", - "cxx": "clang++-17", - "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 - minimal_matrix = [ - 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 - ref = "${{ github.ref }}" - base_ref = "${{ github.base_ref }}" # For PRs, this is the target branch - event_name = "${{ github.event_name }}" - commit_message = """${{ github.event.head_commit.message }}""" - pr_title = """${{ github.event.pull_request.title }}""" - - # Debug logging - print(f"Event: {event_name}") - print(f"Ref: {ref}") - print(f"Base ref: {base_ref}") - print(f"PR title: {pr_title}") - print(f"Commit message: {commit_message}") - - # Check for override tags in commit message or PR title - force_full = "[ci-nix-full-matrix]" in commit_message or "[ci-nix-full-matrix]" in pr_title - print(f"Force full matrix: {force_full}") - - # Check if this is targeting a main branch - # For PRs: check base_ref (target branch) - # For pushes: check ref (current branch) - main_branches = ["refs/heads/dev", "refs/heads/release", "refs/heads/candidate"] - - if force_full: - # Override: always use full matrix if tag is present - 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 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 - - # Select the appropriate matrix - if use_full: - if force_full: - print(f"Using FULL matrix (6 configs) - forced by [ci-nix-full-matrix] tag") - else: - print(f"Using FULL matrix (6 configs) - targeting main branch") - matrix = full_matrix - else: - print(f"Using MINIMAL matrix (2 configs) - feature branch/PR") - matrix = minimal_matrix - - # Output the matrix as JSON - output = json.dumps({"include": matrix}) - with open(os.environ['GITHUB_OUTPUT'], 'a') as f: - f.write(f"matrix={output}\n") - - build: - needs: matrix-setup - runs-on: ubuntu-latest - outputs: - artifact_name: ${{ steps.set-artifact-name.outputs.artifact_name }} - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.matrix-setup.outputs.matrix) }} - env: - build_dir: .build - # Bump this number to invalidate all caches globally. - CACHE_VERSION: 2 - MAIN_BRANCH_NAME: dev - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install build dependencies - run: | - sudo apt-get update - sudo apt-get install -y ninja-build ${{ matrix.cc }} ${{ matrix.cxx }} ccache - - # Install the specific GCC version needed for Clang - if [ -n "${{ matrix.clang_gcc_toolchain }}" ]; then - echo "=== Installing GCC ${{ matrix.clang_gcc_toolchain }} for Clang ===" - sudo apt-get install -y gcc-${{ matrix.clang_gcc_toolchain }} g++-${{ matrix.clang_gcc_toolchain }} libstdc++-${{ matrix.clang_gcc_toolchain }}-dev - - echo "=== GCC versions available after installation ===" - ls -la /usr/lib/gcc/x86_64-linux-gnu/ | grep -E "^d" - fi - - # For Clang < 16 with --gcc-toolchain, hide newer GCC versions - # This is needed because --gcc-toolchain still picks the highest version - # - # THE GREAT GCC HIDING TRICK (for Clang < 16): - # Clang versions before 16 don't have --gcc-install-dir, only --gcc-toolchain - # which is deprecated and still uses discovery heuristics that ALWAYS pick - # the highest version number. So we play a sneaky game... - # - # We rename newer GCC versions to very low integers (1, 2, 3...) which makes - # Clang think they're ancient GCC versions. Since 11 > 3 > 2 > 1, Clang will - # pick GCC 11 over our renamed versions. It's dumb but it works! - # - # Example: GCC 12→1, GCC 13→2, GCC 14→3, so Clang picks 11 (highest number) - if [ -n "${{ matrix.clang_gcc_toolchain }}" ] && [ "${{ matrix.compiler_version }}" -lt "16" ]; then - echo "=== Hiding GCC versions newer than ${{ matrix.clang_gcc_toolchain }} for Clang < 16 ===" - target_version=${{ matrix.clang_gcc_toolchain }} - counter=1 # Start with 1 - these will be seen as "GCC version 1, 2, 3" etc - for dir in /usr/lib/gcc/x86_64-linux-gnu/*/; do - if [ -d "$dir" ]; then - version=$(basename "$dir") - # Check if version is numeric and greater than target - if [[ "$version" =~ ^[0-9]+$ ]] && [ "$version" -gt "$target_version" ]; then - echo "Hiding GCC $version -> renaming to $counter (will be seen as GCC version $counter)" - # Safety check: ensure target doesn't already exist - if [ ! -e "/usr/lib/gcc/x86_64-linux-gnu/$counter" ]; then - sudo mv "$dir" "/usr/lib/gcc/x86_64-linux-gnu/$counter" - else - echo "ERROR: Cannot rename GCC $version - /usr/lib/gcc/x86_64-linux-gnu/$counter already exists" - exit 1 - fi - counter=$((counter + 1)) - fi - fi - done - fi - - # Verify what Clang will use - if [ -n "${{ matrix.clang_gcc_toolchain }}" ]; then - echo "=== Verifying GCC toolchain selection ===" - echo "Available GCC versions:" - ls -la /usr/lib/gcc/x86_64-linux-gnu/ | grep -E "^d.*[0-9]+$" || true - - echo "" - echo "Clang's detected GCC installation:" - ${{ matrix.cxx }} -v -E -x c++ /dev/null -o /dev/null 2>&1 | grep "Found candidate GCC installation" || true - fi - - # Install libc++ dev packages if using libc++ (not needed for libstdc++) - if [ "${{ matrix.stdlib }}" = "libcxx" ]; then - sudo apt-get install -y libc++-${{ matrix.compiler_version }}-dev libc++abi-${{ matrix.compiler_version }}-dev - fi - - # Install Conan 2 - pip install --upgrade "conan>=2.0,<3" - - - name: Configure ccache - uses: ./.github/actions/xahau-configure-ccache - with: - max_size: 2G - hash_dir: true - compiler_check: content - is_main_branch: ${{ github.ref_name == env.MAIN_BRANCH_NAME }} - - - 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 <> "$GITHUB_OUTPUT" - echo "Using artifact name: ${ARTIFACT_NAME}" - - - name: Debug build directory - run: | - echo "Checking build directory contents: ${{ env.build_dir }}" - ls -la ${{ env.build_dir }} || echo "Build directory not found or empty" - - - name: Run tests - run: | - # Ensure the binary exists before trying to run - if [ -f "${{ env.build_dir }}/rippled" ]; then - ${{ env.build_dir }}/rippled --unittest --unittest-jobs $(nproc) - else - echo "Error: rippled executable not found in ${{ env.build_dir }}" - exit 1 - fi