Skip to content

Commit 4f571d6

Browse files
committed
Add lint workflow for clang-format
1 parent 1529686 commit 4f571d6

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/lint.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Lint
2+
on: [workflow_dispatch, pull_request]
3+
env:
4+
TERM: xterm-256color
5+
CLANG_VERSION: 19
6+
7+
jobs:
8+
clang-format:
9+
name: Clang-Format
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Install clang-format
13+
run: |
14+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
15+
UBCN=$(lsb_release --short --codename)
16+
sudo add-apt-repository "deb https://apt.llvm.org/${UBCN}/ llvm-toolchain-${UBCN}-${CLANG_VERSION} main"
17+
sudo apt update || true
18+
sudo apt install -y clang-format-${CLANG_VERSION}
19+
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
lfs: true
25+
26+
- name: Run clang-format
27+
run: |
28+
if ! git clang-format-${CLANG_VERSION} --binary=clang-format-${CLANG_VERSION} --diff --commit=origin/dev
29+
then
30+
echo -e "\033[1;31mCode style does not match clang-format"
31+
exit 1
32+
fi

0 commit comments

Comments
 (0)