Skip to content

Commit

Permalink
Upgrade clang-format to use version 17.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Aug 20, 2024
1 parent dea5476 commit eded02c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Lint
on: [workflow_dispatch, pull_request]
env:
TERM: xterm-256color
CLANG_VERSION: 17

jobs:
clang-format:
Expand All @@ -11,9 +12,10 @@ jobs:
- name: Install clang-format
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main'
sudo apt update
sudo apt install -y clang-format-14
UBCN=$(lsb_release --short --codename)
sudo add-apt-repository "deb https://apt.llvm.org/${UBCN}/ llvm-toolchain-${UBCN}-${CLANG_VERSION} main"
sudo apt update || true
sudo apt install -y clang-format-${CLANG_VERSION}
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -23,9 +25,8 @@ jobs:

- name: Run clang-format
run: |
output=$(git clang-format-14 --binary=clang-format-14 --diff --commit=origin/dev)
grep '^no modified files to format$' <<< "$output" && exit 0
grep '^clang-format did not modify any files$' <<< "$output" && exit 0
echo "$output"
echo -e "\033[1;31mCode style does not match clang-format"
exit 1
if ! git clang-format-${CLANG_VERSION} --binary=clang-format-${CLANG_VERSION} --diff --commit=origin/dev
then
echo -e "\033[1;31mCode style does not match clang-format"
exit 1
fi

0 comments on commit eded02c

Please sign in to comment.