From 23d04e5b69516e53df9bdbd8b3f425732d8a8659 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 4 Oct 2020 22:01:10 +0700 Subject: [PATCH 1/8] Set a common OS name env for travis and appveyor --- .appveyor.yml | 2 ++ .travis.yml | 13 +++++++++++++ ci.sh | 45 ++++++++++++++++++++++++++++----------------- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5cb5267a6d..213fd7b8e4 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=. 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 From e84cada859cc03bdff8d1fa81969caab45ea7f1e Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 4 Oct 2020 22:08:50 +0700 Subject: [PATCH 2/8] appveyor: add python3.5 path --- .appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 213fd7b8e4..cf129c14d8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -38,7 +38,8 @@ install: - cargo --version test_script: -- set PYTHON=C:\msys64\mingw64\bin\python3.exe +# Add python3 path: https://www.appveyor.com/docs/windows-images-software/#python +- set PATH=C:\Python35-x64;%PATH% - bash ci.sh after_test: From 1665c05e62ecfc3c09a39c698387e830ebe511cd Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 5 Oct 2020 11:08:00 +0700 Subject: [PATCH 3/8] Add a working github actions template This doesn't cache .rustup dir. Since we only cached stable toolchain, but it is redundant since actions already does that. --- .github/workflows/ci.yml | 101 +++++++++++++++++++++++++++++++++++++++ README.md | 8 +++- 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 101618d1a7..cc167bbe1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,3 +33,104 @@ jobs: host_target: i686-pc-windows-msvc steps: - uses: actions/checkout@v2 + + - name: Setting build env + run: | + echo "RUST_OS_NAME=${{ runner.os }}" >> $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 + + # Somehow on Linux actions/cache doesn't cache without this setup + - name: Creating cargo cached dirs + if: runner.os == 'Linux' + run: | + mkdir -p ~/.cargo + shell: bash + + # 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: | + ~/.cargo + 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 + run: bash ./ci.sh + + - name: Before caching + run: | + # Don't cache "master" toolchain, it's a waste. + rustup default stable + rustup toolchain uninstall master + # Binary artifacts is saved in `ci/bin` dir. + rm -rf ~/.cargo/bin + 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/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 From d66147f9ddaa31f2737580a2053251f1b10aed47 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 5 Oct 2020 11:09:50 +0700 Subject: [PATCH 4/8] do not merge: cache refreshing --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc167bbe1c..675ee1d72b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,8 +62,8 @@ jobs: with: path: | ~/.cargo - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo + key: ${{ runner.os }}-global-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-global-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. From fd9c5e24165c8341fd6f7250dfd1f6385bae29f9 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 5 Oct 2020 16:19:19 +0700 Subject: [PATCH 5/8] wip --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 675ee1d72b..804a35754f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,6 +109,7 @@ jobs: cargo -V - name: Test + if: false run: bash ./ci.sh - name: Before caching From dbb0beafc0fdf371bf6774bfd1fd65fff095605c Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 5 Oct 2020 16:30:42 +0700 Subject: [PATCH 6/8] rebuild From 3e660210401a5091daa040b2b9400cba4cd089d7 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 5 Oct 2020 17:03:25 +0700 Subject: [PATCH 7/8] cache --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 804a35754f..bcb036bcf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,9 +61,12 @@ jobs: uses: actions/cache@v2 with: path: | - ~/.cargo - key: ${{ runner.os }}-global-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-global-cargo + # 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. @@ -112,13 +115,10 @@ jobs: if: false run: bash ./ci.sh + # Don't cache "master" toolchain, it's a waste. - name: Before caching run: | - # Don't cache "master" toolchain, it's a waste. - rustup default stable - rustup toolchain uninstall master # Binary artifacts is saved in `ci/bin` dir. - rm -rf ~/.cargo/bin strip ~/.cargo/ci/bin/* shell: bash From 1866f19d11241778bab346c775fc2c80cf94ab1b Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 5 Oct 2020 17:03:25 +0700 Subject: [PATCH 8/8] cache --- .github/workflows/ci.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcb036bcf8..25ba883482 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,13 +47,6 @@ jobs: brew install gnu-tar echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH - # Somehow on Linux actions/cache doesn't cache without this setup - - name: Creating cargo cached dirs - if: runner.os == 'Linux' - run: | - mkdir -p ~/.cargo - shell: bash - # 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).