-
Notifications
You must be signed in to change notification settings - Fork 1.2k
60 lines (53 loc) · 2.16 KB
/
clang-tidy-review.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
49
50
51
52
53
54
55
56
57
58
59
60
name: Clang-tidy review
on:
pull_request:
jobs:
build:
name: Clang tidy review
runs-on: ubuntu-latest
container: zephyrprojectrtos/ci:v0.26.4
env:
CMAKE_PREFIX_PATH: /opt/toolchains
steps:
- name: Checkout the code
uses: actions/checkout@v2
with:
path: ncs/nrf
fetch-depth: 2
- name: Install deps
run: |
apt-get update
apt-get install -y jq clang-tidy ruby-full
# The docker image comes pre-initialized with west dependencies. We want to do west update ourselves to to be sure that we get the latest changes in all repos.
# The docker image is built nightly. So it may contain slightly out of date repos.
# Hence we remove the .west folder and do a re-init
- name: West init and update
run: |
rm -rf /workdir/.west/
west init -l ncs/nrf
cd ncs
west update --narrow -o=--depth=1
- name: Build native_posix tests (via sonarcloud build wrapper)
shell: bash
run: |
source ncs/zephyr/zephyr-env.sh
ncs/zephyr/scripts/twister -b -v -i -s applications.asset_tracker_v2.aws -T ncs/nrf/applications/asset_tracker_v2 -p native_posix
#- name: Use jq to combine compile_commands.json files
# run: |
# jq -s 'map(.[])' twister-out/**/compile_commands.json > compile_commands.json
- name: Analyze
shell: bash
working-directory: ncs/nrf/
run: |
git diff -U0 HEAD^ | clang-tidy-diff -p1 -path ../../twister-out/native_posix/applications.asset_tracker_v2.aws -export-fixes clang-tidy-result/fixes.yml
- name: Run clang-tidy-pr-comments action
uses: platisd/clang-tidy-pr-comments@master
with:
# The GitHub token (or a personal access token)
github_token: ${{ secrets.GITHUB_TOKEN }}
# The path to the clang-tidy fixes generated previously
clang_tidy_fixes: ncs/nrf/clang-tidy-result/fixes.yml
# Optionally set the number of comments per review
# to avoid GitHub API timeouts for heavily loaded
# pull requests
suggestions_per_comment: 10