Files
librsvg/.gitlab-ci.yml

541 lines
13 KiB
YAML

# -*- indent-tabs-mode: nil -*-
include:
- local: 'ci/container_builds.yml'
- project: "GNOME/citemplates"
file: "templates/default-rules.yml"
- component: "gitlab.gnome.org/GNOME/citemplates/release-service@master"
inputs:
dist-job-name: "distcheck"
tarball-artifact-path: "_build/meson-dist/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.xz"
- component: "gitlab.gnome.org/GNOME/citemplates/markdown-lint@master"
inputs:
job-stage: "lint"
variables:
LIBRSVG_DEBUG: "yes"
# Turn compiler warnings into errors
RUSTFLAGS: '-D warnings'
stages:
- container-build
- ci-check
- check
- build
- lint
- analysis
- acceptance test
- docs
- deploy
lint ci python 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
lint ci shell scripts:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
stage: ci-check
script:
- source ci/env.sh
- sh ci/check_shell_scripts.sh
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
- meson install -C _build
# Generate 'cargo doc' documentation here, since the librsvg-rebind docs require an installed library
# and pkg-config file.
- bash -x ./ci/gen-rust-docs.sh
artifacts:
when: 'always'
paths:
- _build/doc/
- _build/meson-logs/*.*
- _build/tests/output
- public
reports:
junit: _build/meson-logs/testlog.junit.xml
expire_in: 1 day
.meson build no docs:
stage: build
variables:
TESTS_OUTPUT_DIR: "${CI_PROJECT_DIR}/_build/tests/output"
PREFIX: "/usr/local/librsvg"
script:
- meson setup _build --prefix=$PREFIX -Ddocs=disabled -Dintrospection=enabled -Dvala=enabled -Dwarning_level=3
- meson compile -C _build
- meson test -C _build --print-errorlogs
artifacts:
when: 'always'
paths:
- _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 no docs"
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
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
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
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
meson build - vs2019-x64-stable:
# 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
pages:
stage: docs
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
needs:
- job: reference
- job: coverage
- job: devel-docs
- job: "meson build - opensuse@x86_64.stable"
script:
- cp ci/pages-index.html public/index.html
artifacts:
paths:
- public
expire_in: 1 day
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
check rsvg-convert options:
extends:
- '.container.opensuse@x86_64.stable'
- '.fdo.distribution-image@opensuse'
- '.cache'
stage: docs
needs:
- job: opensuse-container@x86_64.stable
artifacts: false
- job: check
artifacts: false
variables:
PREFIX: "/usr/local/librsvg"
script:
- source ./ci/setup-dependencies-env.sh
- cargo run -p ci --bin check-rsvg-convert-options