Skip to content

Commit 2a7b8b7

Browse files
committed
[workflows] Add post-commit job that runs the clang static analyzer
OpenSSF Best Practices recoomends running a static analyzer on software before it is released: https://www.bestpractices.dev/en/criteria/0#0.static_analysis
1 parent 1af0778 commit 2a7b8b7

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Post-Commit Static Analyzer
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- 'release/**'
10+
paths:
11+
- 'llvm/**'
12+
pull_request:
13+
paths:
14+
- '.github/workflows/ci-post-commit-analyzer.yml'
15+
schedule:
16+
- cron: '30 0 * * *'
17+
18+
concurrency:
19+
group: >-
20+
llvm-project-${{ github.workflow }}-${{ github.event_name == 'pull_request' &&
21+
( github.event.pull_request.number || github.ref) }}
22+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
23+
24+
jobs:
25+
post-commit-analyzer:
26+
if: >-
27+
github.repository_owner == 'llvm' &&
28+
github.event.action != 'closed'
29+
runs-on: ubuntu-22.04
30+
steps:
31+
- name: Checkout Source
32+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
33+
34+
- name: Install Dependencies
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install \
38+
cmake \
39+
ninja-build \
40+
perl \
41+
clang-tools \
42+
clang
43+
44+
- name: Configure
45+
run: |
46+
scan-build \
47+
--use-c++=clang++ \
48+
--use-cc=clang \
49+
cmake -B build -S llvm -G Ninja \
50+
-DLLVM_ENABLE_ASSERTIONS=ON \
51+
-DLLVM_BUILD_LLVM_DYLIB=ON \
52+
-DLLVM_LINK_LLVM_DYLIB=ON \
53+
-DCMAKE_BUILD_TYPE=Release
54+
55+
- name: Build
56+
run: |
57+
scan-build -o analyzer-results --use-c++=clang++ --use-cc=clang ninja -v -C build
58+
59+
- name: Upload Results
60+
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
61+
with:
62+
name: analyzer-results
63+
path: 'analyzer-results/**/*'
64+

0 commit comments

Comments
 (0)