Skip to content

Commit

Permalink
play with bash on AppVeyor
Browse files Browse the repository at this point in the history
Also consistently order and format our two CI files
  • Loading branch information
RalfJung committed May 11, 2020
1 parent 4c78479 commit 225978b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 106 deletions.
105 changes: 35 additions & 70 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,49 @@
environment:
global:
PROJECT_NAME: miri
matrix:
- TARGET: i686-pc-windows-msvc
global:
PROJECT_NAME: miri
matrix:
- TARGET: i686-pc-windows-msvc
# Immediately finish build once one of the jobs fails.
fast_finish: true
cache:
- '%USERPROFILE%\.cargo'
- '%USERPROFILE%\.rustup'

# branches to build
branches:
# whitelist
only:
- auto
- try

matrix:
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.

cache:
- '%USERPROFILE%\.cargo'
- '%USERPROFILE%\.rustup'
- auto
- try

install:
# Compute the rust version we use
- set /p RUSTC_HASH=<rust-version
# Install Rust
- curl -sSf --retry 3 -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host %TARGET% --default-toolchain stable --profile minimal
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
- rustup default stable
- rustup toolchain uninstall beta
- rustup update
# Install "master" toolchain
- cargo install rustup-toolchain-install-master
# We need to install cargo here as well or else the DLL search path inside `cargo run`
# will be for the wrong toolchain. (On Unix, `./miri` takes care of this, but not here.)
- rustup-toolchain-install-master -f -n master %RUSTC_HASH% -c rust-src -c rustc-dev -c cargo
- rustup default master
- rustc --version
- cargo --version

build_script:
- set RUSTFLAGS=-C debug-assertions
# Build and install miri
- cargo build --release --all-features --all-targets --locked
- cargo install --all-features --force --path . --locked --offline
# Compute the Rust version we use.
- set /p RUSTC_HASH=<rust-version
# Install Rust. We use the "stable" toolchain for better caching, it is just used to build `rustup-toolchain-install-master`.
# But we also need to take into account that the build cache might have a different, outdated default.
- curl -sSf --retry 3 -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host %TARGET% --default-toolchain none --profile minimal
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
- rustup default stable
- rustup toolchain uninstall beta nightly
- rustup update
# Install "master" toolchain.
# We need to install cargo here as well or else the DLL search path inside `cargo run`
# will be for the wrong toolchain. (On Unix, `./miri` takes care of this, but not here.)
- cargo install rustup-toolchain-install-master
- rustup-toolchain-install-master -f -n master %RUSTC_HASH% -c rust-src -c rustc-dev -c cargo
- rustup default master
- rustc --version
- cargo --version

test_script:
- set RUST_TEST_NOCAPTURE=1
- set RUST_BACKTRACE=1
- set CARGO_INCREMENTAL=0
# Test host miri: 32bit Windows
- cargo miri setup
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache\HOST
- cargo test --release --all-features --locked
- cd test-cargo-miri
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
- cd ..
- ps: $env:MIRI_SYSROOT = ""
# Test foreign miri: 64bit Linux
- cargo miri setup --target x86_64-unknown-linux-gnu
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache
- set MIRI_TEST_TARGET=x86_64-unknown-linux-gnu
- cargo test --release --all-features --locked
- cd test-cargo-miri
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
- cd ..
- ps: $env:MIRI_SYSROOT = ""
# Test foreign miri: 64bit macOS
- cargo miri setup --target x86_64-apple-darwin
- set MIRI_SYSROOT=%USERPROFILE%\AppData\Local\rust-lang\miri\cache
- set MIRI_TEST_TARGET=x86_64-apple-darwin
- cargo test --release --all-features --locked
- cd test-cargo-miri
- '"C:\msys64\mingw64\bin\python3.exe" run-test.py'
- cd ..
- ps: $env:MIRI_SYSROOT = ""
- bash ci.sh

