-
Notifications
You must be signed in to change notification settings - Fork 42
94 lines (82 loc) · 2.86 KB
/
clang-tidy.yaml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This action pushes the output of clang-tidy to Codacy
# See https://github.com/codacy/codacy-clang-tidy
name: clang-tidy-review
on:
# We need to run on pull_request_target to gain access to secrets (for the
# Codacy token).
pull_request_target: {}
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.run_id }}-clang-tidy
cancel-in-progress: true
jobs:
run:
# Unprivileged action that runs clang-tidy and produces report.json in
# Codacy format.
name: Run clang-tidy
permissions: {} # Security: run cmake from a fully unprivileged context
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install \
clang \
cmake \
ninja-build \
python3 \
gettext \
qtbase5-dev \
libqt5svg5-dev \
libkf5archive-dev \
liblua5.3-dev \
libsqlite3-dev \
libsdl2-mixer-dev
export CC=$(which clang)
export CXX=$(which clang++)
- name: Configure
run: |
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
# We need to build to get all the generated files (*.ui, *_gen.h, ...)
- name: Build
run: |
cmake --build build
- name: Install Codacy Tools
run: |
sudo apt install ansifilter
wget -O codacy-clang-tidy https://github.com/codacy/codacy-clang-tidy/releases/download/1.3.8/codacy-clang-tidy-linux-1.3.8
chmod +x codacy-clang-tidy
- name: Run clang-tidy
run: |
run-clang-tidy -header-filter=".*" -p build \
| ansifilter \
| ./codacy-clang-tidy >report.json
- uses: actions/upload-artifact@v4
with:
name: clang-tidy-report
path: report.json
upload:
# Privileged action to upload to Codacy. Do the strict minimum here to
# minimize exposure.
name: Upload
needs: run
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
name: clang-tidy-report
- name: Upload Results
env:
COMMIT: ${{ github.event.pull_request.head.sha }}
PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: |
curl -XPOST -L -H "project-token: $PROJECT_TOKEN" \
-H "Content-type: application/json" -d @- \
"https://api.codacy.com/2.0/commit/$COMMIT/issuesRemoteResults" \
<report.json
curl -XPOST -L -H "project-token: $PROJECT_TOKEN" \
-H "Content-type: application/json" \
"https://api.codacy.com/2.0/commit/$COMMIT/resultsFinal"