Skip to content

Commit 3019e70

Browse files
committed
Also test clang
Added ccache support and used our pre-built clang to help speed up the build. Also passing -analyzer-config max-nodes=75000 to scan-build now.
1 parent ac70506 commit 3019e70

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

.github/workflows/ci-post-commit-analyzer.yml

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
- 'llvm/**'
1212
- '.github/workflows/ci-post-commit-analyzer.yml'
1313
pull_request:
14+
types:
15+
- opened
16+
- synchronize
17+
- reopened
18+
- closed
1419
paths:
1520
- '.github/workflows/ci-post-commit-analyzer.yml'
1621
schedule:
@@ -28,41 +33,75 @@ jobs:
2833
github.repository_owner == 'llvm' &&
2934
github.event.action != 'closed'
3035
runs-on: ubuntu-22.04
36+
container:
37+
image: 'ghcr.io/llvm/ci-ubuntu-22.04:latest'
3138
env:
3239
LLVM_VERSION: 18
3340
steps:
3441
- name: Checkout Source
3542
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3643

3744
- name: Install Dependencies
45+
env:
46+
DEBIAN_FRONTEND: noninteractive
3847
run: |
39-
sudo echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list
40-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
41-
sudo apt-get update
42-
sudo apt-get install \
48+
apt-get update
49+
apt-get -y install \
50+
wget \
51+
gnupg
52+
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | tee -a /etc/apt/sources.list.d/llvm.list
53+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
54+
apt-get update
55+
apt-get -y install \
4356
cmake \
4457
ninja-build \
4558
perl \
4659
clang-tools-$LLVM_VERSION \
4760
clang-$LLVM_VERSION
4861
62+
- name: Setup ccache
63+
uses: hendrikmuhs/ccache-action@v1
64+
with:
65+
# A full build of llvm, clang, lld, and lldb takes about 250MB
66+
# of ccache space. There's not much reason to have more than this,
67+
# because we usually won't need to save cache entries from older
68+
# builds. Also, there is an overall 10GB cache limit, and each
69+
# run creates a new cache entry so we want to ensure that we have
70+
# enough cache space for all the tests to run at once and still
71+
# fit under the 10 GB limit.
72+
# Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174
73+
max-size: 2G
74+
key: post-commit-analyzer
75+
variant: ccache
76+
4977
- name: Configure
5078
run: |
5179
scan-build-$LLVM_VERSION \
52-
--use-c++=clang++ \
53-
--use-cc=clang \
80+
--use-c++='clang++' \
81+
--use-cc='clang' \
82+
-analyzer-config max-nodes=75000 \
5483
cmake -B build -S llvm -G Ninja \
5584
-DLLVM_ENABLE_ASSERTIONS=ON \
85+
-DLLVM_ENABLE_PROJECTS=clang \
5686
-DLLVM_BUILD_LLVM_DYLIB=ON \
5787
-DLLVM_LINK_LLVM_DYLIB=ON \
5888
-DCMAKE_BUILD_TYPE=Release
5989
6090
- name: Build
6191
run: |
62-
scan-build-$LLVM_VERSION -o analyzer-results --use-c++=clang++ --use-cc=clang ninja -v -C build
92+
# Create symlinks for use with ccache.
93+
ln -s /usr/bin/ccache /usr/local/bin/clang++
94+
ln -s /usr/bin/ccache /usr/local/bin/clang
95+
scan-build-$LLVM_VERSION \
96+
-o analyzer-results \
97+
--use-c++=/usr/local/bin/clang++ \
98+
--use-cc=/usr/local/bin/clang \
99+
-analyzer-config max-nodes=75000 \
100+
ninja -v -C build
63101
64102
- name: Upload Results
65103
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
104+
if: always()
66105
with:
67106
name: analyzer-results
68107
path: 'analyzer-results/**/*'

0 commit comments

Comments
 (0)