CI (Alpine Linux): Use ccache
The compilation (especially of the C++ objects) is pretty slow with qemu. Use ccache to speed up build time on subsequent runs.
This commit is contained in:
@@ -38,23 +38,56 @@ jobs:
|
||||
packages: >
|
||||
bash
|
||||
build-base
|
||||
ccache
|
||||
cmake
|
||||
gfortran
|
||||
eigen-dev
|
||||
lapack-dev
|
||||
|
||||
- name: prepare ccache
|
||||
# create key with human readable timestamp
|
||||
# used in action/cache/restore and action/cache/save steps
|
||||
id: ccache-prepare
|
||||
run: |
|
||||
echo "key=ccache:alpine:${{ matrix.arch }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: restore ccache
|
||||
# setup the GitHub cache used to maintain the ccache from one job to the next
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
# location of the ccache of the chroot in the root file system
|
||||
path: /home/runner/rootfs/alpine-latest-${{ matrix.arch }}/home/runner/.ccache
|
||||
key: ${{ steps.ccache-prepare.outputs.key }}
|
||||
# Prefer caches from the same branch. Fall back to caches from the default branch.
|
||||
restore-keys: |
|
||||
ccache:alpine:${{ matrix.arch }}:${{ github.ref }}
|
||||
ccache:alpine:${{ matrix.arch }}
|
||||
|
||||
- name: configure ccache
|
||||
env:
|
||||
CCACHE_MAX: ${{ matrix.ccache-max }}
|
||||
run: |
|
||||
test -d ~/.ccache || mkdir ~/.ccache
|
||||
echo "max_size = 20M" >> ~/.ccache/ccache.conf
|
||||
echo "compression = true" >> ~/.ccache/ccache.conf
|
||||
ccache -s
|
||||
which ccache
|
||||
|
||||
- name: configure
|
||||
run: |
|
||||
echo "gcc --version"
|
||||
gcc --version
|
||||
echo "gcc -dumpmachine"
|
||||
gcc -dumpmachine
|
||||
echo " "
|
||||
mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build
|
||||
cmake \
|
||||
-DEXAMPLES=ON \
|
||||
-DMPI=OFF \
|
||||
-DICB=ON \
|
||||
-DEIGEN=ON \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
|
||||
..
|
||||
|
||||
- name: build
|
||||
@@ -62,6 +95,18 @@ jobs:
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
cmake --build .
|
||||
|
||||
- name: ccache status
|
||||
continue-on-error: true
|
||||
run: ccache -s
|
||||
|
||||
- name: save ccache
|
||||
# Save the cache after we are done (successfully) building
|
||||
# This helps to retain the ccache even if the subsequent steps are failing.
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: /home/runner/rootfs/alpine-latest-${{ matrix.arch }}/home/runner/.ccache
|
||||
key: ${{ steps.ccache-prepare.outputs.key }}
|
||||
|
||||
- name: test
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
|
||||
Reference in New Issue
Block a user