mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-05 10:16:54 +08:00
Use LLVM apt repository for clang-format-18
This commit is contained in:
parent
bd3b8186b9
commit
a0a86af560
30
.github/workflows/format-check-new.yml
vendored
30
.github/workflows/format-check-new.yml
vendored
@ -11,29 +11,15 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup clang-format Docker alias
|
- name: Install clang-format 18
|
||||||
run: |
|
run: |
|
||||||
# Create a wrapper script for clang-format that uses Docker
|
# Install clang-format-18 from LLVM apt repository
|
||||||
cat > /tmp/clang-format-wrapper << 'EOF'
|
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
|
||||||
#!/bin/bash
|
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list
|
||||||
# Convert relative paths to absolute paths and run clang-format in Docker
|
sudo apt-get update
|
||||||
args=()
|
sudo apt-get install -y clang-format-18
|
||||||
for arg in "$@"; do
|
# Create symlink
|
||||||
if [[ "$arg" == /* ]] || [[ "$arg" == -* ]]; then
|
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100
|
||||||
# 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
|
|
||||||
# Verify version
|
# Verify version
|
||||||
clang-format --version
|
clang-format --version
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user