chore: integrate sccache (#1738)

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2023-08-25 10:58:11 +03:00 committed by GitHub
parent 3520697b22
commit 7d619d2d4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,9 @@ jobs:
compiler: {cxx: clang++, c: clang}
cxx_flags: ""
timeout-minutes: 30
env:
SCCACHE_GHA_ENABLED: "true"
container:
image: ghcr.io/romange/${{ matrix.container }}
credentials:
@ -60,19 +63,16 @@ jobs:
uname -a
cmake --version
mkdir -p ${{github.workspace}}/build
if [ "${{matrix.compiler.c}}" = "clang" ]; then
apk update && apk add clang
fi
- name: Cache build deps
id: cache-deps
uses: actions/cache@v3
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Configure Cache Env
uses: actions/github-script@v6
with:
path: |
~/.ccache
${{github.workspace}}/build/_deps
key: ${{ runner.os }}-deps-${{ github.base_ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-deps-${{ github.base_ref }}-
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '')
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
@ -83,7 +83,7 @@ jobs:
-GNinja \
-DCMAKE_C_COMPILER="${{matrix.compiler.c}}" \
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \
-L
cd ${{github.workspace}}/build && pwd
@ -92,7 +92,7 @@ jobs:
run: |
cd ${{github.workspace}}/build
ninja src/all
ccache --show-stats
${SCCACHE_PATH} --show-stats
- name: Test
run: |