travis: use rustup instead of Travis built-in Rust support
this ensures we install the correct set of standard crates when working in the beta channel
This commit is contained in:
parent
10e7a41d92
commit
334540835c
56
.travis.yml
56
.travis.yml
|
@ -1,6 +1,6 @@
|
|||
sudo: false
|
||||
|
||||
language: rust
|
||||
language: generic
|
||||
|
||||
env:
|
||||
global:
|
||||
|
@ -10,73 +10,59 @@ matrix:
|
|||
include:
|
||||
# Stable channel
|
||||
- os: osx
|
||||
env: TARGET=i686-apple-darwin
|
||||
rust: stable
|
||||
env: TARGET=i686-apple-darwin CHANNEL=stable
|
||||
- os: linux
|
||||
env: TARGET=i686-unknown-linux-gnu
|
||||
rust: stable
|
||||
env: TARGET=i686-unknown-linux-gnu CHANNEL=stable
|
||||
addons:
|
||||
apt:
|
||||
packages: &i686_unknown_linux_gnu
|
||||
- gcc-multilib
|
||||
- os: osx
|
||||
env: TARGET=x86_64-apple-darwin
|
||||
rust: stable
|
||||
env: TARGET=x86_64-apple-darwin CHANNEL=stable
|
||||
- os: linux
|
||||
env: TARGET=x86_64-unknown-linux-gnu
|
||||
rust: stable
|
||||
env: TARGET=x86_64-unknown-linux-gnu CHANNEL=stable
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- nodejs
|
||||
- npm
|
||||
- os: linux
|
||||
env: TARGET=x86_64-unknown-linux-musl
|
||||
rust: stable
|
||||
env: TARGET=x86_64-unknown-linux-musl CHANNEL=stable
|
||||
# Beta channel
|
||||
- os: osx
|
||||
env: TARGET=i686-apple-darwin
|
||||
rust: beta
|
||||
env: TARGET=i686-apple-darwin CHANNEL=beta
|
||||
- os: linux
|
||||
env: TARGET=i686-unknown-linux-gnu
|
||||
rust: beta
|
||||
env: TARGET=i686-unknown-linux-gnu CHANNEL=beta
|
||||
addons:
|
||||
apt:
|
||||
packages: *i686_unknown_linux_gnu
|
||||
- os: osx
|
||||
env: TARGET=x86_64-apple-darwin
|
||||
rust: beta
|
||||
env: TARGET=x86_64-apple-darwin CHANNEL=beta
|
||||
- os: linux
|
||||
env: TARGET=x86_64-unknown-linux-gnu
|
||||
rust: beta
|
||||
env: TARGET=x86_64-unknown-linux-gnu CHANNEL=beta
|
||||
- os: linux
|
||||
env: TARGET=x86_64-unknown-linux-musl
|
||||
rust: beta
|
||||
env: TARGET=x86_64-unknown-linux-musl CHANNEL=beta
|
||||
# Nightly channel
|
||||
- os: osx
|
||||
env: TARGET=i686-apple-darwin
|
||||
rust: nightly
|
||||
env: TARGET=i686-apple-darwin CHANNEL=nightly
|
||||
- os: linux
|
||||
env: TARGET=i686-unknown-linux-gnu
|
||||
rust: nightly
|
||||
env: TARGET=i686-unknown-linux-gnu CHANNEL=nightly
|
||||
addons:
|
||||
apt:
|
||||
packages: *i686_unknown_linux_gnu
|
||||
- os: osx
|
||||
env: TARGET=x86_64-apple-darwin
|
||||
rust: nightly
|
||||
env: TARGET=x86_64-apple-darwin CHANNEL=nightly
|
||||
- os: linux
|
||||
env: TARGET=x86_64-unknown-linux-gnu
|
||||
rust: nightly
|
||||
env: TARGET=x86_64-unknown-linux-gnu CHANNEL=nightly
|
||||
- os: linux
|
||||
env: TARGET=x86_64-unknown-linux-musl
|
||||
rust: nightly
|
||||
env: TARGET=x86_64-unknown-linux-musl CHANNEL=nightly
|
||||
|
||||
install:
|
||||
- sh ci/install.sh
|
||||
- export PATH="$PATH:$HOME/.cargo/bin"
|
||||
- bash ci/install.sh
|
||||
|
||||
script:
|
||||
- sh ci/script.sh
|
||||
- bash ci/script.sh
|
||||
|
||||
after_success:
|
||||
- test $TRAVIS_PULL_REQUEST == "false" &&
|
||||
|
@ -87,7 +73,7 @@ after_success:
|
|||
bash deploy.sh
|
||||
|
||||
before_deploy:
|
||||
- sh ci/before_deploy.sh
|
||||
- bash ci/before_deploy.sh
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
|
@ -98,7 +84,7 @@ deploy:
|
|||
skip_cleanup: true
|
||||
# deploy when a new tag is pushed
|
||||
on:
|
||||
condition: $TRAVIS_RUST_VERSION = stable
|
||||
condition: $CHANNEL = stable
|
||||
tags: true
|
||||
|
||||
notifications:
|
||||
|
|
|
@ -2,12 +2,31 @@
|
|||
|
||||
set -ex
|
||||
|
||||
mktempd() {
|
||||
echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||
}
|
||||
|
||||
mk_artifacts() {
|
||||
cargo build --target $TARGET --release
|
||||
}
|
||||
|
||||
mkdir staging
|
||||
mk_tarball() {
|
||||
local td=$(mktempd)
|
||||
local out_dir=$(pwd)
|
||||
|
||||
cp target/$TARGET/release/mdbook staging
|
||||
cp target/$TARGET/release/mdbook $td
|
||||
|
||||
cd staging
|
||||
pushd $td
|
||||
|
||||
tar czf ../${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz *
|
||||
tar czf $out_dir/${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz *
|
||||
|
||||
popd $td
|
||||
rm -r $td
|
||||
}
|
||||
|
||||
main() {
|
||||
mk_artifacts
|
||||
mk_tarball
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
@ -2,32 +2,57 @@
|
|||
|
||||
set -ex
|
||||
|
||||
case $TARGET in
|
||||
# Install standard libraries needed for cross compilation
|
||||
i686-apple-darwin | \
|
||||
i686-unknown-linux-gnu | \
|
||||
x86_64-unknown-linux-musl)
|
||||
case $TRAVIS_RUST_VERSION in
|
||||
stable)
|
||||
# e.g. 1.6.0
|
||||
version=$(rustc -V | cut -d' ' -f2)
|
||||
case "$TRAVIS_OS_NAME" in
|
||||
linux)
|
||||
host=x86_64-unknown-linux-gnu
|
||||
;;
|
||||
*)
|
||||
version=$TRAVIS_RUST_VERSION
|
||||
osx)
|
||||
host=x86_64-apple-darwin
|
||||
;;
|
||||
esac
|
||||
tarball=rust-std-${version}-${TARGET}
|
||||
|
||||
curl -Os http://static.rust-lang.org/dist/${tarball}.tar.gz
|
||||
mktempd() {
|
||||
echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||
}
|
||||
|
||||
tar xzf ${tarball}.tar.gz
|
||||
install_rustup() {
|
||||
local td=$(mktempd)
|
||||
|
||||
${tarball}/install.sh --prefix=$(rustc --print sysroot)
|
||||
pushd $td
|
||||
curl -O https://static.rust-lang.org/rustup/dist/$host/rustup-setup
|
||||
chmod +x rustup-setup
|
||||
./rustup-setup -y
|
||||
popd
|
||||
|
||||
rm -r ${tarball}
|
||||
rm ${tarball}.tar.gz
|
||||
;;
|
||||
# Nothing to do for native builds
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
rm -r $td
|
||||
|
||||
rustup default $CHANNEL
|
||||
rustc -V
|
||||
cargo -V
|
||||
}
|
||||
|
||||
install_standard_crates() {
|
||||
if [ "$host" != "$TARGET" ]; then
|
||||
if [ ! "$CHANNEL" = "stable" ]; then
|
||||
rustup target add $TARGET
|
||||
else
|
||||
local version=$(rustc -V | cut -d' ' -f2)
|
||||
local tarball=rust-std-${version}-${TARGET}
|
||||
|
||||
local td=$(mktempd)
|
||||
curl -s https://static.rust-lang.org/dist/${tarball}.tar.gz | \
|
||||
tar --strip-components 1 -C $td -xz
|
||||
|
||||
$td/install.sh --prefix=$(rustc --print sysroot)
|
||||
|
||||
rm -r $td
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
install_rustup
|
||||
install_standard_crates
|
||||
}
|
||||
|
||||
main
|
||||
|
|
17
ci/script.sh
17
ci/script.sh
|
@ -2,6 +2,10 @@
|
|||
|
||||
set -ex
|
||||
|
||||
# NOTE Workaround for rust-lang/rust#31907 - disable doc tests when cross compiling
|
||||
# This has been fixed in the nightly channel but it would take a while to reach the other channels
|
||||
disable_cross_doctests() {
|
||||
local host
|
||||
case "$TRAVIS_OS_NAME" in
|
||||
linux)
|
||||
host=x86_64-unknown-linux-gnu
|
||||
|
@ -11,14 +15,23 @@ case "$TRAVIS_OS_NAME" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# NOTE Workaround for rust-lang/rust#31907 - disable doc tests when crossing
|
||||
if [ "$host" != "$TARGET" ]; then
|
||||
if [ "$host" != "$TARGET" ] && [ "$CHANNEL" != "nightly" ]; then
|
||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||
brew install gnu-sed --default-names
|
||||
fi
|
||||
|
||||
find src -name '*.rs' -type f | xargs sed -i -e 's:\(//.\s*```\):\1 ignore,:g'
|
||||
fi
|
||||
}
|
||||
|
||||
run_test_suite() {
|
||||
cargo build --target $TARGET --verbose
|
||||
cargo test --target $TARGET --verbose
|
||||
}
|
||||
|
||||
main() {
|
||||
disable_cross_doctests
|
||||
run_test_suite
|
||||
}
|
||||
|
||||
main
|
||||
|
|
Loading…
Reference in New Issue