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
|
sudo: false
|
||||||
|
|
||||||
language: rust
|
language: generic
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
@ -10,73 +10,59 @@ matrix:
|
||||||
include:
|
include:
|
||||||
# Stable channel
|
# Stable channel
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TARGET=i686-apple-darwin
|
env: TARGET=i686-apple-darwin CHANNEL=stable
|
||||||
rust: stable
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=i686-unknown-linux-gnu
|
env: TARGET=i686-unknown-linux-gnu CHANNEL=stable
|
||||||
rust: stable
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages: &i686_unknown_linux_gnu
|
packages: &i686_unknown_linux_gnu
|
||||||
- gcc-multilib
|
- gcc-multilib
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TARGET=x86_64-apple-darwin
|
env: TARGET=x86_64-apple-darwin CHANNEL=stable
|
||||||
rust: stable
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
env: TARGET=x86_64-unknown-linux-gnu CHANNEL=stable
|
||||||
rust: stable
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- nodejs
|
- nodejs
|
||||||
- npm
|
- npm
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=x86_64-unknown-linux-musl
|
env: TARGET=x86_64-unknown-linux-musl CHANNEL=stable
|
||||||
rust: stable
|
|
||||||
# Beta channel
|
# Beta channel
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TARGET=i686-apple-darwin
|
env: TARGET=i686-apple-darwin CHANNEL=beta
|
||||||
rust: beta
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=i686-unknown-linux-gnu
|
env: TARGET=i686-unknown-linux-gnu CHANNEL=beta
|
||||||
rust: beta
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages: *i686_unknown_linux_gnu
|
packages: *i686_unknown_linux_gnu
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TARGET=x86_64-apple-darwin
|
env: TARGET=x86_64-apple-darwin CHANNEL=beta
|
||||||
rust: beta
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
env: TARGET=x86_64-unknown-linux-gnu CHANNEL=beta
|
||||||
rust: beta
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=x86_64-unknown-linux-musl
|
env: TARGET=x86_64-unknown-linux-musl CHANNEL=beta
|
||||||
rust: beta
|
|
||||||
# Nightly channel
|
# Nightly channel
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TARGET=i686-apple-darwin
|
env: TARGET=i686-apple-darwin CHANNEL=nightly
|
||||||
rust: nightly
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=i686-unknown-linux-gnu
|
env: TARGET=i686-unknown-linux-gnu CHANNEL=nightly
|
||||||
rust: nightly
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages: *i686_unknown_linux_gnu
|
packages: *i686_unknown_linux_gnu
|
||||||
- os: osx
|
- os: osx
|
||||||
env: TARGET=x86_64-apple-darwin
|
env: TARGET=x86_64-apple-darwin CHANNEL=nightly
|
||||||
rust: nightly
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
env: TARGET=x86_64-unknown-linux-gnu CHANNEL=nightly
|
||||||
rust: nightly
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TARGET=x86_64-unknown-linux-musl
|
env: TARGET=x86_64-unknown-linux-musl CHANNEL=nightly
|
||||||
rust: nightly
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- sh ci/install.sh
|
- export PATH="$PATH:$HOME/.cargo/bin"
|
||||||
|
- bash ci/install.sh
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- sh ci/script.sh
|
- bash ci/script.sh
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- test $TRAVIS_PULL_REQUEST == "false" &&
|
- test $TRAVIS_PULL_REQUEST == "false" &&
|
||||||
|
@ -87,7 +73,7 @@ after_success:
|
||||||
bash deploy.sh
|
bash deploy.sh
|
||||||
|
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- sh ci/before_deploy.sh
|
- bash ci/before_deploy.sh
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
@ -98,7 +84,7 @@ deploy:
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
# deploy when a new tag is pushed
|
# deploy when a new tag is pushed
|
||||||
on:
|
on:
|
||||||
condition: $TRAVIS_RUST_VERSION = stable
|
condition: $CHANNEL = stable
|
||||||
tags: true
|
tags: true
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
|
|
|
@ -2,12 +2,31 @@
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
mktempd() {
|
||||||
|
echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||||
|
}
|
||||||
|
|
||||||
|
mk_artifacts() {
|
||||||
cargo build --target $TARGET --release
|
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
|
set -ex
|
||||||
|
|
||||||
case $TARGET in
|
case "$TRAVIS_OS_NAME" in
|
||||||
# Install standard libraries needed for cross compilation
|
linux)
|
||||||
i686-apple-darwin | \
|
host=x86_64-unknown-linux-gnu
|
||||||
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)
|
|
||||||
;;
|
;;
|
||||||
*)
|
osx)
|
||||||
version=$TRAVIS_RUST_VERSION
|
host=x86_64-apple-darwin
|
||||||
;;
|
;;
|
||||||
esac
|
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 -r $td
|
||||||
rm ${tarball}.tar.gz
|
|
||||||
;;
|
rustup default $CHANNEL
|
||||||
# Nothing to do for native builds
|
rustc -V
|
||||||
*)
|
cargo -V
|
||||||
;;
|
}
|
||||||
esac
|
|
||||||
|
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
|
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
|
case "$TRAVIS_OS_NAME" in
|
||||||
linux)
|
linux)
|
||||||
host=x86_64-unknown-linux-gnu
|
host=x86_64-unknown-linux-gnu
|
||||||
|
@ -11,14 +15,23 @@ case "$TRAVIS_OS_NAME" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# NOTE Workaround for rust-lang/rust#31907 - disable doc tests when crossing
|
if [ "$host" != "$TARGET" ] && [ "$CHANNEL" != "nightly" ]; then
|
||||||
if [ "$host" != "$TARGET" ]; then
|
|
||||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
brew install gnu-sed --default-names
|
brew install gnu-sed --default-names
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find src -name '*.rs' -type f | xargs sed -i -e 's:\(//.\s*```\):\1 ignore,:g'
|
find src -name '*.rs' -type f | xargs sed -i -e 's:\(//.\s*```\):\1 ignore,:g'
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_test_suite() {
|
||||||
cargo build --target $TARGET --verbose
|
cargo build --target $TARGET --verbose
|
||||||
cargo test --target $TARGET --verbose
|
cargo test --target $TARGET --verbose
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
disable_cross_doctests
|
||||||
|
run_test_suite
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
|
|
Loading…
Reference in New Issue