From a0a86af56050f047d7e2da2fb1ae53d865a966bd Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 16 Jul 2025 04:27:38 +0200 Subject: [PATCH] Use LLVM apt repository for clang-format-18 --- .github/workflows/format-check-new.yml | 30 +++++++------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/.github/workflows/format-check-new.yml b/.github/workflows/format-check-new.yml index d14207d47..40dd89a36 100644 --- a/.github/workflows/format-check-new.yml +++ b/.github/workflows/format-check-new.yml @@ -11,29 +11,15 @@ jobs: - uses: actions/checkout@v3 - - name: Setup clang-format Docker alias + - name: Install clang-format 18 run: | - # Create a wrapper script for clang-format that uses Docker - cat > /tmp/clang-format-wrapper << 'EOF' - #!/bin/bash - # Convert relative paths to absolute paths and run clang-format in Docker - args=() - for arg in "$@"; do - if [[ "$arg" == /* ]] || [[ "$arg" == -* ]]; then - # Absolute path or option, use as-is - args+=("$arg") - elif [[ -e "$arg" ]]; then - # Relative path that exists, convert to absolute - args+=("$(realpath "$arg")") - else - # Not a file path, use as-is - args+=("$arg") - fi - done - docker run --rm -i -v "$PWD":"$PWD" -w "$PWD" silkeh/clang:18 clang-format "${args[@]}" - EOF - sudo mv /tmp/clang-format-wrapper /usr/local/bin/clang-format - sudo chmod +x /usr/local/bin/clang-format + # Install clang-format-18 from LLVM apt repository + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc + echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list + sudo apt-get update + sudo apt-get install -y clang-format-18 + # Create symlink + sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100 # Verify version clang-format --version