-
Notifications
You must be signed in to change notification settings - Fork 582
343 lines (324 loc) · 11 KB
/
test.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
name: Tests
on:
pull_request:
branches: [ "master", "release/**", "core-snap-security-release/**", "security-release/**" ]
push:
branches: [ "master", "release/**", "core-snap-security-release/**", "security-release/**" ]
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
snap-builds:
uses: ./.github/workflows/snap-builds.yaml
with:
runs-on: ubuntu-22.04
toolchain: ${{ matrix.toolchain }}
variant: ${{ matrix.variant }}
strategy:
matrix:
toolchain:
- default
- FIPS
variant:
# test version is a build of snapd with test keys and should
# only be installed by test runners. The pristine versions
# are the build that should be installed by human users.
- pristine
- test
cache-build-deps:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# needed for git commit history
fetch-depth: 0
# NOTE: checkout the code in a fixed location, even for forks, as this
# is relevant for go's import system.
path: ./src/github.com/snapcore/snapd
# Fetch base ref, needed for golangci-lint
- name: Fetching base ref ${{ github.base_ref }}
run: |
cd ${{ github.workspace }}/src/github.com/snapcore/snapd
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
# golang latest ensures things work on the edge
- name: Download Debian dependencies
run: |
sudo apt clean
sudo apt update
sudo apt build-dep -d -y ${{ github.workspace }}/src/github.com/snapcore/snapd
# for indent
sudo apt install texinfo autopoint
- name: Copy dependencies
run: |
sudo tar cvf cached-apt.tar /var/cache/apt
- name: upload Debian dependencies
uses: actions/upload-artifact@v4
with:
name: debian-dependencies
path: ./cached-apt.tar
static-checks:
uses: ./.github/workflows/static-checks.yaml
needs: [cache-build-deps]
with:
runs-on: ubuntu-latest
gochannel: ${{ matrix.gochannel }}
strategy:
# we cache successful runs so it's fine to keep going
fail-fast: false
matrix:
gochannel:
- 1.18
- latest/stable
branch-static-checks:
runs-on: ubuntu-latest
needs: [cache-build-deps]
if: github.ref != 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# needed for git commit history
fetch-depth: 0
- name: check-branch-ubuntu-daily-spread
run: |
# Compare the daily system in master and in the current branch
wget -q -O test_master.yaml https://raw.githubusercontent.com/snapcore/snapd/master/.github/workflows/test.yaml
system_daily="$(yq '.jobs.spread.strategy.matrix.include.[] | select(.group == "ubuntu-daily") | .systems' test_master.yaml)"
current_daily="$(yq '.jobs.spread.strategy.matrix.include.[] | select(.group == "ubuntu-daily") | .systems' .github/workflows/test.yaml)"
test "$system_daily" == "$current_daily"
shell: bash
unit-tests:
uses: ./.github/workflows/unit-tests.yaml
needs: [static-checks]
with:
runs-on: ubuntu-22.04
gochannel: ${{ matrix.gochannel }}
unit-scenario: ${{ matrix.unit-scenario }}
strategy:
# we cache successful runs so it's fine to keep going
fail-fast: false
matrix:
gochannel:
- 1.18
- latest/stable
unit-scenario:
- normal
# TODO run unit tests of C code
unit-tests-special:
uses: ./.github/workflows/unit-tests.yaml
needs: [static-checks]
with:
runs-on: ubuntu-22.04
gochannel: ${{ matrix.gochannel }}
unit-scenario: ${{ matrix.unit-scenario }}
strategy:
# we cache successful runs so it's fine to keep going
fail-fast: false
matrix:
gochannel:
- 1.18
- latest/stable
unit-scenario:
- snapd_debug
- withbootassetstesting
- nosecboot
- faultinject
- race
- snapdusergo
unit-tests-cross-distro:
uses: ./.github/workflows/unit-tests-cross-distro.yaml
needs: [static-checks]
with:
runs-on: ubuntu-latest
distro: ${{ matrix.distro }}
strategy:
fail-fast: false
matrix:
distro:
# TODO add arch?
- fedora:latest
- opensuse/tumbleweed
code-coverage:
needs: [unit-tests, unit-tests-special]
runs-on: ubuntu-20.04
env:
GOPATH: ${{ github.workspace }}
# Set PATH to ignore the load of magic binaries from /usr/local/bin And
# to use the go snap automatically. Note that we install go from the
# snap in a step below. Without this we get the GitHub-controlled latest
# version of go.
PATH: /snap/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:${{ github.workspace }}/bin
GOROOT: ""
steps:
- name: Download the coverage files
uses: actions/download-artifact@v4
with:
pattern: coverage-files-*
path: .coverage/
merge-multiple: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
# uploading to codecov occasionally fails, so continue running the test
# workflow regardless of the upload
continue-on-error: true
with:
fail_ci_if_error: true
flags: unittests
name: codecov-umbrella
files: .coverage/coverage-*.cov
verbose: true
spread:
uses: ./.github/workflows/spread-tests.yaml
needs: [unit-tests, snap-builds]
name: "spread ${{ matrix.group }}"
with:
# Github doesn't support passing sequences as parameters.
# Instead here we create a json array and pass it as a string.
# Then in the spread workflow it turns it into a sequence
# using the fromJSON expression.
runs-on: '["self-hosted", "spread-enabled"]'
group: ${{ matrix.group }}
backend: ${{ matrix.backend }}
systems: ${{ matrix.systems }}
tasks: ${{ matrix.tasks }}
rules: ${{ matrix.rules }}
strategy:
# FIXME: enable fail-fast mode once spread can cancel an executing job.
# Disable fail-fast mode as it doesn't function with spread. It seems
# that cancelling tasks requires short, interruptible actions and
# interrupting spread, notably, does not work today. As such disable
# fail-fast while we tackle that problem upstream.
fail-fast: false
matrix:
include:
- group: amazon-linux
backend: google-distro-1
systems: 'amazon-linux-2-64 amazon-linux-2023-64'
tasks: 'tests/...'
rules: 'main'
- group: arch-linux
backend: google-distro-2
systems: 'arch-linux-64'
tasks: 'tests/...'
rules: 'main'
- group: centos
backend: google-distro-2
systems: 'centos-9-64'
tasks: 'tests/...'
rules: 'main'
- group: debian-req
backend: google-distro-1
systems: 'debian-11-64'
tasks: 'tests/...'
rules: 'main'
- group: debian-not-req
backend: google-distro-1
systems: 'debian-12-64 debian-sid-64'
tasks: 'tests/...'
rules: 'main'
- group: fedora
backend: openstack
systems: 'fedora-40-64 fedora-41-64'
tasks: 'tests/...'
rules: 'main'
- group: opensuse
backend: google-distro-2
systems: 'opensuse-15.5-64 opensuse-15.6-64 opensuse-tumbleweed-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-trusty
backend: google
systems: 'ubuntu-14.04-64'
tasks: 'tests/smoke/ tests/main/canonical-livepatch tests/main/canonical-livepatch-14.04'
rules: 'trusty'
- group: ubuntu-xenial-bionic
backend: google
systems: 'ubuntu-16.04-64 ubuntu-18.04-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-focal-jammy
backend: google
systems: 'ubuntu-20.04-64 ubuntu-22.04-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-noble
backend: google
systems: 'ubuntu-24.04-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-no-lts
backend: google
systems: ''
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-daily
backend: google
systems: 'ubuntu-24.10-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-core-16
backend: google-core
systems: 'ubuntu-core-16-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-core-18
backend: google-core
systems: 'ubuntu-core-18-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-core-20
backend: google-core
systems: 'ubuntu-core-20-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-core-22
backend: google-core
systems: 'ubuntu-core-22-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-core-24
backend: google-core
systems: 'ubuntu-core-24-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-arm
backend: google-arm
systems: 'ubuntu-20.04-arm-64 ubuntu-core-22-arm-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-secboot
backend: google
systems: 'ubuntu-secboot-20.04-64'
tasks: 'tests/...'
rules: 'main'
- group: ubuntu-fips
backend: google-pro
systems: 'ubuntu-fips-22.04-64'
tasks: 'tests/fips/...'
rules: 'main'
- group: nested-ubuntu-16.04
backend: google-nested
systems: 'ubuntu-16.04-64'
tasks: 'tests/nested/...'
rules: 'nested'
- group: nested-ubuntu-18.04
backend: google-nested
systems: 'ubuntu-18.04-64'
tasks: 'tests/nested/...'
rules: 'nested'
- group: nested-ubuntu-20.04
backend: google-nested
systems: 'ubuntu-20.04-64'
tasks: 'tests/nested/...'
rules: 'nested'
- group: nested-ubuntu-22.04
backend: google-nested
systems: 'ubuntu-22.04-64'
tasks: 'tests/nested/...'
rules: 'nested'
- group: nested-ubuntu-24.04
backend: google-nested
systems: 'ubuntu-24.04-64'
tasks: 'tests/nested/...'
rules: 'nested'