diff --git a/.github/workflows/build-in-docker.yml.disabled b/.github/workflows/build-in-docker.yml.disabled new file mode 100644 index 000000000..e57dda8b4 --- /dev/null +++ b/.github/workflows/build-in-docker.yml.disabled @@ -0,0 +1,95 @@ +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.disabled b/.github/workflows/clang-format.yml.disabled new file mode 100644 index 000000000..00f860dec --- /dev/null +++ b/.github/workflows/clang-format.yml.disabled @@ -0,0 +1,72 @@ +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 < /tmp/test/base/file1.txt + echo "base file 2" > /tmp/test/base/file2.txt + echo "base file 3" > /tmp/test/base/file3.txt + mkdir -p /tmp/test/base/subdir + echo "base subdir file" > /tmp/test/base/subdir/file.txt + + echo "=== Base layer contents ===" + find /tmp/test/base -type f -exec sh -c 'echo "{}:"; cat "{}"' \; + + echo "=== Mounting OverlayFS ===" + sudo mount -t overlay overlay \ + -o lowerdir=/tmp/test/base,upperdir=/tmp/test/upper,workdir=/tmp/test/work \ + /tmp/test/merged + + echo "=== Mounted successfully ===" + mount | grep overlay + + - name: Verify merged view shows base files + run: | + echo "=== Contents of /merged (should show base files) ===" + ls -R /tmp/test/merged + find /tmp/test/merged -type f -exec sh -c 'echo "{}:"; cat "{}"' \; + + - name: Make changes via merged layer + run: | + echo "=== Making changes via /merged ===" + + # Overwrite existing file + echo "MODIFIED file 2" > /tmp/test/merged/file2.txt + echo "Modified file2.txt" + + # Create new file + echo "NEW file 4" > /tmp/test/merged/file4.txt + echo "Created new file4.txt" + + # Create new directory with file + mkdir -p /tmp/test/merged/newdir + echo "NEW file in new dir" > /tmp/test/merged/newdir/newfile.txt + echo "Created newdir/newfile.txt" + + # Add file to existing directory + echo "NEW file in existing subdir" > /tmp/test/merged/subdir/newfile.txt + echo "Created subdir/newfile.txt" + + echo "=== Changes complete ===" + + - name: Show the delta (upperdir) + run: | + echo "========================================" + echo "THE DELTA (only changes in /upper):" + echo "========================================" + + if [ -z "$(ls -A /tmp/test/upper)" ]; then + echo "Upper directory is empty - no changes detected" + else + echo "Upper directory structure:" + ls -R /tmp/test/upper + echo "" + echo "Upper directory files with content:" + find /tmp/test/upper -type f -exec sh -c 'echo "---"; echo "FILE: {}"; cat "{}"; echo ""' \; + + echo "========================================" + echo "SIZE OF DELTA:" + du -sh /tmp/test/upper + echo "========================================" + fi + + - name: Compare base vs upper vs merged + run: | + echo "========================================" + echo "COMPARISON:" + echo "========================================" + + echo "BASE layer (original, untouched):" + ls -la /tmp/test/base/ + echo "" + + echo "UPPER layer (DELTA - only changes):" + ls -la /tmp/test/upper/ + echo "" + + echo "MERGED layer (unified view = base + upper):" + ls -la /tmp/test/merged/ + echo "" + + echo "========================================" + echo "PROOF: Upper dir contains ONLY the delta!" + echo "========================================" + + - name: Simulate tarball creation (what we'd upload) + run: | + echo "=== Creating tarball of delta ===" + tar -czf /tmp/delta.tar.gz -C /tmp/test/upper . + + echo "Delta tarball size:" + ls -lh /tmp/delta.tar.gz + + echo "" + echo "Delta tarball contents:" + tar -tzf /tmp/delta.tar.gz + + echo "" + echo "========================================" + echo "This is what we'd upload to S3/rsync!" + echo "Only ~few KB instead of entire cache!" + echo "========================================" + + - name: Cleanup + if: always() + run: | + echo "=== Unmounting OverlayFS ===" + sudo umount /tmp/test/merged || true diff --git a/.github/workflows/verify-generated-headers.yml.disabled b/.github/workflows/verify-generated-headers.yml.disabled new file mode 100644 index 000000000..4120f7b7f --- /dev/null +++ b/.github/workflows/verify-generated-headers.yml.disabled @@ -0,0 +1,36 @@ +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.disabled b/.github/workflows/xahau-ga-macos.yml.disabled new file mode 100644 index 000000000..66c7e6877 --- /dev/null +++ b/.github/workflows/xahau-ga-macos.yml.disabled @@ -0,0 +1,149 @@ +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 < 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