Use Docker wrapper for clang-format to avoid library issues

This commit is contained in:
Mario Zechner 2025-07-16 04:39:37 +02:00
parent a1541dfe10
commit c8421648b5

View File

@ -13,19 +13,15 @@ jobs:
- name: Setup clang-format - name: Setup clang-format
run: | run: |
# Install libtinfo5 (required by the Ubuntu 18.04 binary) # Pull the Docker image with clang-format 18
# Create a symlink since Ubuntu 24.04 has libtinfo6 docker pull silkeh/clang:18
sudo apt-get update
sudo apt-get install -y libtinfo6
sudo ln -sf /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5
# Download clang-format 18.1.8 binary directly # Create a wrapper script that runs clang-format in Docker
wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang%2Bllvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04.tar.xz sudo tee /usr/local/bin/clang-format > /dev/null <<'EOF'
tar -xf clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04.tar.xz #!/bin/bash
exec docker run --rm -i -v "$PWD:$PWD" -w "$PWD" silkeh/clang:18 clang-format "$@"
# Install clang-format binary to /usr/bin where it will be found first EOF
sudo cp clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04/bin/clang-format /usr/bin/clang-format sudo chmod +x /usr/local/bin/clang-format
sudo chmod +x /usr/bin/clang-format
# Verify version and location # Verify version and location
which clang-format which clang-format