-
Notifications
You must be signed in to change notification settings - Fork 595
83 lines (77 loc) · 2.42 KB
/
snap-builds.yaml
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
81
82
83
on:
workflow_call:
inputs:
runs-on:
description: 'A json list of tags to indicate which runner to use'
required: true
type: string
toolchain:
description: 'The go toolchain to use {default, FIPS}'
required: true
type: string
variant:
description: 'The type of snapd build {pristine, test}'
required: true
type: string
jobs:
snap-builds:
runs-on: ${{ fromJSON(inputs.runs-on) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set artifact name
id: set_artifact_name
run: |
postfix="${{ inputs.toolchain }}-${{ inputs.variant }}"
if grep -iq "arm64" <<<"${{ inputs.runs-on }}"; then
echo "artifact_name=snap-files-arm64-${postfix}" >> $GITHUB_OUTPUT
else
echo "artifact_name=snap-files-amd64-${postfix}" >> $GITHUB_OUTPUT
fi
- name: Select Go toolchain
run: |
case "${{ inputs.toolchain }}" in
default)
rm -f fips-build
;;
FIPS)
touch fips-build
;;
*)
echo "unknown toolchain ${{ inputs.toolchain }}"
exit 1
;;
esac
case "${{ inputs.variant }}" in
pristine)
rm -f test-build
;;
test)
touch test-build
;;
esac
- name: Build snapd snap
uses: snapcore/action-build@v1
with:
snapcraft-channel: 8.x/stable
snapcraft-args: --verbose
- name: Check built artifact
run: |
unsquashfs snapd*.snap meta/snap.yaml usr/lib/snapd/
if cat squashfs-root/meta/snap.yaml | grep -q "version:.*dirty.*"; then
echo "PR produces dirty snapd snap version"
cat squashfs-root/usr/lib/snapd/dirty-git-tree-info.txt
exit 1
elif cat squashfs-root/usr/lib/snapd/info | grep -q "VERSION=.*dirty.*"; then
echo "PR produces dirty internal snapd info version"
cat squashfs-root/usr/lib/snapd/info
cat squashfs-root/usr/lib/snapd/dirty-git-tree-info.txt
exit 1
fi
- name: Uploading snapd snap artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set_artifact_name.outputs.artifact_name }}
path: "*.snap"