# -*- indent-tabs-mode: nil -*- include: - local: 'ci/container_builds.yml' variables: LIBRSVG_DEBUG: "yes" # Turn compiler warnings into errors RUSTFLAGS: '-D warnings' stages: - container-build - check - build - lint - unit test - acceptance test - cross distro - release - docs default: interruptible: true check: extends: - '.container.opensuse@x86_64.stable' - '.fdo.distribution-image@opensuse' - '.cache_push' stage: check needs: ['opensuse-container@x86_64.stable'] script: - cargo check --all-targets 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: - _build/tests/output expire_in: 1 day variables: OUT_DIR: "${CI_PROJECT_DIR}/tests/output" script: - cargo test -- --skip loading_crash --skip reference --skip render_crash .build-rsvg: tags: # FIXME: remove this once the runners get CentOS upgraded # see https://gitlab.gnome.org/GNOME/librsvg/-/issues/848 - crun extends: '.cache' stage: build script: - mkdir -p _build - cd _build - ../autogen.sh --enable-gtk-doc --enable-vala - make - make check artifacts: when: 'on_failure' paths: - _build/tests/*.log - _build/tests/output expire_in: 1 day build-rsvg-opensuse@x86_64.stable: extends: - '.container.opensuse@x86_64.stable' - .fdo.distribution-image@opensuse - .build-rsvg # make check runs extra tests that require extra crates, hence cache is pushed - .cache_push needs: - job: opensuse-container@x86_64.stable artifacts: false - job: check artifacts: false build-rsvg-opensuse@x86_64.minimum: extends: - '.container.opensuse@x86_64.minimum' - .fdo.distribution-image@opensuse - .build-rsvg needs: - job: opensuse-container@x86_64.minimum artifacts: false - job: check artifacts: false build-rsvg-opensuse@x86_64.nightly: extends: - '.container.opensuse@x86_64.nightly' - .fdo.distribution-image@opensuse - .build-rsvg needs: - job: opensuse-container@x86_64.nightly artifacts: false - job: check artifacts: false .build-rsvg-opensuse@aarch64: extends: - .container.opensuse@aarch64 - .fdo.distribution-image@opensuse - .build-rsvg needs: - job: opensuse-container@aarch64 artifacts: false - job: check artifacts: false .build-rsvg-fedora@x86_64: extends: - .container.fedora@x86_64 - .fdo.distribution-image@fedora - .build-rsvg needs: - job: fedora-container@x86_64 artifacts: false - job: check artifacts: false rules: - if: '$CI_PIPELINE_SOURCE == "push"' when: manual allow_failure: true - if: '$CI_PIPELINE_SOURCE == "schedule"' .build-rsvg-fedora@aarch64: extends: - .container.fedora@aarch64 - .fdo.distribution-image@fedora - .build-rsvg needs: - job: fedora-container@aarch64 artifacts: false - job: check artifacts: false rules: - if: '$CI_PIPELINE_SOURCE == "push"' when: manual allow_failure: true - if: '$CI_PIPELINE_SOURCE == "schedule"' .build-rsvg-debian@x86_64: extends: - '.container.debian@x86_64' - '.fdo.distribution-image@debian' - '.build-rsvg' variables: # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907306 # export GDK_PIXBUF_QUERYLOADERS=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders GDK_PIXBUF_QUERYLOADERS: '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders' LIBRSVG_DEBUG: "no" needs: - job: debian-container@x86_64 artifacts: false - job: check artifacts: false rules: - if: '$CI_PIPELINE_SOURCE == "push"' when: manual allow_failure: true - if: '$CI_PIPELINE_SOURCE == "schedule"' .build-rsvg-debian@aarch64: extends: - '.container.debian@aarch64' - '.fdo.distribution-image@debian' - '.build-rsvg' variables: # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907306 # export GDK_PIXBUF_QUERYLOADERS=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders GDK_PIXBUF_QUERYLOADERS: '/usr/lib/aarch64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders' LIBRSVG_DEBUG: "no" needs: - job: debian-container@aarch64 artifacts: false - job: check artifacts: false rules: - if: '$CI_PIPELINE_SOURCE == "push"' when: manual allow_failure: true - if: '$CI_PIPELINE_SOURCE == "schedule"' .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 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 script: - 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 == "push"' coverage: extends: - '.container.opensuse@x86_64.nightly' - .fdo.distribution-image@opensuse - .cache stage: unit test needs: - job: opensuse-container@x86_64.nightly - job: check artifacts: false tags: # FIXME: remove this once the runners get CentOS upgraded # see https://gitlab.gnome.org/GNOME/librsvg/-/issues/848 - crun variables: RUSTFLAGS: "-Zinstrument-coverage" RUSTDOCFLAGS: "-Zinstrument-coverage" LLVM_PROFILE_FILE: "coverage-profiles/coverage-%p-%m.profraw" script: - mkdir -p _build - cd _build - ../autogen.sh --enable-gtk-doc --enable-vala --enable-debug - make - make -k check after_script: - source ./ci/env.sh - mkdir -p public - grcov coverage-profiles --binary-path ./_build/target/debug/ --source-dir . --output-type cobertura --llvm --branch --ignore-not-existing --ignore "build.rs" --ignore '_build/*' --ignore 'cargo_cache/*' -o coverage.xml - grcov coverage-profiles --binary-path ./_build/target/debug/ --source-dir . --output-type html --llvm --branch --ignore-not-existing --ignore "build.rs" --ignore '_build/*' --ignore 'cargo_cache/*' --output-path public/coverage - grep -Eo 'line-rate="[^"]+"' coverage.xml | head -n 1 | grep -Eo '[0-9.]+' | awk '{ print "Coverage:", $1 * 100 }' coverage: '/Coverage: \d+\.\d+/' artifacts: name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA} expire_in: 2 days when: always reports: cobertura: coverage.xml paths: - public cargo_bench: extends: - '.container.opensuse@x86_64.stable' - '.fdo.distribution-image@opensuse' - '.cache' stage: unit test needs: - job: check script: | 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 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" rules: - if: '$CI_PIPELINE_SOURCE == "push"' - if: '$CI_PIPELINE_SOURCE == "schedule"' distcheck: stage: release extends: - '.container.opensuse@x86_64.stable' - '.fdo.distribution-image@opensuse' - '.cache' needs: - job: check tags: # FIXME: remove this once the runners get CentOS upgraded # see https://gitlab.gnome.org/GNOME/librsvg/-/issues/848 - crun variables: DESTDIR: "/tmp/distcheck" LIBRSVG_DEBUG: "no" script: - ./autogen.sh --enable-vala - make - make distcheck artifacts: when: 'on_success' paths: - librsvg-*.tar.xz expire_in: 1 week rules: - if: '$CI_PIPELINE_SOURCE == "push"' when: manual allow_failure: true - if: '$CI_PIPELINE_SOURCE == "schedule"' reference: 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 script: - mkdir -p _build - cd _build - ../autogen.sh --enable-vala - make - cd .. - mkdir -p public/ - mv _build/doc/Rsvg-2.0 public/ artifacts: paths: - public pages: stage: docs extends: - '.container.opensuse@x86_64.stable' - '.fdo.distribution-image@opensuse' - '.cache' needs: - job: reference - job: coverage script: - mkdir -p public/internals - cargo doc --document-private-items --no-deps - cp -r target/doc/* public/internals - mkdir -p public/doc - cargo doc --no-deps --lib - cp -r target/doc/* public/doc artifacts: paths: - public rules: - if: '$CI_COMMIT_BRANCH == "main"'