-
Notifications
You must be signed in to change notification settings - Fork 7
/
.travis.yml
71 lines (60 loc) · 1.97 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
language: rust
rust:
- 1.23.0
- 1.24.0
- 1.25.0
- 1.26.0
- 1.27.0
- 1.28.0
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
include:
# Rustfmt
- env: RUSTFMT_VERSION="0.4.1"
rust: nightly-2018-04-01
install:
- rustup component add rustfmt-preview
- cargo install rustfmt-nightly --force --version $RUSTFMT_VERSION || echo "rustfmt already installed"
before_script:
- cargo-fmt fmt -- --version
script:
- cargo fmt -- --write-mode=diff
# Clippy
- env: CLIPPY_VERSION="0.0.191"
rust: nightly-2018-04-01
install:
- travis_wait cargo install clippy --force --version $CLIPPY_VERSION || echo "clippy already installed"
script:
# Fail if clippy output contains "error:" or "warning:"
- cargo clippy 2>&1 | tee ./clippy.out && ! grep -qe "error:\|warning:" ./clippy.out
# Test coverage (with Tarpaulin)
- env: TARPAULIN_VERSION="0.5.6"
rust: stable
# To avoid "Error: EPERM: operation not permitted" error (see https://github.com/valery-barysok/session-file-store/issues/58)
sudo: true
install:
- curl -sL https://github.com/xd009642/tarpaulin/releases/download/$TARPAULIN_VERSION/cargo-tarpaulin-$TARPAULIN_VERSION-travis.tar.gz | tar xvz -C $HOME/.cargo/bin
script:
- cargo tarpaulin --verbose > ./tarpaulin.out
# Fetch coverage percentage (integer)
- COVERAGE=$(cat ./tarpaulin.out | awk -F '.' '/coverage/ { print $1 }')
- echo COVERAGE=${COVERAGE}
# Print uncoverted lines
- 'echo "UNCOVERED LINES" && grep "hits: 0" ./tarpaulin.out'
# Exit 1, if coverage is less than 89%
- if [ $COVERAGE -lt 89 ]; then exit 0; fi
cache:
cargo: true
before_cache:
# Travis can't cache files that are not readable by "others"
- chmod -R a+r $HOME/.cargo
script:
- cargo test
addons:
apt:
packages:
- libssl-dev # Required for tarpaulin