-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
457 lines (414 loc) · 13.2 KB
/
.gitlab-ci.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
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
.templates_sha: &templates_sha 6a40df92957c8ce9ee741aaccc5daaaf70545b1e
include:
- project: 'freedesktop/ci-templates'
ref: *templates_sha
file: '/templates/debian.yml'
- project: 'gstreamer/gstreamer-rs'
ref: main
file: '/ci/images_template.yml'
- project: 'gstreamer/gstreamer'
ref: main
file: '/.gitlab-image-tags.yml'
variables:
FDO_UPSTREAM_REPO: gstreamer/gstreamer-rs
# We use GStreamer image to build the documentation as it is the simplest way
# to ensure that we are testing against the same thing as GStreamer itself.
# The tag name is included above from the main repo.
GSTREAMER_DOC_IMAGE: "registry.freedesktop.org/gstreamer/gstreamer/amd64/fedora:$FEDORA_TAG-main"
# Use the gstreamer image to trigger the cerbero job, same as the monorepo
CERBERO_TRIGGER_IMAGE: "registry.freedesktop.org/gstreamer/gstreamer/amd64/fedora:$FEDORA_TAG-main"
WINDOWS_BASE: "registry.freedesktop.org/gstreamer/gstreamer-rs/windows"
WINDOWS_RUST_MINIMUM_IMAGE: "$WINDOWS_BASE:$GST_RS_IMG_WINDOWS_TAG-main-$GST_RS_MSRV"
WINDOWS_RUST_STABLE_IMAGE: "$WINDOWS_BASE:$GST_RS_IMG_WINDOWS_TAG-main-$GST_RS_STABLE"
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
# don't create a pipeline if its a commit pipeline, on a branch and that branch has
# open merge requests (bc we will get a MR build instead)
- if: $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
default:
interruptible: true
# Auto-retry jobs in case of infra failures
retry:
max: 1
when:
- 'runner_system_failure'
- 'stuck_or_timeout_failure'
- 'scheduler_failure'
- 'api_failure'
stages:
- "trigger"
- "lint"
- "test"
- "extras"
- "integration"
# This is an empty job that is used to trigger the pipeline.
trigger:
image: alpine:latest
stage: 'trigger'
variables:
GIT_STRATEGY: none
tags: [ 'placeholder-job' ]
script:
- echo "Trigger job done, now running the pipeline."
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
# If the MR is assigned to the Merge bot, trigger the pipeline automatically
- if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"'
# Require explicit action to trigger tests post merge
- if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"'
when: 'manual'
# When the assignee isn't the merge bot, require an explicit action to trigger the pipeline
# to avoid wasting CI resources
- if: '$CI_MERGE_REQUEST_ASSIGNEES != "gstreamer-merge-bot"'
when: 'manual'
allow_failure: false
.debian:12:
variables:
SODIUM_USE_PKG_CONFIG: "true"
after_script:
- rm -rf target
before_script:
- source ./ci/env.sh
- mkdir .cargo && echo -e "[net]\ngit-fetch-with-cli = true" > .cargo/config.toml
.debian:12-stable:
extends: .debian:12
image: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bookworm-slim:$GST_RS_STABLE-$GST_RS_IMG_TAG"
.debian:12-msrv:
extends: .debian:12
image: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bookworm-slim:$GST_RS_MSRV-$GST_RS_IMG_TAG"
.debian:12-nightly:
extends: .debian:12
image: "registry.freedesktop.org/gstreamer/gstreamer-rs/debian/bookworm-slim:nightly-$GST_RS_IMG_TAG"
.cargo test:
stage: "test"
variables:
# csound-sys only looks at /usr/lib and /usr/local top levels
CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/'
RUST_BACKTRACE: 'full'
script:
- rustc --version
- CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all --all-targets"
- new_report_dir="$CI_PROJECT_DIR/junit_reports"
- mkdir -p "$new_report_dir"
- cargo build $CARGO_FLAGS
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run --profile=ci $CARGO_FLAGS
- mv "$CI_PROJECT_DIR/target/nextest/ci/junit.xml" "$new_report_dir/junit-tests-default.xml"
- cargo build $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run --profile=ci $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
- mv "$CI_PROJECT_DIR/target/nextest/ci/junit.xml" "$new_report_dir/junit-tests-all.xml"
- cargo build $CARGO_FLAGS --no-default-features
- RUST_BACKTRACE=1 G_DEBUG=fatal_warnings cargo nextest run --profile=ci $CARGO_FLAGS --no-default-features
- mv "$CI_PROJECT_DIR/target/nextest/ci/junit.xml" "$new_report_dir/junit-tests-no-default.xml"
artifacts:
reports:
junit: "junit_reports/*.xml"
test msrv:
extends:
- '.cargo test'
- '.debian:12-msrv'
needs: [ "trigger" ]
test stable:
extends:
- '.cargo test'
- '.debian:12-stable'
needs: [ "trigger" ]
test nightly:
allow_failure: true
extends:
- '.cargo test'
- '.debian:12-nightly'
needs: [ "trigger" ]
.meson:
extends: .debian:12-stable
variables:
# csound-sys only looks at /usr/lib and /usr/local top levels
CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/'
meson shared:
extends: .meson
needs: [ "trigger" ]
variables:
CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/"
script:
- meson build --default-library=shared --prefix=$(pwd)/install --fatal-meson-warnings
- ninja -C build install
- ./ci/check-installed.py install
- ninja -C build docs/gst_plugins_cache.json
- ci/check-documentation-diff.py
artifacts:
when: always
expire_in: "7 days"
paths:
- plugins-cache-diffs/
- 'build/meson-logs/'
meson static:
extends: .meson
needs: [ "trigger" ]
script:
- meson build --default-library=static --prefix=$(pwd)/install -Dsodium-source=built-in
- ninja -C build install
- ./ci/generate-static-test.py test-static-link-all
- cd test-static-link-all
- PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd)/../install/lib/x86_64-linux-gnu/pkgconfig meson build
- ninja -C build
- ./build/test-gst-static
artifacts:
when: always
expire_in: "7 days"
paths:
- 'build/meson-logs/'
# Check that the gstreamer documentation keeps working
documentation:
image: $GSTREAMER_DOC_IMAGE
stage: 'integration'
variables:
MESON_ARGS: >
-Ddoc=enabled
-Dpython=disabled
-Dlibav=disabled
-Dlibnice=disabled
-Ddevtools=disabled
-Dges=disabled
-Dsharp=disabled
-Dgst-examples=disabled
-Drs=enabled
-Dgst-plugins-rs:sodium-source=system
-Dgst-docs:fatal_warnings=true
-Dorc=disabled
script:
- export PATH=/usr/local/cargo/bin/:/usr/local/bin/:$PATH
- export RUSTUP_HOME='/usr/local/rustup'
- P=$(pwd)
- cd ..
- rm -rf gstreamer
- git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gstreamer.git --branch main
- cd gstreamer
- ln -s $P subprojects/gst-plugins-rs
- meson build $MESON_ARGS
- ./gst-env.py ninja -C build subprojects/gst-docs/GStreamer-doc
- mv build/subprojects/gst-docs/GStreamer-doc/html $P/documentation/
artifacts:
expire_in: '7 days'
when: always
paths:
- documentation/
needs: []
rules:
# Run job if the MR is assigned to the Merge bot or it a post-merge pipeline on main branch
- if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"'
when: 'always'
- if: '$CI_PROJECT_NAMESPACE == "gstreamer" && $CI_COMMIT_BRANCH == "main"'
when: 'always'
# Require explicit action to trigger otherwise
- if: '$CI_PROJECT_NAMESPACE != "gstreamer" || $CI_COMMIT_BRANCH != "main"'
when: 'manual'
# build gst-plugins-rs as a gst-build subproject
# Disabled because of https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/262
#gst-build:
# extends: .meson
# rules:
# - if: '$CI_PIPELINE_SOURCE == "schedule"'
# - if: $CI_PIPELINE_SOURCE == "merge_request_event"
# when: 'manual'
# allow_failure: true
# variables:
# MESON_ARGS: >
# -Domx=disabled
# -Dpython=disabled
# -Dlibav=disabled
# -Dlibnice=disabled
# -Dugly=disabled
# -Dbad=disabled
# -Ddevtools=disabled
# -Dges=disabled
# -Drtsp_server=disabled
# -Dvaapi=disabled
# -Dsharp=disabled
# -Dgst-examples=disabled
# -Drs=enabled
# -Dgst-plugins-rs:sodium-source=system
# script:
# - P=$(pwd)
# - cd ..
# - rm -rf gstreamer
# - git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gstreamer.git --branch main
# - cd gstreamer
# - ln -s $P subprojects/gst-plugins-rs
# - meson build $MESON_ARGS
# - ninja -C build
# # Check static Rust plugins can be linked into gst-full
# - meson build-gst-full --default-library=static $MESON_ARGS
# - ninja -C build-gst-full
# - meson devenv -C build-gst-full ./gst-inspect-1.0 rsaudiofx
# artifacts:
# expire_in: '7 days'
# when: always
# paths:
# - 'build/meson-logs/'
# - 'build-gst-full/meson-logs/'
.msvc2019 build:
stage: 'test'
needs:
- 'trigger'
tags:
- 'docker'
- 'windows'
- '2022'
- "gstreamer-windows"
script:
# Set the code page to UTF-8
- chcp 65001
# We need to build each crate separately to choose that can build on windows
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
powershell ./ci/run_windows_tests.ps1"
- |
if (!$?) {
Write-Host "Tests Failed!"
Exit 1
}
test windows msrv:
extends: '.msvc2019 build'
image: $WINDOWS_RUST_MINIMUM_IMAGE
when: 'manual'
test windows stable:
extends: '.msvc2019 build'
image: "$WINDOWS_RUST_STABLE_IMAGE"
rustfmt:
extends: '.debian:12-stable'
stage: "lint"
tags: [ 'placeholder-job' ]
needs: []
script:
- cargo fmt --version
- cargo fmt -- --color=always --check
typos:
extends: '.debian:12-stable'
stage: "lint"
tags: [ 'placeholder-job' ]
needs: []
script:
- typos
gstwebrtc-api lint:
image: node:lts
stage: "lint"
tags: [ 'placeholder-job' ]
needs: []
script:
- cd net/webrtc/gstwebrtc-api
- npm install
- npm run check
check commits:
extends: '.debian:12-stable'
stage: "lint"
tags: [ 'placeholder-job' ]
needs: []
script:
- ci-fairy check-commits --textwidth 0 --no-signed-off-by
- ci/check-for-symlinks.sh
- ci/check-meson-version.sh
clippy:
extends: '.debian:12-stable'
needs:
- "trigger"
- "test stable"
stage: 'extras'
variables:
# csound-sys only looks at /usr/lib and /usr/local top levels
CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/'
script:
- CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all --all-targets"
- cargo clippy $CARGO_FLAGS -- -D warnings -A unknown-lints
- cargo clippy $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4 -- -D warnings -A unknown-lints
- cargo clippy $CARGO_FLAGS --no-default-features -- -D warnings -A unknown-lints
deny:
extends: .debian:12-stable
stage: 'extras'
needs:
- "trigger"
- "test stable"
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
script:
- cargo update --color=always
- cargo deny --color=always --workspace --all-features check all
outdated:
extends: '.debian:12-stable'
allow_failure: true
needs:
- "trigger"
- "test stable"
stage: 'extras'
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
script:
- cargo update --color=always
- cargo outdated --color=always --root-deps-only --exit-code 1 -v
coverage:
allow_failure: true
extends:
- '.debian:12-stable'
needs:
- "trigger"
- "test stable"
stage: 'extras'
variables:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "gst-plugins-rs-%p-%m.profraw"
# csound-sys only looks at /usr/lib and /usr/local top levels
CSOUND_LIB_DIR: '/usr/lib/x86_64-linux-gnu/'
script:
- CARGO_FLAGS="-j${FDO_CI_CONCURRENT:-$(nproc)} --locked --color=always --all"
- cargo nextest run --profile=ci $CARGO_FLAGS --all-features --exclude gst-plugin-gtk4
- new_report_dir="$CI_PROJECT_DIR/junit_reports"
- mkdir -p "$new_report_dir"
- mv "$CI_PROJECT_DIR/target/nextest/ci/junit.xml" "$new_report_dir/coverage-junit.xml"
# generate html report
- mkdir -p coverage
- grcov . --binary-path ./target/debug/ -s . -t html,cobertura --branch --ignore-not-existing --ignore "*target*" --ignore "*/build.rs" -o ./coverage/
# output coverage summary for gitlab parsing.
# TODO: use grcov once https://github.com/mozilla/grcov/issues/556 is fixed
- grep "%" coverage/html/index.html | head -1 || true
artifacts:
paths:
- 'coverage'
reports:
junit: "junit_reports/*.xml"
coverage_report:
coverage_format: cobertura
path: "coverage/cobertura.xml"
cerbero trigger:
image: $CERBERO_TRIGGER_IMAGE
needs: [ "trigger" ]
timeout: '4h'
tags:
- placeholder-job
variables:
# We will build this cerbero branch in the cerbero trigger CI
CERBERO_UPSTREAM_BRANCH: 'main'
script:
- ci/cerbero/trigger_cerbero_pipeline.py
rules:
# Never run post merge
- if: '$CI_PROJECT_NAMESPACE == "gstreamer"'
when: never
# Don't run if the only changes are files that cargo-c does not read
- if:
changes:
- "CHANGELOG.md"
- "README.md"
- "deny.toml"
- "rustfmt.toml"
- "typos.toml"
- "*.py"
- "*.sh"
- "Makefile"
- "meson.build"
- "meson_options.txt"
- "**/meson.build"
- "ci/*.sh"
- "ci/*.py"
when: never
- when: always