stages:
- build
- unit-test
- bench-test
- code-coverage
.rust_template: &rust_template
image: "nyanzebra/kitty_pool:latest"
services:
- docker:dind
cache:
paths:
- cargo/
- target/
before_script:
- export CARGO_HOME="$CI_PROJECT_DIR/cargo"
- rustup --version
- rustc --version
- cargo --version
.rust_build_template: &rust_build_template
stage: build
<<: *rust_template
script:
- cargo build --verbose
build-stable:
<<: *rust_build_template
variables:
RUSTUP_TOOLCHAIN: stable
build-beta:
<<: *rust_build_template
variables:
RUSTUP_TOOLCHAIN: beta
build-nightly:
<<: *rust_build_template
variables:
RUSTUP_TOOLCHAIN: nightly
.rust_unit_test_template: &rust_unit_test_template
stage: unit-test
<<: *rust_template
script:
- cargo test --all --verbose
test-stable:
<<: *rust_unit_test_template
variables:
RUSTUP_TOOLCHAIN: stable
test-beta:
<<: *rust_unit_test_template
variables:
RUSTUP_TOOLCHAIN: beta
test-nightly:
<<: *rust_unit_test_template
variables:
RUSTUP_TOOLCHAIN: nightly
.rust_bench_test_template: &rust_bench_test_template
stage: bench-test
<<: *rust_template
script:
- cargo bench --verbose
bench-stable:
<<: *rust_bench_test_template
variables:
RUSTUP_TOOLCHAIN: stable
bench-beta:
<<: *rust_bench_test_template
variables:
RUSTUP_TOOLCHAIN: beta
bench-nightly:
<<: *rust_bench_test_template
variables:
RUSTUP_TOOLCHAIN: nightly
test-fmt:
stage: build
<<: *rust_template
variables:
RUSTUP_TOOLCHAIN: stable
script:
- cargo fmt --all --verbose
test-clippy:
stage: build
<<: *rust_template
variables:
RUSTUP_TOOLCHAIN: stable
script:
- cargo clippy --all --verbose --
.rust_code_coverage_template: &rust_code_coverage_template
stage: code-coverage
<<: *rust_template
variables:
RUSTUP_TOOLCHAIN: stable
script:
- export CARGO_INCREMENTAL=0
- export CODECOV_TOKEN="73621dcd-8403-4b0d-bbba-b17e86b58d88"
- export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads"
- zip -0 ccov.zip `find . \( -name "kitty_pool*.gc*" \) -print`
- cargo build --verbose
- cargo test --verbose
- grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore "/*" -o lcov.info
- bash <(curl -s https://codecov.io/bash) -f lcov.info
code-coverage-nightly:
<<: *rust_code_coverage_template
variables:
RUSTUP_TOOLCHAIN: nightly