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

75 lines
2.0 KiB
YAML
Raw Normal View History

2022-07-01 22:36:04 +02:00
# SPDX-FileCopyrightText: 2021 Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
# SPDX-License-Identifier: CC0-1.0
stages:
- build
2022-08-01 00:20:52 +02:00
- check
2022-07-01 22:36:04 +02:00
- test
- deploy
.with_rust_image:
image: ${CI_REGISTRY_IMAGE}/rust:latest
needs:
2022-10-28 10:15:00 +02:00
- job: container:build
2022-07-01 22:36:04 +02:00
optional: true
2022-10-28 10:15:00 +02:00
container:build:
2022-07-01 22:36:04 +02:00
stage: build
variables:
CI_TAGGED_IMAGE: ${CI_REGISTRY_IMAGE}/rust:latest
before_script:
2022-10-28 10:15:00 +02:00
- podman login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
2022-07-01 22:36:04 +02:00
- echo "Operating on registry ${CI_REGISTRY} and image ${CI_TAGGED_IMAGE}"
script:
2022-10-28 10:15:00 +02:00
- podman build --tag ${CI_TAGGED_IMAGE} .
- podman push ${CI_TAGGED_IMAGE}
2022-07-01 22:36:04 +02:00
when: manual
rules:
- if: $CI_PIPELINE_SOURCE == "web" && $FORCE_DOCKER_BUILD == "true"
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "master"
changes:
2022-10-28 10:15:00 +02:00
- Containerfile
2022-07-01 22:36:04 +02:00
allow_failure: true
2022-08-01 00:20:52 +02:00
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
2022-07-01 22:36:04 +02:00
cargo:test:
2022-08-01 00:20:52 +02:00
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
2022-07-01 22:36:04 +02:00
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