gitlab ci templates to extend autodevops
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ci-templates/Rust.gitlab-ci.yml

58 lines
1.1 KiB

---
.caching_rust: &caching_rust
cache:
key: shared-cache
paths:
- target/
- .cargo/
.before_rust: &before_rust
- rustc --version
- cargo --version
- export CARGO_HOME="${PWD}/.cargo"
test-code:
image: "rustlang/rust:nightly"
before_script:
- *before_rust
stage: test
script:
- cargo test
- cargo install cargo-tarpaulin
- cargo tarpaulin --ignore-tests --out Xml # https://github.com/xd009642/tarpaulin/issues/146
coverage: '/^\d+.\d+% coverage/'
# artifacts:
# reports:
# cobertura:
# - cobertura.xml
<<: *caching_rust
lint-code:
image: "rustlang/rust:nightly"
before_script:
- *before_rust
stage: test
script:
- rustup component add clippy
- cargo clippy -- -D warnings
<<: *caching_rust
format-code:
image: "rustlang/rust:nightly"
before_script:
- *before_rust
stage: test
script:
- rustup component add rustfmt
- cargo fmt -- --check
<<: *caching_rust
audit-code:
image: "rustlang/rust:nightly"
before_script:
- *before_rust
stage: test
script:
- cargo install cargo-audit
- cargo audit
<<: *caching_rust