2020-03-08 16:50:04 +01:00
|
|
|
# Official language image.
|
2020-03-16 16:26:51 +01:00
|
|
|
image: 'rust:latest'
|
2020-03-08 16:50:04 +01:00
|
|
|
|
|
|
|
stages:
|
|
|
|
- lint
|
|
|
|
- test
|
|
|
|
|
|
|
|
variables:
|
|
|
|
CARGO_HOME: $CI_PROJECT_DIR/cargo
|
|
|
|
APT_CACHE_DIR: $CI_PROJECT_DIR/apt
|
|
|
|
|
|
|
|
lint:fmt:
|
2020-03-16 16:26:51 +01:00
|
|
|
# Nightly image for formatting configuration
|
|
|
|
image: 'rustlang/rust:nightly'
|
2020-03-08 16:50:04 +01:00
|
|
|
stage: lint
|
|
|
|
before_script:
|
|
|
|
- rustup component add rustfmt
|
|
|
|
script:
|
|
|
|
- cargo fmt --version
|
|
|
|
- cargo fmt --all -- --check
|
|
|
|
|
|
|
|
lint:clippy:
|
|
|
|
stage: lint
|
|
|
|
before_script:
|
|
|
|
- rustup component add clippy
|
|
|
|
script:
|
|
|
|
- cargo clippy --version
|
|
|
|
- cargo clippy -- --deny warnings
|
|
|
|
|
|
|
|
test:cargo-test:
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- rustc --version
|
|
|
|
- cargo --version
|
|
|
|
- cargo test --all --verbose
|
|
|
|
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- apt/
|
|
|
|
- cargo/
|
|
|
|
- target/
|