forked from subsurface/subsurface
-
Notifications
You must be signed in to change notification settings - Fork 66
80 lines (64 loc) · 2.04 KB
/
linux-snap.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Linux Snap
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
Snap:
runs-on: ubuntu-latest
env:
SNAPCRAFT_BUILD_INFO: 1
timeout-minutes: 60
steps:
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v1
- name: Setup LXD
uses: whywaita/setup-lxd@v1
- name: Check out code
uses: actions/checkout@v2
with:
# 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
/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.
/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:
SNAP_ENFORCE_RESQUASHFS: 0
run: |
# Actually build the snap.
/snap/bin/snapcraft --use-lxd
sudo snap install review-tools
/snap/bin/review-tools.snap-review *.snap
echo "::set-output name=snap-file::$( ls *.snap )"
- name: Upload the snap
uses: actions/upload-artifact@v2
with:
name: ${{ steps.build-snap.outputs.snap-file }}
path: ${{ steps.build-snap.outputs.snap-file }}
if-no-files-found: error