mirror of
https://gitlab.com/MisterBiggs/aoc_2015-rust.git
synced 2025-06-16 15:06:49 +00:00
using simple default gitlab provided template
This commit is contained in:
parent
af6f32a9ce
commit
5228e484e0
131
.gitlab-ci.yml
131
.gitlab-ci.yml
@ -1,124 +1,21 @@
|
|||||||
image: 'rust:latest'
|
# Official language image. Look for the different tagged releases at:
|
||||||
|
# https://hub.docker.com/r/library/rust/tags/
|
||||||
stages:
|
image: "rust:latest"
|
||||||
- check
|
|
||||||
- lint
|
|
||||||
- test
|
|
||||||
|
|
||||||
|
|
||||||
variables:
|
# Use cargo to test the project
|
||||||
CARGO_HOME: $CI_PROJECT_DIR/cargo_cache
|
test:cargo:
|
||||||
DEBIAN_BINARY: "debian-x86_64-${CI_COMMIT_TAG}.tar.bz2"
|
|
||||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gitlab-clippy/${CI_COMMIT_TAG}"
|
|
||||||
|
|
||||||
.common:
|
|
||||||
interruptible: true
|
|
||||||
cache:
|
|
||||||
key:
|
|
||||||
files:
|
|
||||||
- Cargo.lock
|
|
||||||
paths:
|
|
||||||
# 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
|
|
||||||
|
|
||||||
.recreate_cache:
|
|
||||||
cache:
|
|
||||||
policy: pull-push
|
|
||||||
|
|
||||||
check:
|
|
||||||
stage: check
|
|
||||||
needs: []
|
|
||||||
extends:
|
|
||||||
- .common
|
|
||||||
- .recreate_cache
|
|
||||||
script:
|
script:
|
||||||
- cargo check --workspace
|
- rustc --version && cargo --version # Print version info for debugging
|
||||||
|
- cargo test --workspace --verbose
|
||||||
|
|
||||||
fmt:
|
# Optional: Use a third party library to generate gitlab junit reports
|
||||||
stage: lint
|
test:junit-report:
|
||||||
extends: .common
|
|
||||||
needs:
|
|
||||||
- job: check
|
|
||||||
artifacts: false
|
|
||||||
before_script:
|
|
||||||
- rustup component add rustfmt
|
|
||||||
script:
|
script:
|
||||||
- cargo fmt --all -- --check
|
Should be specified in Cargo.toml
|
||||||
|
- cargo install junitify
|
||||||
clippy-cli:
|
- cargo test -- --format=json -Z unstable-options --report-time | junitify --out $CI_PROJECT_DIR/tests/
|
||||||
stage: lint
|
|
||||||
before_script:
|
|
||||||
- rustup component add clippy
|
|
||||||
- cargo install --path .
|
|
||||||
script:
|
|
||||||
- cargo clippy
|
|
||||||
after_script:
|
|
||||||
- cargo clippy --message-format=json | $CARGO_HOME/bin/gitlab-clippy > gl-code-quality-report.json
|
|
||||||
artifacts:
|
artifacts:
|
||||||
|
when: always
|
||||||
reports:
|
reports:
|
||||||
codequality: gl-code-quality-report.json
|
junit: $CI_PROJECT_DIR/tests/*.xml
|
||||||
expire_in: 1 week
|
|
||||||
rules:
|
|
||||||
- if: '$CODE_QUALITY_DISABLED'
|
|
||||||
when: never
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "push"'
|
|
||||||
|
|
||||||
clippy-be:
|
|
||||||
stage: lint
|
|
||||||
extends: .common
|
|
||||||
needs:
|
|
||||||
- job: check
|
|
||||||
artifacts: false
|
|
||||||
before_script:
|
|
||||||
- rustup component add clippy
|
|
||||||
script:
|
|
||||||
- cargo clippy
|
|
||||||
after_script:
|
|
||||||
- cargo clippy --message-format=json &> clippy.txt || true
|
|
||||||
- curl -X POST "https://gitlab-cq-rust.herokuapp.com/clippy" --data-binary @clippy.txt --output report.json
|
|
||||||
artifacts:
|
|
||||||
reports:
|
|
||||||
codequality: report.json
|
|
||||||
expire_in: 1 week
|
|
||||||
rules:
|
|
||||||
- if: '$CODE_QUALITY_DISABLED'
|
|
||||||
when: never
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "push"'
|
|
||||||
|
|
||||||
test:
|
|
||||||
stage: test
|
|
||||||
extends: .common
|
|
||||||
needs:
|
|
||||||
- job: check
|
|
||||||
artifacts: false
|
|
||||||
before_script:
|
|
||||||
- rustup component add clippy
|
|
||||||
script:
|
|
||||||
- cargo test --all
|
|
||||||
|
|
||||||
coverage:
|
|
||||||
image: "rustdocker/rust:nightly"
|
|
||||||
stage: extras
|
|
||||||
variables:
|
|
||||||
RUSTFLAGS: "-Zinstrument-coverage"
|
|
||||||
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
|
|
||||||
script:
|
|
||||||
- rustup component add llvm-tools-preview
|
|
||||||
- cargo test
|
|
||||||
# generate html report
|
|
||||||
- cargo install grcov
|
|
||||||
- grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*cargo*" -o ./coverage/
|
|
||||||
# generate cobertura report for gitlab integration
|
|
||||||
- pip3 install lcov_cobertura
|
|
||||||
- grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "*cargo*" -o coverage.lcov
|
|
||||||
- python3 /usr/local/lib/python3.5/dist-packages/lcov_cobertura.py coverage.lcov
|
|
||||||
artifacts:
|
|
||||||
reports:
|
|
||||||
coverage_report:
|
|
||||||
coverage_format: cobertura
|
|
||||||
path: cobertura.xml
|
|
||||||
coverage: '/^\d+.\d+% coverage/'
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user