# The documentation for the contents of this file can be found at: # https://docs.gitlab.com/ce/ci/yaml/README.html # Official language image. Look for the different tagged releases at: # https://hub.docker.com/r/library/rust/tags/ # The recipe for this docker image can be found at: # https://github.com/rust-lang/docker-rust/blob/3898d19194231639f1afc3096bd04702eaf555e7/1.40.0/buster/Dockerfile image: "rust:1.40.0" stages: - build - test build:cargo: stage: build artifacts: paths: - target/ script: - rustc --version && cargo --version - cargo build --lib --tests --verbose - cargo build --lib --tests --verbose --release test:cargo: stage: test dependencies: - build:cargo script: - cargo test --verbose lint:clippy: stage: test dependencies: - build:cargo script: - rustup component add clippy - cargo clippy --all-targets --all-features -- -D warnings coverage:kcov: stage: test dependencies: - build:cargo artifacts: expire_in: never paths: - kcov/ coverage: '/^Coverage+:\s(\d+(?:\.\d+)?)/' script: - echo 'deb http://deb.debian.org/debian testing main' >> /etc/apt/sources.list - echo 'deb http://deb.debian.org/debian unstable main' >> /etc/apt/sources.list - apt-get update - apt-get install --assume-yes kcov - files=$(find target/debug -maxdepth 1 -type f -executable -iname "*-????????????????"); covs=""; for file in ${files}; do cov="kcov-$(basename ${file})"; kcov --exclude-pattern=/usr/ --verify "${cov}" "${file}"; covs+=" ${cov}"; done; kcov --merge kcov/ ${covs}; COVERAGE=$(grep --only-matching 'covered":"[^"]\+"' kcov/index.js | awk -F'"' '{print $3}'); echo "Coverage:" ${COVERAGE};