-
Notifications
You must be signed in to change notification settings - Fork 198
69 lines (61 loc) · 2.01 KB
/
clang-analysis.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
61
62
63
64
65
66
67
68
69
name: Clang
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '23 13 * * 3'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: sudo apt-get install clang-tools libsnmp-dev
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true
# Run clang analyzer.
#
# Detect if issues were found and upload SARIF report only in that
# case, because reports without entries are not accepted. See
# https://github.com/github/codeql-action/issues/390. The analyzer
# is run twice in order to get a SARIF report as well as an exit
# status when issues are detected, as the scan-build --status-bugs
# parameter doesn't work when the output format is SARIF.
- name: Run analyzer
id: analyze
continue-on-error: true
run: |
cmake -E make_directory ${{github.workspace}}/build.clang
scan-build cmake \
-B ${{github.workspace}}/build.clang \
-S ${{github.workspace}} \
-DPNET_OPTION_SNMP=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release
scan-build \
-sarif \
-o ${{github.workspace}}/sarif \
make \
-C ${{github.workspace}}/build.clang \
-j4
cmake --build ${{github.workspace}}/build.clang --target clean
scan-build \
--status-bugs \
make \
-C ${{github.workspace}}/build.clang \
-j4
- name: Merge results if any
if: steps.analyze.outcome == 'failure'
uses: microsoft/sarif-actions@v0.1
with:
command: 'merge sarif/*/*.sarif'
- name: Upload results if any
if: steps.analyze.outcome == 'failure'
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: ${{github.workspace}}/merged.sarif