Skip to content

Commit abcce0a

Browse files
committed
Optimize CI test workflow with caching
- Add ccache to speed up C++ compilation (2-10x faster rebuilds) - Cache build directory between runs - Cache key based on source file hashes (rebuilds only when code changes) - Use LLVM_OPTIMIZED_TABLEGEN for faster initial builds - First run: ~30-40 mins - Subsequent runs with no changes: ~2-5 mins (just cache restore + test) - Subsequent runs with small changes: ~5-10 mins (incremental build) This makes the CI actually usable for regular development!
1 parent a228ce8 commit abcce0a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/test-null-safety.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,42 @@ jobs:
2020
- name: Install dependencies
2121
run: |
2222
sudo apt-get update
23-
sudo apt-get install -y ninja-build cmake build-essential
23+
sudo apt-get install -y ninja-build cmake build-essential ccache
24+
25+
- name: Setup ccache
26+
uses: hendrikmuhs/[email protected]
27+
with:
28+
key: ${{ github.job }}-${{ runner.os }}
29+
max-size: 2G
30+
31+
- name: Cache build artifacts
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
build
36+
key: ${{ runner.os }}-clang-build-${{ hashFiles('llvm/**', 'clang/**') }}
37+
restore-keys: |
38+
${{ runner.os }}-clang-build-
2439
2540
- name: Configure build
2641
run: |
42+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
2743
mkdir -p build
2844
cd build
2945
cmake -G Ninja \
3046
-DCMAKE_BUILD_TYPE=Release \
47+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
48+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
3149
-DLLVM_ENABLE_PROJECTS="clang" \
3250
-DLLVM_TARGETS_TO_BUILD="X86" \
3351
-DLLVM_ENABLE_ASSERTIONS=ON \
52+
-DLLVM_OPTIMIZED_TABLEGEN=ON \
3453
-DLLVM_INCLUDE_TESTS=ON \
3554
../llvm
3655
3756
- name: Build Clang and test tools
3857
run: |
58+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
3959
cd build
4060
ninja clang FileCheck count not
4161

0 commit comments

Comments
 (0)