after_test:
# Don't cache "master" toolchain, it's a waste
- rustup default stable
- rustup toolchain uninstall master
# Don't cache "master" toolchain, it's a waste.
- rustup default stable
- rustup toolchain uninstall master

notifications:
- provider: Email
on_build_success: false
- provider: Email
on_build_success: false
48 changes: 21 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,57 @@
language: generic
os:
- linux
- osx
dist: xenial
cache:
# Cache the global cargo directory, but NOT the local `target` directory which
# we cannot reuse anyway when the nightly changes (and it grows quite large
# over time).
directories:
- $HOME/.cargo
- $HOME/.rustup

os:
- linux
- osx
dist: xenial
- $HOME/.cargo
- $HOME/.rustup

# Run in PRs and for bors, but not on master.
branches:
only:
- master
- auto
- try
if: branch = auto OR branch = try OR type = pull_request OR type = cron

env:
global:
- RUST_TEST_NOCAPTURE=1
- RUST_BACKTRACE=1
- CARGO_INCREMENTAL=0

before_script:
# Compute the rust version we use. We do not use "language: rust" to have more control here.
# Compute the Rust version we use. We do not use "language: rust" to have more control here.
- |
if [[ "$TRAVIS_EVENT_TYPE" == cron ]]; then
RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}')
else
RUSTC_HASH=$(cat rust-version)
fi
# Install Rust ("stable" toolchain for better caching, it is just used to build rustup-toolchain-install-master)
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain stable --profile minimal
# Install Rust. We use the "stable" toolchain for better caching, it is just used to build `rustup-toolchain-install-master`.
# But we also need to take into account that the build cache might have a different, outdated default.
- curl https://build.travis-ci.org/files/rustup-init.sh -sSf | sh -s -- -y --default-toolchain none --profile minimal
- export PATH=$HOME/.cargo/bin:$PATH
- rustup default stable
- rustup toolchain uninstall beta
- rustup toolchain uninstall beta nightly
- rustup update
# Install "master" toolchain
# Install "master" toolchain.
- cargo install rustup-toolchain-install-master
- travis_retry rustup-toolchain-install-master -f -n master $RUSTC_HASH -c rust-src -c rustc-dev
- rustup default master
- rustc --version
- cargo --version

script:
- ./travis.sh
- ./ci.sh

before_cache:
# Don't cache "master" toolchain, it's a waste
# Don't cache "master" toolchain, it's a waste.
- rustup default stable
- rustup toolchain uninstall master

notifications:
email:
on_success: never
recipients:
- [email protected]
- [email protected]
branches:
only:
- master
- auto
- try
- [email protected]
- [email protected]
19 changes: 10 additions & 9 deletions travis.sh → ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
set -euo pipefail

# Determine configuration
export CARGO_EXTRA_FLAGS="--all-features"
export RUST_TEST_NOCAPTURE=1
export RUST_BACKTRACE=1
export RUSTC_EXTRA_FLAGS="-D warnings"
export CARGO_INCREMENTAL=0
export CARGO_EXTRA_FLAGS="--all-features"

# Prepare
echo "Build and install miri"
Expand Down Expand Up @@ -33,17 +36,15 @@ function run_tests {

# host
run_tests
# cross-test 32bit Linux from everywhere
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests

if [ "$TRAVIS_OS_NAME" == linux ]; then
# cross-test 64bit macOS from Linux
if [ "${TRAVIS_OS_NAME:-}" == linux ]; then
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
# cross-test 32bit Windows from Linux
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
elif [ "$TRAVIS_OS_NAME" == osx ]; then
# cross-test 64bit Windows from macOS
elif [ "${TRAVIS_OS_NAME:-}" == osx ]; then
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
# cross-test 32bit GNU Windows from macOS
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
elif [ "${CI_WINDOWS:-}" == True ]; then
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
fi

0 comments on commit 225978b

Please sign in to comment.