ci: cache fairmq compilation with ccache

FairMQ's own sources (library, examples, tests) were recompiled from scratch
in every matrix job on every push.

- add hendrikmuhs/ccache-action to build, sanitizers and static-analysis jobs
- set CMAKE_C/CXX_COMPILER_LAUNCHER=ccache so cmake routes through it
- key the cache per (job, env, gcc) since ccache hashes the compiler
This commit is contained in:
Dennis Klein
2026-05-31 20:58:22 +02:00
committed by Dennis Klein
parent 1186bda040
commit ffc9c60f73

View File

@@ -36,6 +36,12 @@ jobs:
gcc: ${{ matrix.gcc }} gcc: ${{ matrix.gcc }}
env: ${{ matrix.env }} env: ${{ matrix.env }}
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}-${{ matrix.env }}-gcc${{ matrix.gcc }}
max-size: 500M
- name: Configure and Build - name: Configure and Build
uses: threeal/cmake-action@v2 uses: threeal/cmake-action@v2
with: with:
@@ -44,6 +50,8 @@ jobs:
CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_BUILD_TYPE=RelWithDebInfo
CMAKE_INSTALL_PREFIX=${{ github.workspace }}/install CMAKE_INSTALL_PREFIX=${{ github.workspace }}/install
BUILD_TESTING=ON BUILD_TESTING=ON
CMAKE_C_COMPILER_LAUNCHER=ccache
CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Test - name: Test
uses: threeal/ctest-action@v1 uses: threeal/ctest-action@v1
@@ -83,6 +91,12 @@ jobs:
with: with:
gcc: '14' gcc: '14'
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}-${{ matrix.sanitizer.name }}
max-size: 500M
- name: Configure and Build - name: Configure and Build
uses: threeal/cmake-action@v2 uses: threeal/cmake-action@v2
with: with:
@@ -92,6 +106,8 @@ jobs:
options: | options: |
CMAKE_BUILD_TYPE=Debug CMAKE_BUILD_TYPE=Debug
BUILD_TESTING=ON BUILD_TESTING=ON
CMAKE_C_COMPILER_LAUNCHER=ccache
CMAKE_CXX_COMPILER_LAUNCHER=ccache
${{ matrix.sanitizer.options }} ${{ matrix.sanitizer.options }}
- name: Test - name: Test
@@ -116,6 +132,12 @@ jobs:
with: with:
gcc: '14' gcc: '14'
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ github.job }}
max-size: 500M
- name: Configure and Build - name: Configure and Build
uses: threeal/cmake-action@v2 uses: threeal/cmake-action@v2
with: with:
@@ -124,6 +146,8 @@ jobs:
CMAKE_BUILD_TYPE=Debug CMAKE_BUILD_TYPE=Debug
BUILD_TESTING=ON BUILD_TESTING=ON
RUN_STATIC_ANALYSIS=ON RUN_STATIC_ANALYSIS=ON
CMAKE_C_COMPILER_LAUNCHER=ccache
CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Check for warnings - name: Check for warnings
run: | run: |