Add setup script for Docker clang-format wrapper

This commit is contained in:
Mario Zechner 2025-07-16 04:40:37 +02:00
parent c8421648b5
commit aaaa3f8f35
2 changed files with 25 additions and 14 deletions

View File

@ -12,20 +12,7 @@ jobs:
- uses: actions/checkout@v3
- name: Setup clang-format
run: |
# Pull the Docker image with clang-format 18
docker pull silkeh/clang:18
# Create a wrapper script that runs clang-format in Docker
sudo tee /usr/local/bin/clang-format > /dev/null <<'EOF'
#!/bin/bash
exec docker run --rm -i -v "$PWD:$PWD" -w "$PWD" silkeh/clang:18 clang-format "$@"
EOF
sudo chmod +x /usr/local/bin/clang-format
# Verify version and location
which clang-format
clang-format --version
run: ./formatters/setup-clang-format-docker.sh
- name: Install dotnet
uses: actions/setup-dotnet@v3

View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
echo "Setting up clang-format Docker wrapper..."
# Pull the Docker image with clang-format 18
echo "Pulling Docker image..."
docker pull silkeh/clang:18
# Create a wrapper script that runs clang-format in Docker
echo "Creating wrapper script..."
cat > /tmp/clang-format-wrapper <<'EOF'
#!/bin/bash
exec docker run --rm -i -v "$PWD:$PWD" -w "$PWD" silkeh/clang:18 clang-format "$@"
EOF
# Install the wrapper
sudo mv /tmp/clang-format-wrapper /usr/local/bin/clang-format
sudo chmod +x /usr/local/bin/clang-format
# Verify version and location
echo "Verifying installation..."
which clang-format
clang-format --version