-
Notifications
You must be signed in to change notification settings - Fork 98
302 lines (258 loc) · 9.71 KB
/
Copy pathtests.yml
File metadata and controls
302 lines (258 loc) · 9.71 KB
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
---
name: Tests
# NOTE(mhayden): Restricting branches prevents jobs from being doubled since
# a push to a pull request triggers two events.
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- "*"
push:
branches:
- main
# for merge queue
merge_group:
jobs:
unit-tests-fedora:
strategy:
matrix:
fedora_version:
- name: previous
version: 43
- name: current
version: 44
# Enable this when we get osbuild rpm builds for Fedora 44
# - name: rawhide
# version: rawhide
# continue-on-error: true
fail-fast: false # if one fails, keep the other(s) running
name: "🛃 Unit tests (Fedora ${{ matrix.fedora_version.name }})"
runs-on: ubuntu-24.04
container:
image: registry.fedoraproject.org/fedora:${{ matrix.fedora_version.version }}
options: --privileged
continue-on-error: ${{ matrix.continue-on-error || false }}
env:
# workaround for expired cert at source of indirect dependency
# (go.opencensus.io/trace)
GOPROXY: "https://proxy.golang.org|direct"
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
set-safe-directory: true
- name: Install python3
# The Fedora container doesn't have python3 installed by default
run: dnf -y install python3
- name: Set up repository for pinned osbuild commit
run: ./test/scripts/setup-osbuild-repo
- name: Install test dependencies
run: ./test/scripts/install-dependencies
- name: Mark the working directory as safe for git
run: git config --global --add safe.directory "$(pwd)"
- name: Run unit tests
# Skip tests that resolve manifests from local container storage.
# They are tested separately (see gitlab-ci.yml)
run: go test -count=1 -race -timeout 20m ./... -test.skip 'TestBlockingResolverLocalManifest|TestResolverLocalManifest|TestGetManifestLocal'
- name: Run depsolver tests with force-dnf to make sure it's not skipped
run: go test -count=1 -race ./pkg/depsolvednf/... -force-dnf
- name: Run depsolver tests with dnf5
run: |
sudo sed -i 's/"use_dnf5": false/"use_dnf5": true/' /usr/lib/osbuild/solver.json
go test -count=1 -race ./pkg/depsolvednf/... -force-dnf
unit-tests-cs:
strategy:
matrix:
centos_stream:
- version: 9
image_tag: stream9
- version: 10
image_tag: stream10
fail-fast: false # if one fails, keep the other(s) running
name: "🛃 Unit tests (CentOS Stream ${{ matrix.centos_stream.version }})"
runs-on: ubuntu-24.04
container:
image: quay.io/centos/centos:${{ matrix.centos_stream.image_tag }}
options: --privileged
env:
GOFLAGS: "-tags=exclude_graphdriver_btrfs"
# workaround for expired cert at source of indirect dependency
# (go.opencensus.io/trace)
GOPROXY: "https://proxy.golang.org|direct"
steps:
- name: Install dnf plugins
run: dnf -y install dnf-plugins-core
- name: Enable crb repo
run: dnf config-manager --set-enabled crb
- name: Check out code into the Go module directory
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
set-safe-directory: true
- name: Set up repository for pinned osbuild commit
run: ./test/scripts/setup-osbuild-repo
- name: Install build and test dependencies
run: dnf -y install krb5-devel libvirt-devel gcc git-core go gpgme-devel osbuild-depsolve-dnf device-mapper-devel
- name: Mark the working directory as safe for git
run: git config --global --add safe.directory "$(pwd)"
- name: Install openssl for cgo test below
run: dnf -y install openssl
- name: Run unit tests
run: make test
lint:
name: "⌨ Lint"
runs-on: ubuntu-24.04
env:
# workaround for expired cert at source of indirect dependency
# (go.opencensus.io/trace)
GOPROXY: "https://proxy.golang.org|direct"
steps:
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: "1.24.12"
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
set-safe-directory: true
- name: Apt update
run: sudo apt update
# This is needed to lint internal/upload/koji package
- name: Install kerberos devel package
run: sudo apt install -y libkrb5-dev
# This is needed to lint pkg/cloud/libvirt package
- name: Install libvirt devel package
run: sudo apt install -y libvirt-dev
# This is needed for the container resolver dependencies
- name: Install libgpgme devel package
run: sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev podman
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.8
args: --verbose --timeout 5m0s
shellcheck:
name: "🐚 Shellcheck"
runs-on: ubuntu-24.04
env:
# workaround for expired cert at source of indirect dependency
# (go.opencensus.io/trace)
GOPROXY: "https://proxy.golang.org|direct"
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
set-safe-directory: true
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38
with:
ignore: vendor # We don't want to fix the code in vendored dependencies
env:
# don't check /etc/os-release sourcing, allow useless cats to live inside our codebase, and
# allow seemingly unreachable commands
SHELLCHECK_OPTS: -e SC1091 -e SC2002 -e SC2317
python-test:
name: "🐍 pytest (imgtestlib and test scripts)"
runs-on: ubuntu-24.04
env:
# workaround for expired cert at source of indirect dependency
# (go.opencensus.io/trace)
GOPROXY: "https://proxy.golang.org|direct"
container:
image: registry.fedoraproject.org/fedora:latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
set-safe-directory: true
- name: Install build and test dependencies
run: ./test/scripts/install-dependencies
- name: Testing imgtestlib and test scripts
run: |
python3 -m pytest -v -k "not images_integration" ./test
python-lint:
name: "🐍 Lint (test scripts)"
runs-on: ubuntu-24.04
env:
# workaround for expired cert at source of indirect dependency
# (go.opencensus.io/trace)
GOPROXY: "https://proxy.golang.org|direct"
container:
image: registry.fedoraproject.org/fedora:latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
set-safe-directory: true
- name: Install build and test dependencies
run: |
./test/scripts/install-dependencies
- name: Analysing the code with pylint
run: |
pylint --version
pylint --recursive=y .
yaml-checks:
name: "YAML checks"
runs-on: ubuntu-24.04
steps:
- name: Check out code
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
set-safe-directory: true
- name: Install checkers
run: |
sudo apt update
sudo apt install -y yamllint yq
- name: Check YAML
run: |
tools/yaml-lint.sh
cross-arch-integration-test:
strategy:
matrix:
arch:
# ppc64le disabled
- s390x
fail-fast: false # if one fails, keep the other(s) running
name: "Cross-arch qemu based image build/boot smoke test"
runs-on: ubuntu-24.04
env:
# workaround for expired cert at source of indirect dependency
# (go.opencensus.io/trace)
GOPROXY: "https://proxy.golang.org|direct"
GOFLAGS: "-buildvcs=false"
container:
image: registry.fedoraproject.org/fedora:44
options: "--privileged"
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v7
with:
set-safe-directory: true
- name: Install python3
# The Fedora container doesn't have python3 installed by default
run: dnf -y install python3
- name: Setup repository for pinned osbuild commit
run: ./test/scripts/setup-osbuild-repo
- name: Install osbuild dependencies
run: dnf -y install osbuild osbuild-depsolve-dnf
- name: Install build and test dependencies
run: ./test/scripts/install-dependencies
- name: Manually start qemu-user-static
run: |
# mostly for debugging
mount | grep binfmt_misc || true
ls /proc/sys/fs/binfmt_misc/
sudo mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
ls /proc/sys/fs/binfmt_misc/
sudo SYSTEMD_LOG_LEVEL=debug /usr/lib/systemd/systemd-binfmt
ls /proc/sys/fs/binfmt_misc/
sudo SYSTEMD_LOG_LEVEL=debug /usr/lib/systemd/systemd-binfmt /usr/lib/binfmt.d/qemu-*.conf
ls /proc/sys/fs/binfmt_misc/
- name: Cross arch integration test
run: |
sudo -E pytest -rs -k ${{ matrix.arch }} -s -v ./test/test_cross_arch_integration.py