62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
# SPDX-FileCopyrightText: 2021 Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
stages:
|
|
- build
|
|
- check
|
|
- test
|
|
- deploy
|
|
|
|
.with_rust_image:
|
|
image: ${CI_REGISTRY_IMAGE}/rust:latest
|
|
needs:
|
|
- job: docker:build
|
|
optional: true
|
|
|
|
docker:build:
|
|
stage: build
|
|
variables:
|
|
CI_TAGGED_IMAGE: ${CI_REGISTRY_IMAGE}/rust:latest
|
|
before_script:
|
|
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
|
|
- echo "Operating on registry ${CI_REGISTRY} and image ${CI_TAGGED_IMAGE}"
|
|
script:
|
|
- docker build --tag ${CI_TAGGED_IMAGE} .
|
|
- docker 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:
|
|
- Dockerfile
|
|
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
|