aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/linux-snap.yml
diff options
context:
space:
mode:
authorGravatar Michał Sawicz <michal@sawicz.net>2021-01-06 18:06:17 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-07 17:26:25 -0800
commit4ecb8ba0cc828defad6f4278fac8998ab48a0b23 (patch)
tree29d45961757a6b0b4ba2967515568e450b7f6135 /.github/workflows/linux-snap.yml
parentd2bbe365724a46349e3f41725ade38047da23af3 (diff)
downloadsubsurface-4ecb8ba0cc828defad6f4278fac8998ab48a0b23.tar.gz
[snap] enable ccache in Linux Snap workflow
Also adding `push` to triggering events to populate the cache. Signed-off-by: Michał Sawicz <michal@sawicz.net>
Diffstat (limited to '.github/workflows/linux-snap.yml')
-rw-r--r--.github/workflows/linux-snap.yml25
1 files changed, 25 insertions, 0 deletions
diff --git a/.github/workflows/linux-snap.yml b/.github/workflows/linux-snap.yml
index e1718c55d..325318c0a 100644
--- a/.github/workflows/linux-snap.yml
+++ b/.github/workflows/linux-snap.yml
@@ -28,11 +28,36 @@ jobs:
# Needed for version determination to work
fetch-depth: 0
+ - name: Set up CCache
+ id: setup-ccache
+ run: |
+ sudo apt-get install ccache
+ ccache --max-size=2G
+ sg lxd -c '/snap/bin/lxc profile device add default ccache disk source=${HOME}/.ccache/ path=/root/.ccache'
+
+ # Patch snapcraft.yaml to enable ccache
+ patch -p1 < .github/workflows/linux-snap.patch
+
+ # Find common base between master and HEAD to use as cache key.
+ git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules origin master
+ echo "::set-output name=key::$( git merge-base origin/master ${{ github.sha }} )"
+
+ - name: CCache
+ uses: actions/cache@v2
+ with:
+ key: ccache-${{ runner.os }}-${{ steps.setup-ccache.outputs.key }}
+ restore-keys: |
+ ccache-${{ runner.os }}-
+ path: ~/.ccache/**
+
- name: Build
run: |
# Build the `subsurface` part.
sg lxd -c '/snap/bin/snapcraft build --use-lxd subsurface'
+ - name: Clear CCache stats
+ run: ccache --show-stats --zero-stats
+
- name: Build and verify the snap
id: build-snap
env: