From 5227d29f1fe7693703ad9b9bcebaaf384d200243 Mon Sep 17 00:00:00 2001 From: Kelvie Wong Date: Tue, 24 Jan 2023 19:27:12 -0800 Subject: [PATCH] Use GHA caching with ccache --- .github/workflows/build.yml | 8 ++++++++ build/build-win64-from-linux.sh | 2 ++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7aeddc70..9b8892882 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -134,6 +134,14 @@ jobs: with: submodules: true 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 run: | cd build diff --git a/build/build-win64-from-linux.sh b/build/build-win64-from-linux.sh index 65c9f2f58..eb366e83e 100755 --- a/build/build-win64-from-linux.sh +++ b/build/build-win64-from-linux.sh @@ -13,6 +13,7 @@ builder_uid=$(id -u) mkdir -p win64-cross mkdir -p win64-cross/output +mkdir -p win64-cross/ccache # Check for sudo; we want to use the real user if [[ $(id -u) -eq 0 ]]; then @@ -39,6 +40,7 @@ fi # the Dockerfile if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/build \ -e BUILDER_UID=$builder_uid \ + -e CCACHE_DIR=/src/build/ccache \ --name dfhack-win \ 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" \