diff --git a/.appveyor.yml b/.appveyor.yml index 5cb5267a6d..cf129c14d8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -18,6 +18,8 @@ branches: - try install: +# Setting build env +- set RUST_OS_NAME=Windows # Compute the Rust version we use. - set /p RUSTC_HASH=> $GITHUB_ENV + shell: bash + + # We install gnu-tar because BSD tar is buggy on Github's macos machines. + # See . + - name: Install GNU tar + if: runner.os == 'macOS' + run: | + brew install gnu-tar + echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH + + # 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). + - name: Add cache for cargo + uses: actions/cache@v2 + with: + path: | + # to avoid saving rustup proxy, save xargo and RTIM in separate dir. + ~/.cargo/ci + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo + + # 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. + - name: Install stable Rust + run: | + # rustup toolchain uninstall beta nightly master + rustup override unset + rustup toolchain install stable + rustup default stable + + - name: Install RTIM + run: | + cargo install --root ~/.cargo/ci --debug rustup-toolchain-install-master + echo "$HOME/.cargo/ci/bin" >> $GITHUB_PATH + shell: bash + + - name: Install xargo + run: | + cargo install --root ~/.cargo/ci --debug xargo + shell: bash + + - name: Install "master" toolchain + run: | + if [[ ${{ github.event_name }} == 'schedule' ]]; then + RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}') + else + RUSTC_HASH=$(< rust-version) + fi + rustup-toolchain-install-master \ + -f \ + -n master "$RUSTC_HASH" \ + -c rust-src \ + -c rustc-dev \ + -c llvm-tools \ + --host ${{ matrix.host_target }} + rustup default master + shell: bash + + - name: Inspect Rust version + run: | + rustup show + rustc -Vv + cargo -V + + - name: Test + if: false + run: bash ./ci.sh + + # Don't cache "master" toolchain, it's a waste. + - name: Before caching + run: | + # Binary artifacts is saved in `ci/bin` dir. + strip ~/.cargo/ci/bin/* + shell: bash + + rustfmt: + runs-on: ubuntu-latest + # FIXME: the project isn't fmt-ed yet. + if: false + steps: + - uses: actions/checkout@v2 + - run: rustup toolchain install stable -c rustfmt + - run: | + cargo fmt -- --check + # Some are not in cargo workspace. + git ls-files 'bench*/*.rs' | xargs rustfmt --check + git ls-files 'cargo-miri/*.rs' | xargs rustfmt --check + git ls-files 'tests*/*.rs' | xargs rustfmt --check diff --git a/.travis.yml b/.travis.yml index fcef17b124..7acd263b18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,19 @@ before_script: else RUSTC_HASH=$(cat rust-version) fi +# Setting build env +- | + case $TRAVIS_OS_NAME in + linux ) + export RUST_OS_NAME=Linux + ;; + osx ) + export RUST_OS_NAME=macOS + ;; + * ) + echo "Doesn't know this OS" + exit 1; + esac # 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 diff --git a/README.md b/README.md index 2b01510482..418b7a1ee3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ -# Miri [![Build Status](https://travis-ci.com/rust-lang/miri.svg?branch=master)](https://travis-ci.com/rust-lang/miri) [![Windows build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/miri?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/miri) +# Miri +[![Actions build status][actions-badge]][actions-url] +[![Travis build status](https://travis-ci.com/rust-lang/miri.svg?branch=master)](https://travis-ci.com/rust-lang/miri) +[![Appveyor Windows build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/miri?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/miri) + +[actions-badge]: https://github.com/rust-lang/miri/workflows/CI/badge.svg?branch=master +[actions-url]: https://github.com/rust-lang/miri/actions An experimental interpreter for [Rust][rust]'s [mid-level intermediate representation][mir] (MIR). It can run binaries and diff --git a/ci.sh b/ci.sh index a6daa80645..575e72ee1f 100755 --- a/ci.sh +++ b/ci.sh @@ -23,32 +23,43 @@ function run_tests { fi ./miri test --locked - if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then + if [ -z "${MIRI_TEST_TARGET+exists}" ]; then # Only for host architecture: tests with MIR optimizations #FIXME: Only testing opt level 1 due to . MIRIFLAGS="-Z mir-opt-level=1" ./miri test --locked fi + + if command -v python3; then + PYTHON=python3 + else + PYTHON=python + fi + # "miri test" has built the sysroot for us, now this should pass without # any interactive questions. - ${PYTHON:-python3} test-cargo-miri/run-test.py - + ${PYTHON} test-cargo-miri/run-test.py echo } # host run_tests -if [ "${TRAVIS_OS_NAME:-}" == linux ]; then - MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests - MIRI_TEST_TARGET=x86_64-apple-darwin run_tests - MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests -elif [ "${TRAVIS_OS_NAME:-}" == osx ]; then - MIRI_TEST_TARGET=mips64-unknown-linux-gnuabi64 run_tests # big-endian architecture - MIRI_TEST_TARGET=x86_64-pc-windows-msvc 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 -else - echo "FATAL: unknown CI platform" - exit 1 -fi +case $RUST_OS_NAME in + Linux) + MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests + MIRI_TEST_TARGET=x86_64-apple-darwin run_tests + MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests + ;; + macOS ) + MIRI_TEST_TARGET=mips64-unknown-linux-gnuabi64 run_tests # big-endian architecture + MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests + ;; + Windows) + MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests + MIRI_TEST_TARGET=x86_64-apple-darwin run_tests + ;; + * ) + echo "FATAL: unknown OS" + exit 1 + ;; +esac