diff options
author | Vincent Breitmoser <look@my.amazin.horse> | 2019-01-02 23:12:39 +0100 |
---|---|---|
committer | Vincent Breitmoser <look@my.amazin.horse> | 2019-01-02 23:12:49 +0100 |
commit | ce7efce753947046c2bbcb2f8a2796818b7e8fee (patch) | |
tree | 624224dfce1b4f9a830ac0003d39e39830dc2d56 /.circleci | |
parent | cc196807bbc3c263c176d3d08e076d250ab61d6c (diff) |
update ci for coverage (wip)
Diffstat (limited to '.circleci')
-rw-r--r-- | .circleci/config.yml | 114 |
1 files changed, 101 insertions, 13 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index aea17ac..aed3a50 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,22 +1,110 @@ +version: 2 jobs: - build: + cargo_fetch: docker: - image: puzzlewolf/rust-libical3:0.2 - + working_directory: /mnt/crate steps: - checkout - restore_cache: - key: project-cache - + keys: + - cargo-v1-{{ checksum "Cargo.toml" }}- + - cargo-v1- + - run: cargo update + - run: cargo fetch + - persist_to_workspace: + root: "." + paths: + - Cargo.lock + - save_cache: + key: cargo-v1-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} + paths: + - /usr/local/cargo/registry + - /usr/local/cargo/git + test: + docker: + - image: puzzlewolf/rust-libical3:0.2 + working_directory: /mnt/crate + steps: + - checkout + - attach_workspace: + at: "." + - restore_cache: + keys: + - cargo-v1-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }} - run: - name: Build - command: cargo build + name: Print version information + command: rustc --version; cargo --version - run: - name: Running tests - command: cargo test - - - save_cache: - key: project-cache + name: Build and test + command: cargo test --verbose --frozen + environment: + # Need this for the coverage run + RUSTFLAGS: "-C link-dead-code" + - run: + name: Prune the output files + command: | + for file in target/debug/* target/debug/.??*; do + [ -d $file -o ! -x $file ] && rm -r $file + done + - persist_to_workspace: + root: "." + paths: + - target/debug/* + coverage: + docker: + - image: ragnaroek/kcov:v33 + entrypoint: /bin/bash + working_directory: /mnt/crate + steps: + - checkout + - attach_workspace: + at: "." + - run: mkdir target/coverage + - run: + name: Rerun the tests collecting coverage + command: | + for file in ./target/debug/*; do + if test -x $file; then + kcov --verify --exclude-pattern=tests \ + target/coverage/$(basename $file) \ + $file --quiet + fi + done + kcov --merge target/coverage-merged target/coverage/* + - store_artifacts: + path: target/coverage + destination: coverage + - store_artifacts: + path: target/coverage-merged + destination: coverage-merged + - persist_to_workspace: + root: "." paths: - - "~/.cargo" - - "./target" + - target/coverage + codecov_upload: + docker: + - image: buildpack-deps:curl + working_directory: /mnt/crate + steps: + - checkout + - attach_workspace: + at: "." + - run: + name: Upload to Codecov + command: bash <(curl -s https://codecov.io/bash) + +workflows: + version: 2 + test_all_and_coverage: + jobs: + - cargo_fetch + - test: + requires: + - cargo_fetch + - coverage: + requires: + - test + - codecov_upload: + requires: + - coverage |