variables: TIMEOUT_SECONDS: 10 RUSTFLAGS: "-C instrument-coverage -Dwarnings" LLVM_PROFILE_FILE: "coverage-%p-%m.profraw" RUST_BACKTRACE: "full" RUSTDOCFLAGS: "-Dwarnings" image: "rustdocker/rust:nightly" cache: key: "$CI_JOB_NAME" untracked: true paths: - $HOME/.cache/ - $HOME/.cargo/ # - target/ default: before_script: - rustc --version - cargo --version stages: - test - build - extras cargo-test: stage: test script: - cargo install cargo2junit - cargo test --all --all-features -- -Z unstable-options --format json | cargo2junit > .cargo-test-report.xml artifacts: reports: junit: .cargo-test-report.xml cargo-coverage: stage: test needs: ["cargo-test"] script: - apt-get update && apt-get install -yqq --no-install-recommends python3-pip python3-setuptools lcov - rustup component add llvm-tools-preview - (cargo test -- -Z unstable-options) || true # generate html report - cargo install grcov - grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "*cargo*" --ignore "*main*" -o ./coverage/ # generate cobertura report for gitlab integration - pip3 install lcov_cobertura - grcov . --binary-path ./target/debug/ -s . -t lcov --llvm --branch --ignore-not-existing --ignore "*cargo*" --ignore "*main*" -o coverage.lcov - lcov --summary coverage.lcov - lcov_cobertura coverage.lcov coverage: '/\s*lines\.*:\s*([\d\.]+%)/' artifacts: paths: - 'coverage' reports: coverage_report: coverage_format: cobertura path: coverage.xml cargo-doc: stage: test needs: ["cargo-test"] script: - cargo doc --no-deps --all-features pages: stage: test needs: [ "cargo-test" ] script: - cargo doc --no-deps --all-features - cp -R target/doc/ ./public artifacts: paths: - 'public' rules: - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH # lint-code: # stage: extras # needs: [ "cargo-test" ] # script: # - rustup component add rustfmt # - cargo fmt -- --check # - rustup component add clippy # - cargo clippy -- -D warnings