forked from LostArtefacts/TRX
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (43 loc) · 1.51 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Run code linters
on:
- push
- pull_request
jobs:
lint:
name: Run code linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Install dependencies
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' | sudo tee -a /etc/apt/sources.list
echo 'deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt-get install -y clang-format-18 iwyu
sudo snap install --edge --classic just
sudo ln -s /usr/bin/clang-format-18 /usr/local/bin/clang-format
sudo apt-get install -y python3-pip
sudo python3 -m pip install pyjson5 pre-commit
- name: Check formatted code differences
run: |
just lint-format || /bin/true
git diff --exit-code || (
clang-format --version
echo 'Please run `just lint` and commit the changes.'
exit 1
)
- name: Check imports
run: |
git add -A
just lint-imports
git diff --exit-code || (
include-what-you-use --version
echo 'Please run `just lint` and commit the changes.'
exit 1
)