diff --git a/.github/workflows/format-check-new.yml b/.github/workflows/format-check-new.yml index 1ea00fb1d..7d09e19e0 100644 --- a/.github/workflows/format-check-new.yml +++ b/.github/workflows/format-check-new.yml @@ -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 diff --git a/formatters/setup-clang-format-docker.sh b/formatters/setup-clang-format-docker.sh new file mode 100755 index 000000000..c0c57e033 --- /dev/null +++ b/formatters/setup-clang-format-docker.sh @@ -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 \ No newline at end of file