Skip to content

Commit

Permalink
CI (Alpine Linux): Use ccache
Browse files Browse the repository at this point in the history
The compilation (especially of the C++ objects) is pretty slow with qemu.
Use ccache to speed up build time on subsequent runs.
  • Loading branch information
mmuetzel committed Jun 17, 2024
1 parent fec63ad commit 416011c
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/emulated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,75 @@ 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
run: |
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
Expand Down

0 comments on commit 416011c

Please sign in to comment.