Skip to content
This repository has been archived by the owner on Feb 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #29 from softprops/pages-deploy
Browse files Browse the repository at this point in the history
update travis build
  • Loading branch information
softprops committed Oct 20, 2018
2 parents 0c0ad2a + 812add3 commit 7bec2dc
Showing 1 changed file with 45 additions and 20 deletions.
65 changes: 45 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,78 @@ sudo: required

language: rust

# only build pushes to master
# prs are build separately
# https://docs.travis-ci.com/user/pull-requests/#how-pull-requests-are-built
branches:
only:
- master

matrix:
fast_finish: true
include:
- rust: nightly
- rust: nightly-2018-10-16
- rust: beta
- rust: stable
allow_failures:
- rust: nightly

script:
- cargo +nightly fmt --all -- --check
- cargo test
- 'if [ $TRAVIS_RUST_VERSION = nightly ]; then cargo bench; fi'
- |
if [[ "$TRAVIS_RUST_VERSION" == nightly-2018-10-16 ]]; then
cargo fmt --all -- --check
fi
- cargo test
- |
if [[ "$TRAVIS_RUST_VERSION" == nightly-2018-10-16 ]]; then
cargo bench
fi
# Cache `cargo install`ed tools, but don't cache the project's `target`
# directory (which ends up over-caching and filling all disk space!)
# https://levans.fr/rust_travis_cache.html
cache:
directories:
- /home/travis/.cargo

before_cache:
# But don't cache the cargo registry
- rm -rf /home/travis/.cargo/registry
# Travis can't cache files that are not readable by "others"
- chmod -R a+r $HOME/.cargo

cache:
cargo: true
apt: true

addons:
apt:
packages:
# required by tarpaulin code coverage tool
- libssl-dev

install: |
rustup toolchain install nightly
rustup component add rustfmt-preview --toolchain nightly
if [[ "$TRAVIS_RUST_VERSION" == stable ]]; then
`RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo +nightly install --force cargo-tarpaulin`
# should only be necessary until rustfmt produces consistent results in stable/nightly
# see also https://github.com/xd009642/tarpaulin/issues/150 for tarpaulin nightly dependency
if [[ "$TRAVIS_RUST_VERSION" == nightly-2018-10-16 ]]; then
`RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install --force cargo-tarpaulin`
rustup component add rustfmt-preview
fi
after_success:
# report coverage to coveralls
# see https://github.com/xd009642/tarpaulin for more information
- '[ $TRAVIS_EVENT_TYPE != "cron" ] &&
[ $TRAVIS_RUST_VERSION = stable ] &&
[ $TRAVIS_RUST_VERSION = nightly-2018-10-16 ] &&
[ $TRAVIS_BRANCH = master ] &&
[ $TRAVIS_PULL_REQUEST = false ] &&
cargo +nightly tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID || true'
cargo tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID || true'
- >-
[ $TRAVIS_RUST_VERSION = stable ] && [ $TRAVIS_BRANCH = master ] && [
$TRAVIS_PULL_REQUEST = false ] && cargo doc --no-deps && echo "<meta
http-equiv=refresh content=0;url=`echo $TRAVIS_REPO_SLUG | cut -d / -f
2`/index.html>" > target/doc/index.html && pip install --user ghp-import &&
/home/travis/.local/bin/ghp-import -n target/doc && git push -fq
https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages && echo
"documented"
2`/index.html>" > target/doc/index.html
deploy:
provider: pages
skip-cleanup: true
github-token: $GH_TOKEN
local-dir: target/doc
keep-history: false
on:
branch: master
condition: $TRAVIS_RUST_VERSION = stable

0 comments on commit 7bec2dc

Please sign in to comment.