From e4b8dde1d31b02372d853e47f63938c93651f584 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Thu, 14 Sep 2017 18:33:34 -0500 Subject: [PATCH] Split Travis build into stages (#62) Adds code coverage checking. --- .travis.yml | 58 ++++++++++++++++++++++++++++++++--------------------- Cargo.toml | 9 +++++++++ README.md | 1 + codecov.yml | 18 +++++++++++++++++ 4 files changed, 63 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 38cf179..f99684c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,43 +1,55 @@ --- language: rust +dist: trusty sudo: false -cache: cargo +cache: + cargo: true + apt: true addons: apt: packages: - - libcurl4-openssl-dev - - libelf-dev - - libdw-dev + - libssl-dev -matrix: - include: - - rust: stable - - rust: beta - - rust: nightly - install: - - pip install --user travis-cargo codecov && export PATH=$HOME/.local/bin:$PATH - - if ! cargo fmt --help >/dev/null 2>&1 ; then cargo install rustfmt-nightly ; fi - after_script: - # Check formatting - - cargo fmt -- --write-mode=diff - after_success: - - travis-cargo doc-upload +rust: +- nightly +- beta +- stable script: # Run tests - cargo test # Test examples in readme - rustdoc --test README.md -L target/debug/deps - # Generate docs - - cargo doc --no-deps after_success: - # generate kcov coverage data - - travis-cargo coverage --no-sudo - # upload to codecov.io - - codecov --file target/kcov/kcov-merged/cobertura.xml + - bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh) + - cargo tarpaulin --out Xml -- --skip hpack && bash <(curl -s https://codecov.io/bash) + +jobs: + allow_failures: + - rust: nightly + include: + - stage: docs + script: cargo doc --no-deps + install: skip + deploy: + provider: pages + skip_cleanup: true + github_token: $GH_TOKEN + target_branch: gh-pages + local_dir: target/doc + on: + branch: master + repo: carllerche/h2 + rust: nightly + after_success: skip + - stage: fmt + rust: nightly + install: if ! cargo fmt --help >/dev/null 2>&1 ; then cargo install rustfmt-nightly ; fi + script: cargo fmt -- --write-mode=diff + after_success: skip env: global: diff --git a/Cargo.toml b/Cargo.toml index 6ee36b8..ec99924 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,15 @@ name = "h2" version = "0.1.0" authors = ["Carl Lerche "] +[badges.travis-ci] +repository = "carllerche/h2" +branch = "master" + +[badges.codecov] +repository = "carllerche/h2" +branch = "master" +service = "github" + [features] # Enables **unstable** APIs. Any API exposed by this feature has no backwards diff --git a/README.md b/README.md index 6c215f8..49af472 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ A Tokio aware, HTTP/2.0 client & server implementation for Rust. [![Build Status](https://travis-ci.org/carllerche/h2.svg?branch=master)](https://travis-ci.org/carllerche/h2) +[![Codecov](https://img.shields.io/codecov/c/github/carllerche/h2.svg)](https://codecov.io/gh/carllerche/h2) diff --git a/codecov.yml b/codecov.yml index e69de29..1fab7de 100644 --- a/codecov.yml +++ b/codecov.yml @@ -0,0 +1,18 @@ +codecov: + notify: + require_ci_to_pass: true + +coverage: + ignore: + - tests/.* + notify: + slack: + default: + url: "https://hooks.slack.com/services/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" + threshold: 1% + only_pulls: false + branches: null + flags: null + paths: null + +comment: off