Skip to content

Commit d89b384

Browse files
authored
Merge pull request #116 from async-rs/install-mdbook-bin
Implement installation using trust
2 parents 8dff895 + 192c968 commit d89b384

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

.travis.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
11
language: rust
22

3-
env:
4-
- RUSTFLAGS="-D warnings"
5-
63
matrix:
74
fast_finish: true
85
include:
96
- rust: nightly
107
os: linux
11-
env: BUILD_DOCS=1 BUILD_BOOK=1
8+
env: RUSTFLAGS="-D warnings" BUILD_DOCS=1 BUILD_BOOK=1
129
- rust: nightly
1310
os: osx
1411
osx_image: xcode9.2
15-
env: BUILD_DOCS=1
12+
env: RUSTFLAGS="-D warnings" BUILD_DOCS=1
1613
- rust: nightly-x86_64-pc-windows-msvc
1714
os: windows
15+
env: RUSTFLAGS="-D warnings"
1816

1917
before_script:
2018
- rustup component add rustfmt
21-
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
22-
- (test -x $HOME/.cargo/bin/mdbook || cargo install --vers "^0.3" mdbook)
23-
- cargo install-update -a
19+
- if [[ -n "$BUILD_BOOK" ]]; then (test -x $HOME/.cargo/bin/mdbook || ./ci/install-mdbook.sh); fi
2420

2521
script:
26-
- if ![[ -n "$BUILD_BOOK" ]]; then cargo check --all --benches --bins --examples --tests && cargo test --all; fi
27-
- if [[ -n "$BUILD_BOOK" ]]; then cargo test --all --benches --bins --examples --tests; fi
22+
- if ! [[ -n "$BUILD_BOOK" ]]; then cargo check --all --benches --bins --examples --tests && cargo test --all; fi
23+
- if [[ -n "$BUILD_BOOK" ]]; then cargo test --all --benches --bins --examples --tests; fi
2824
- cargo fmt --all -- --check
29-
- if [[ -n "$BUILD_DOCS" ]]; then cargo doc --features docs; fi
30-
- if [[ -n "$BUILD_BOOK" ]]; then mdbook build docs && mdbook test -L ./target/debug/deps docs; fi
25+
- if [[ -n "$BUILD_DOCS" ]]; then cargo doc --features docs; fi
26+
- if [[ -n "$BUILD_BOOK" ]]; then mdbook build docs && mdbook test -L ./target/debug/deps docs; fi

ci/install-mdbook.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
set -euxo pipefail
2+
3+
# Based on the Rust-Embedded WG's book CI
4+
# https://github.com/rust-embedded/book/blob/master/ci/install.sh
5+
6+
main() {
7+
# Note - this will only accept releases tagged with v0.3.x
8+
local tag=$(git ls-remote --tags --refs --exit-code \
9+
https://github.com/rust-lang-nursery/mdbook \
10+
| cut -d/ -f3 \
11+
| grep -E '^v0\.3\.[0-9]+$' \
12+
| sort \
13+
| tail -n1)
14+
15+
curl -LSfs https://japaric.github.io/trust/install.sh | \
16+
sh -s -- --git rust-lang-nursery/mdbook --tag $tag
17+
}
18+
19+
main

0 commit comments

Comments
 (0)