nextcloud-cooking-schedule/.gitlab-ci.yml

75 lines
2.0 KiB
YAML

# SPDX-FileCopyrightText: 2021 Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
# SPDX-License-Identifier: CC0-1.0
stages:
- build
- check
- test
- deploy
.with_rust_image:
image: ${CI_REGISTRY_IMAGE}/rust:latest
needs:
- job: container:build
optional: true
container:build:
stage: build
variables:
CI_TAGGED_IMAGE: ${CI_REGISTRY_IMAGE}/rust:latest
before_script:
- podman login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- echo "Operating on registry ${CI_REGISTRY} and image ${CI_TAGGED_IMAGE}"
script:
- podman build --tag ${CI_TAGGED_IMAGE} .
- podman push ${CI_TAGGED_IMAGE}
when: manual
rules:
- if: $CI_PIPELINE_SOURCE == "web" && $FORCE_DOCKER_BUILD == "true"
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "master"
changes:
- Containerfile
allow_failure: true
cargo:check:
extends: .with_rust_image
stage: check
variables:
CARGO_COMMON_ARGS: --workspace --no-default-features
script:
- reuse lint
- cargo fmt -- --check
- cargo deny check
cargo:test:
extends: .with_rust_image
stage: test
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: cobertura.xml
junit: junit.xml
variables:
RUST_BACKTRACE: 1
CARGO_COMMON_ARGS: --workspace --no-default-features
script:
- mkdir -p .git/hooks # for rusty-hook
- cargo tarpaulin ${CARGO_COMMON_ARGS} --locked -o Xml
- cargo test ${CARGO_COMMON_ARGS} -- -Z unstable-options --format json | tee test-results.json
- cargo2junit < test-results.json > junit.xml
# - cargo bench ${CARGO_COMMON_ARGS} # DISABLED UNTIL WE HAVE BENCH TESTS
cargo:doc: # pages: in the future
extends: .with_rust_image
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == "master"
script:
- mkdir public
- cargo doc --workspace --no-deps --all-features
- cp -R target/doc/* public
artifacts:
paths:
- public