-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.travis.yml
110 lines (97 loc) · 3.14 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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:
# release tags
- /^v\d+\.\d+\.\d+.*$/
- master
# Cache `cargo install`ed tools, but don't cache the project's `target`
# directory (which ends up over-caching and filling all disk space!)
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
# yaml ref for deploying release binary to github
DEPLOY_TO_GITHUB: &DEPLOY_TO_GITHUB
before_deploy:
- name="codeowners-$TRAVIS_TAG-$OS-$ARCH"
- src=$(pwd)
- mkdir $name
- strip target/$TARGET/release/codeowners
- cp target/$TARGET/release/codeowners $name/
- cd $name
- tar czvf $src/$name.tar.gz *
- cd $src
- rm -rf $name
deploy:
provider: releases
api_key: $GH_TOKEN
file: codeowners-$TRAVIS_TAG-$OS-$ARCH.tar.gz
skip_cleanup: true
on:
tags: true
install: |
if [ "$TRAVIS_RUST_VERSION" == nightly ] && [ $TRAVIS_BRANCH = master ]; then
cargo install cargo-update || echo "cargo-update already installed"
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin || echo "cargo-tarpaulin already installed"
cargo install-update -a
# should only be necessary until rustfmt produces consistent results in stable/nightly
rustup component add rustfmt
fi
matrix:
include:
- name: Unit Tests
env: RUST_BACKTRACE=1
rust: nightly
script:
- cargo test
- rustup component add rustfmt
- cargo fmt --version
- cargo fmt --all -- --check
- name: Linux Binary
env: TARGET=x86_64-unknown-linux-musl OS=Linux ARCH=x86_64
rust: stable
before_script:
- rustup target add $TARGET
script: cargo build --release --target $TARGET
addons:
apt:
packages:
- musl-tools
<<: *DEPLOY_TO_GITHUB
- name: macOS Binary
env: MACOSX_DEPLOYMENT_TARGET=10.7 TARGET=x86_64-apple-darwin OS=Darwin ARCH=x86_64
os: osx
rust: stable
script: cargo build --release --target $TARGET
install: true
<<: *DEPLOY_TO_GITHUB
addons:
apt:
packages:
- musl-tools
# required by tarpaulin code coverage tool
- libssl-dev
after_success:
# report coverage to coveralls
# see https://github.com/xd009642/tarpaulin for more information
- '[ $TRAVIS_RUST_VERSION = nightly ] &&
[ $TRAVIS_BRANCH = master ] &&
[ $TRAVIS_PULL_REQUEST = false ] &&
cargo tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID || true'
- '[ $TRAVIS_RUST_VERSION = nightly ] &&
[ $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"'