Use GHA caching with ccache

develop
Kelvie Wong 2023-01-24 19:27:12 -08:00
parent a496f88a29
commit 5227d29f1f
2 changed files with 10 additions and 0 deletions

@ -134,6 +134,14 @@ jobs:
with: with:
submodules: true submodules: true
fetch-depth: 0 fetch-depth: 0
- name: Fetch ccache
uses: actions/cache@v3
with:
path: build/win64-cross/ccache
key: ccache-win64-cross-msvc-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
ccache-win64-cross-msvc-${{ github.ref_name }}
ccache-win64-cross-msvc
- name: Cross-compile win64 artifacts - name: Cross-compile win64 artifacts
run: | run: |
cd build cd build

@ -13,6 +13,7 @@ builder_uid=$(id -u)
mkdir -p win64-cross mkdir -p win64-cross
mkdir -p win64-cross/output mkdir -p win64-cross/output
mkdir -p win64-cross/ccache
# Check for sudo; we want to use the real user # Check for sudo; we want to use the real user
if [[ $(id -u) -eq 0 ]]; then if [[ $(id -u) -eq 0 ]]; then
@ -39,6 +40,7 @@ fi
# the Dockerfile # the Dockerfile
if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/build \ if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/build \
-e BUILDER_UID=$builder_uid \ -e BUILDER_UID=$builder_uid \
-e CCACHE_DIR=/src/build/ccache \
--name dfhack-win \ --name dfhack-win \
ghcr.io/dfhack/build-env:msvc \ ghcr.io/dfhack/build-env:msvc \
bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output cmake .. -DBUILD_DOCS=1 && dfhack-make -j$jobs install" \ bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output cmake .. -DBUILD_DOCS=1 && dfhack-make -j$jobs install" \