77 description : ' the build mode'
88 type : string
99 required : true
10+ enable_ccache :
11+ description : ' enable ccache for non-reproducibility builds'
12+ type : boolean
13+ default : true
1014 outputs :
1115 md5sum :
1216 description : ' the md5sum for the inherited database executable'
@@ -20,19 +24,55 @@ jobs:
2024 - read-toolchain
2125 runs-on : depot-ubuntu-24.04-8
2226 container : ${{ needs.read-toolchain.outputs.image }}
27+ env :
28+ CCACHE_DIR : ${{ github.workspace }}/.ccache
29+ CCACHE_MAXSIZE : 2G
30+ CCACHE_BASEDIR : ${{ github.workspace }}
31+ CCACHE_NOHASHDIR : true
2332 outputs :
2433 md5sum : ${{ steps.checksum.outputs.md5sum }}
2534 steps :
2635 - uses : actions/checkout@v4
2736 with :
2837 submodules : recursive
38+ - name : Install ccache
39+ if : ${{ inputs.enable_ccache }}
40+ run : |
41+ sudo dnf -y install ccache zstd
42+ - name : Restore ccache
43+ if : ${{ inputs.enable_ccache }}
44+ uses : actions/cache@v4
45+ with :
46+ path : ${{ env.CCACHE_DIR }}
47+ key : ccache-${{ runner.os }}-build-kuebikodb-${{ inputs.build_mode }}-${{ hashFiles('tools/toolchain/image', 'configure.py', 'CMakeLists.txt', 'cmake/**', '.gitmodules') }}-${{ github.run_id }}
48+ restore-keys : |
49+ ccache-${{ runner.os }}-build-kuebikodb-${{ inputs.build_mode }}-${{ hashFiles('tools/toolchain/image', 'configure.py', 'CMakeLists.txt', 'cmake/**', '.gitmodules') }}-
50+ ccache-${{ runner.os }}-build-kuebikodb-${{ inputs.build_mode }}-
51+ ccache-${{ runner.os }}-build-kuebikodb-
52+ - name : Configure ccache
53+ if : ${{ inputs.enable_ccache }}
54+ run : |
55+ mkdir -p "$CCACHE_DIR" "$GITHUB_WORKSPACE/.cache-wrappers"
56+ printf '#!/bin/sh\nexec ccache clang "$@"\n' > "$GITHUB_WORKSPACE/.cache-wrappers/clang"
57+ printf '#!/bin/sh\nexec ccache clang++ "$@"\n' > "$GITHUB_WORKSPACE/.cache-wrappers/clang++"
58+ chmod +x "$GITHUB_WORKSPACE/.cache-wrappers/clang" "$GITHUB_WORKSPACE/.cache-wrappers/clang++"
59+ ccache --max-size="$CCACHE_MAXSIZE"
60+ ccache --zero-stats
2961 - name : Generate the building system
3062 run : |
3163 git config --global --add safe.directory $GITHUB_WORKSPACE
32- ./configure.py --mode ${{ inputs.build_mode }} --with scylla
64+ if [ '${{ inputs.enable_ccache }}' = 'true' ]; then
65+ ./configure.py --mode ${{ inputs.build_mode }} --with scylla --compiler "$GITHUB_WORKSPACE/.cache-wrappers/clang++" --c-compiler "$GITHUB_WORKSPACE/.cache-wrappers/clang"
66+ else
67+ ./configure.py --mode ${{ inputs.build_mode }} --with scylla
68+ fi
3369 - run : |
3470 ninja build/${{ inputs.build_mode }}/scylla
3571 - id : checksum
3672 run : |
3773 checksum=$(md5sum build/${{ inputs.build_mode }}/scylla | cut -c -32)
3874 echo "md5sum=$checksum" >> $GITHUB_OUTPUT
75+ - name : Show ccache stats
76+ if : ${{ always() && inputs.enable_ccache }}
77+ run : |
78+ ccache --show-stats
0 commit comments