Skip to content

Commit 07822c8

Browse files
cdeckerrustyrussell
authored andcommitted
ci: Enable sccache compiler cache for Rust and C
[ Cherry-picked from another PR, and read the docs which say you have to set SCCACHE_GHA_ENABLED to get inter-job caching! --RR ]
1 parent 657d1ab commit 07822c8

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ env:
1717
CI_SERVER_URL: "http://35.239.136.52:3170"
1818
PYTEST_OPTS_BASE: "-vvv --junit-xml=report.xml --timeout=1800 --durations=10"
1919
TEST_LOG_IGNORE_ERRORS: "1"
20+
SCCACHE_GHA_ENABLED: "true"
2021

2122
jobs:
2223
prebuild:
@@ -151,16 +152,21 @@ jobs:
151152
run: |
152153
bash -x .github/scripts/setup.sh
153154
155+
- name: Setup sccache
156+
uses: mozilla-actions/sccache-action@v0.0.9
157+
- run: sccache --zero-stats
158+
154159
- name: Build
155160
env:
156161
COMPILER: ${{ matrix.COMPILER }}
157162
ASAN: ${{ matrix.ASAN }}
158163
UBSAN: ${{ matrix.UBSAN }}
159164
VALGRIND: ${{ matrix.VALGRIND }}
160165
COMPAT: 1
166+
RUSTC_WRAPPER: sccache
161167
run: |
162168
set -e
163-
./configure ${{ matrix.DEBUG_BUILD }} CC="$COMPILER" ${{ matrix.COPTFLAGS_VAR }}
169+
./configure ${{ matrix.DEBUG_BUILD }} CC="sccache $COMPILER" ${{ matrix.COPTFLAGS_VAR }}
164170
165171
uv run make -j $(nproc) testpack.tar.gz
166172
@@ -208,10 +214,16 @@ jobs:
208214
find . -type f -print0 | xargs -0 touch -d yesterday
209215
tar xaf cln-${{ matrix.CFG }}.tar.gz
210216
217+
- name: Setup sccache
218+
uses: mozilla-actions/sccache-action@v0.0.9
219+
- run: sccache --zero-stats
220+
211221
- name: Check
212222
run: |
213223
uv run eatmydata make -j $(nproc) check-source-bolt check-python check-gen-updated check-doc CARGO=false CC=devtools/cc-nobuild SUPPRESS_GENERATION=1
214224
- name: Check rust packages
225+
env:
226+
RUSTC_WRAPPER: sccache
215227
run: cargo test --all
216228

217229
check-units:
@@ -264,6 +276,10 @@ jobs:
264276
find . -type f -print0 | xargs -0 touch -d yesterday
265277
tar xaf cln-${{ matrix.CFG }}.tar.gz
266278
279+
# external/Makefile uses `TARGET_DIR := external/build-$(shell ${CC} -dumpmachine)` so we need sccache to "work" for that.
280+
- name: Setup sccache
281+
uses: mozilla-actions/sccache-action@v0.0.9
282+
267283
- name: Check
268284
run: |
269285
uv run eatmydata make -j $(nproc) check-units installcheck VALGRIND=${{ matrix.VALGRIND }} CARGO=false CC=devtools/cc-nobuild SUPPRESS_GENERATION=1
@@ -291,9 +307,15 @@ jobs:
291307
run: |
292308
bash -x .github/scripts/setup.sh
293309
310+
- name: Setup sccache
311+
uses: mozilla-actions/sccache-action@v0.0.9
312+
- run: sccache --zero-stats
313+
294314
- name: Build
315+
env:
316+
RUSTC_WRAPPER: sccache
295317
run: |
296-
./configure --enable-debugbuild --enable-fuzzing --enable-address-sanitizer --enable-ub-sanitizer --disable-valgrind CC=clang
318+
./configure --enable-debugbuild --enable-fuzzing --enable-address-sanitizer --enable-ub-sanitizer --disable-valgrind CC="sccache clang"
297319
uv run make -j $(nproc) check-fuzz
298320
299321
check-downgrade:

0 commit comments

Comments
 (0)