-
Notifications
You must be signed in to change notification settings - Fork 48
/
.gitlab-ci.yml
532 lines (497 loc) · 12.6 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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# -*- indent-tabs-mode: nil -*-
include:
- local: 'ci/container_builds.yml'
# Enable merge request pipelines and avoid duplicate pipelines
# https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH'
variables:
LIBRSVG_DEBUG: "yes"
# Turn compiler warnings into errors
RUSTFLAGS: '-D warnings'
stages:
- container-build
- ci-check
- check
- build
- lint
- analysis
- acceptance test
- docs
default:
interruptible: true
lint ci scripts:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
stage: ci-check
script:
- source ci/env.sh
- ruff check ci
run ci tests:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
stage: ci-check
script:
- source ci/env.sh
- pytest ci/*.py
check:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache_push'
stage: check
needs: ['opensuse-container@x86_64.stable']
variables:
PREFIX: "/usr/local/librsvg"
RUSTFLAGS: "--cfg check"
script:
- source ./ci/setup-dependencies-env.sh
- cargo check --all-targets --workspace --exclude 'librsvg-rebind*'
cargo_test:
stage: check
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
# Tests require extra crates, hence cache is pushed
- '.cache_push'
needs:
- job: check
artifacts:
when: 'on_failure'
paths:
- tests/output
expire_in: 1 day
variables:
TESTS_OUTPUT_DIR: "${CI_PROJECT_DIR}/tests/output"
PREFIX: "/usr/local/librsvg"
script:
- source ./ci/setup-dependencies-env.sh
- cargo test --workspace --exclude pixbufloader-svg --exclude 'librsvg-rebind*' -- --skip loading_crash --skip reference --skip render_crash
.cargo-test:
extends: '.cache'
stage: build
variables:
TESTS_OUTPUT_DIR: "${CI_PROJECT_DIR}/tests/output"
PREFIX: "/usr/local/librsvg"
script:
- source ./ci/setup-dependencies-env.sh
- rustup default ${RUST_VERSION}
- cargo test --workspace --exclude pixbufloader-svg --exclude 'librsvg-rebind*'
artifacts:
when: 'on_failure'
paths:
- tests/output
expire_in: 1 day
.meson build:
stage: build
variables:
TESTS_OUTPUT_DIR: "${CI_PROJECT_DIR}/_build/tests/output"
PREFIX: "/usr/local/librsvg"
script:
- meson setup _build --prefix=$PREFIX -Ddocs=enabled -Dintrospection=enabled -Dvala=enabled -Dwarning_level=3
- meson compile -C _build
- meson test -C _build --print-errorlogs
artifacts:
when: 'always'
paths:
- _build/doc/
- _build/meson-logs/*.*
- _build/tests/output
reports:
junit: _build/meson-logs/testlog.junit.xml
expire_in: 1 day
meson build - opensuse@x86_64.stable:
stage: build
extends:
- '.container.opensuse@x86_64.stable'
- .fdo.distribution-image@opensuse
# make check runs extra tests that require extra crates, hence cache is pushed
- .cache_push
- ".meson build"
needs:
- job: opensuse-container@x86_64.stable
artifacts: false
- job: check
artifacts: false
script:
- source ./ci/setup-dependencies-env.sh
- !reference [".meson build", "script"]
cargo test - opensuse@x86_64:
extends:
- '.container.opensuse@x86_64.stable'
- .fdo.distribution-image@opensuse
- .cargo-test
needs:
- job: opensuse-container@x86_64.stable
artifacts: false
- job: check
artifacts: false
parallel:
matrix:
- RUST_VERSION:
# This is effectively the same as the cargo_test
# job in the check stage
# - "${RUST_STABLE}"
- "${RUST_MINIMUM}"
- "${RUST_NIGHTLY}"
cargo test - opensuse@aarch64:
extends:
- .container.opensuse@aarch64
- .fdo.distribution-image@opensuse
- .cargo-test
needs:
- job: opensuse-container@aarch64
artifacts: false
- job: check
artifacts: false
allow_failure: true
.cache:
variables:
# Only stuff inside the repo directory can be cached
# Override the CARGO_HOME variable to force its location
CARGO_HOME: "${CI_PROJECT_DIR}/cargo_cache"
before_script:
- source ./ci/env.sh
- mkdir -p cargo_cache
cache:
key:
files:
- Cargo.lock
paths:
# Rust cache
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
- cargo_cache/bin
- cargo_cache/registry/index
- cargo_cache/registry/cache
- cargo_cache/git/db
policy: pull
.cache_push:
extends: .cache
cache:
policy: pull-push
meson build - gnomeos.nightly@x86_64:
extends:
- ".container.gnomeos.nightly@x86_64"
- .fdo.distribution-image@gnomeos
- ".meson build"
needs:
- job: gnomeos-container.nightly@x86_64
artifacts: false
- job: check
artifacts: false
meson build - gnomeos.stable@x86_64:
extends:
- ".container.gnomeos.stable@x86_64"
- .fdo.distribution-image@gnomeos
- ".meson build"
needs:
- job: gnomeos-container.stable@x86_64
artifacts: false
- job: check
artifacts: false
cargo test - gnomeos.nightly.@x86_64:
extends:
- ".container.gnomeos.nightly@x86_64"
- .fdo.distribution-image@gnomeos
- .cargo-test
needs:
- job: gnomeos-container.nightly@x86_64
artifacts: false
- job: check
artifacts: false
parallel:
matrix:
- RUST_VERSION:
- "${RUST_STABLE}"
- "${RUST_MINIMUM}"
- "${RUST_NIGHTLY}"
cargo test - gnomeos.stable@x86_64:
extends:
- ".container.gnomeos.stable@x86_64"
- .fdo.distribution-image@gnomeos
- .cargo-test
needs:
- job: gnomeos-container.stable@x86_64
artifacts: false
- job: check
artifacts: false
parallel:
matrix:
- RUST_VERSION:
- "${RUST_STABLE}"
- "${RUST_MINIMUM}"
- "${RUST_NIGHTLY}"
fmt:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
stage: lint
needs:
- job: check
script:
- cargo fmt --all -- --check
clippy:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
stage: lint
needs:
- job: check
variables:
PREFIX: "/usr/local/librsvg"
script:
- source ./ci/setup-dependencies-env.sh
- cargo clippy --version
- gitlab-clippy --version
- cargo clippy
- cargo clippy --message-format=json | gitlab-clippy -o gl-code-quality-report.json
artifacts:
reports:
codequality: gl-code-quality-report.json
expire_in: 1 week
rules:
- if: '$CODE_QUALITY_DISABLED'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH'
deny:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
stage: lint
needs:
- job: check
artifacts: false
script:
- cargo deny check
check_versions:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
stage: lint
needs:
- job: check
artifacts: false
script:
- python3 ci/check_project_version.py
- python3 ci/check_public_crate_version.py
- python3 ci/check_crate_versions_in_example.py
- python3 ci/check_rust_versions.py
coverage:
extends:
- '.container.opensuse@x86_64.stable'
- .fdo.distribution-image@opensuse
- .cache
stage: analysis
needs:
- job: opensuse-container@x86_64.stable
- job: check
artifacts: false
variables:
PREFIX: "/usr/local/librsvg"
script:
- source ./ci/env.sh
- source ./ci/setup-dependencies-env.sh
- bash -x ./ci/build-with-coverage.sh
- bash -x ./ci/gen-coverage.sh
coverage: '/Coverage: \d+\.\d+/'
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
expire_in: 2 days
when: always
# Disable the cobertura report for now; it is only used for showing coverage
# in the diff view of merge requests.
#
# After switching to gcov-based instrumentation (-Zprofile above), this
# coverage.xml is almost 500 MB and causes gitlab's redis to OOM.
#
# reports:
# coverage_report:
# coverage_format: cobertura
# path: coverage.xml
paths:
- public
cargo_bench:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
stage: analysis
needs:
- job: check
variables:
PREFIX: "/usr/local/librsvg"
script: |
source ./ci/setup-dependencies-env.sh
BENCHES=("box_blur" "composite" "lighting" "path_parser" "pixbuf_from_surface" "pixel_iterators" "pixel_ops" "srgb" "surface_from_pixbuf")
git checkout ${CI_DEFAULT_BRANCH}
for BENCH in "${BENCHES[@]}"
do
cargo bench --bench $BENCH -- --noplot --save-baseline main
done
git checkout ${CI_COMMIT_SHA}
for BENCH in "${BENCHES[@]}"
do
cargo bench --bench $BENCH -- --noplot --baseline main
cargo bench --profile overflow --bench $BENCH -- --noplot --baseline main
done
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH != "main"'
when: manual
allow_failure: true
artifacts:
paths:
- target/criterion
expire_in: 1 week
msys2-mingw64:
stage: acceptance test
tags:
- win32-ps
needs:
- job: check
variables:
MSYSTEM: "MINGW64"
CHERE_INVOKING: "yes"
script:
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
- C:\msys64\usr\bin\bash -lc "bash -x ./ci/test-msys2.sh"
artifacts:
when: 'on_failure'
paths:
- _build\meson-logs
- _build\tests\*.log
- _build\tests\output
expire_in: 1 day
allow_failure: true
vs2019-x64:
# TODO: Uncomment this when ready to merge.
# rules:
# - if: $CI_PROJECT_NAMESPACE == "GNOME"
stage: build
tags:
- win32-ps
needs: []
script:
- ci/test-msvc.bat
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/msvc-build/meson-logs"
- "${CI_PROJECT_DIR}/msvc-build/tests/output"
allow_failure: true
distcheck:
stage: acceptance test
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
needs:
- job: check
artifacts: false
variables:
PREFIX: "/usr/local/librsvg"
script:
- source ./ci/setup-dependencies-env.sh
- meson setup _build --prefix=$PREFIX -Dvala=enabled --buildtype=release
- meson dist -C _build
artifacts:
when: 'on_success'
paths:
- _build/meson-dist/librsvg-*.tar.xz
- _build/meson-dist/librsvg-*.tar.xz.sha256sum
expire_in: 1 week
reference:
stage: docs
needs:
- job: meson build - opensuse@x86_64.stable
artifacts: true
script:
- mkdir -p public/
- mv _build/doc/Rsvg-2.0 public/
artifacts:
paths:
- public
expire_in: 1 day
check devel-docs links:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
stage: docs
needs:
- job: opensuse-container@x86_64.stable
artifacts: false
script:
- bash -x ./ci/check_docs_links.sh
artifacts:
paths:
- public/devel-docs-check
expire_in: 1 day
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH != "main"'
allow_failure: true
devel-docs:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
stage: docs
needs:
- job: opensuse-container@x86_64.stable
artifacts: false
script:
- bash -x ./ci/gen-devel-docs.sh
artifacts:
paths:
- public
expire_in: 1 day
cargo-doc:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
stage: docs
needs:
- job: opensuse-container@x86_64.stable
artifacts: false
variables:
PREFIX: "/usr/local/librsvg"
RUSTFLAGS: "--cfg docsrs"
script:
- source ./ci/setup-dependencies-env.sh
- rustup default ${RUST_NIGHTLY}
- bash -x ./ci/gen-rust-docs.sh
artifacts:
paths:
- public
expire_in: 1 day
pages:
stage: docs
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
needs:
- job: reference
- job: coverage
- job: devel-docs
- job: cargo-doc
script:
- cp ci/pages-index.html public/index.html
artifacts:
paths:
- public
expire_in: 1 day
rules:
- if: '$CI_COMMIT_BRANCH == "main"'