Skip to content

Commit c467345

Browse files
committed
Auto merge of #1571 - lzutao:actions, r=RalfJung
Adding a working github actions template Complete adding github actions whose dummy template added in #1563 . But it will need rust-lang/rust-central-station#939 merged first to be able to gate bors on Actions CI checks.
2 parents 098bc8b + 6acde94 commit c467345

File tree

5 files changed

+105
-25
lines changed

5 files changed

+105
-25
lines changed

.appveyor.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ environment:
33
global:
44
PROJECT_NAME: miri
55
matrix:
6-
- TARGET: i686-pc-windows-msvc
6+
- HOST_TARGET: i686-pc-windows-msvc
77
matrix:
88
fast_finish: true # Immediately finish build once one of the jobs fails.
99
cache:
@@ -23,7 +23,7 @@ install:
2323
# Install Rust. We use the "stable" toolchain for better caching, it is just used to build `rustup-toolchain-install-master`.
2424
# But we also need to take into account that the build cache might have a different, outdated default.
2525
- curl -sSf --retry 3 -o rustup-init.exe https://win.rustup.rs/
26-
- rustup-init.exe -y --default-host %TARGET% --default-toolchain none --profile minimal
26+
- rustup-init.exe -y --default-host %HOST_TARGET% --default-toolchain none --profile minimal
2727
- set PATH=%USERPROFILE%\.cargo\bin;%PATH%
2828
- rustup default stable
2929
- rustup toolchain uninstall beta nightly
@@ -36,7 +36,8 @@ install:
3636
- cargo --version
3737

3838
test_script:
39-
- set PYTHON=C:\msys64\mingw64\bin\python3.exe
39+
# Add python3 path: https://www.appveyor.com/docs/windows-images-software/#python
40+
- set PATH=C:\Python35-x64;%PATH%
4041
- bash ci.sh
4142

4243
after_test:

.github/workflows/ci.yml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ on:
1111
- 'master'
1212
schedule:
1313
# Use <https://crontab.guru> to conveniently edit cron schedule.
14-
- cron: "0 7 * * *" # At 07:00 UTC every day.
14+
- cron: '0 7 * * *' # At 07:00 UTC every day.
1515

1616
jobs:
1717
build:
1818
runs-on: ${{ matrix.os }}
1919
env:
2020
RUST_BACKTRACE: 1
21+
HOST_TARGET: ${{ matrix.host_target }}
2122
strategy:
2223
matrix:
2324
build: [linux64, macos, win32]
@@ -34,6 +35,63 @@ jobs:
3435
steps:
3536
- uses: actions/checkout@v2
3637

38+
# We install gnu-tar because BSD tar is buggy on macOS builders of GHA.
39+
# See <https://github.com/actions/cache/issues/403>.
40+
- name: Install GNU tar
41+
if: runner.os == 'macOS'
42+
run: |
43+
brew install gnu-tar
44+
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
45+
46+
# Cache the global cargo directory, but NOT the local `target` directory which
47+
# we cannot reuse anyway when the nightly changes (and it grows quite large
48+
# over time).
49+
- name: Add cache for cargo
50+
uses: actions/cache@v2
51+
with:
52+
path: |
53+
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
54+
~/.cargo/bin
55+
~/.cargo/registry/index
56+
~/.cargo/registry/cache
57+
~/.cargo/git/db
58+
# contains package information of crates installed via `cargo install`.
59+
~/.cargo/.crates.toml
60+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
61+
restore-keys: ${{ runner.os }}-cargo
62+
63+
- name: Install rustup-toolchain-install-master and xargo
64+
run: |
65+
cargo install rustup-toolchain-install-master
66+
cargo install xargo
67+
shell: bash
68+
69+
- name: Install "master" toolchain
70+
run: |
71+
if [[ ${{ github.event_name }} == 'schedule' ]]; then
72+
RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}')
73+
else
74+
RUSTC_HASH=$(< rust-version)
75+
fi
76+
rustup-toolchain-install-master \
77+
-f \
78+
-n master "$RUSTC_HASH" \
79+
-c rust-src \
80+
-c rustc-dev \
81+
-c llvm-tools \
82+
--host ${{ matrix.host_target }}
83+
rustup default master
84+
shell: bash
85+
86+
- name: Show Rust version
87+
run: |
88+
rustup show
89+
rustc -Vv
90+
cargo -V
91+
92+
- name: Test
93+
run: bash ./ci.sh
94+
3795
# These jobs doesn't actually test anything, but they're only used to tell
3896
# bors the build completed, as there is no practical way to detect when a
3997
# workflow is successful listening to webhooks only.

.travis.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
language: generic
2-
os:
3-
- linux
4-
- osx
2+
jobs:
3+
include:
4+
- os: linux
5+
env: HOST_TARGET=x86_64-unknown-linux-gnu
6+
- os: osx
7+
env: HOST_TARGET=x86_64-apple-darwin
58
dist: xenial
69
cache:
710
# Cache the global cargo directory, but NOT the local `target` directory which

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
# 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)
1+
# Miri
22

3+
[![Actions build status][actions-badge]][actions-url]
4+
[![Travis build status](https://travis-ci.com/rust-lang/miri.svg?branch=master)](https://travis-ci.com/rust-lang/miri)
5+
[![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)
6+
7+
[actions-badge]: https://github.com/rust-lang/miri/workflows/CI/badge.svg?branch=master
8+
[actions-url]: https://github.com/rust-lang/miri/actions
39

410
An experimental interpreter for [Rust][rust]'s
511
[mid-level intermediate representation][mir] (MIR). It can run binaries and

ci.sh

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,43 @@ function run_tests {
2323
fi
2424

2525
./miri test --locked
26-
if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then
26+
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
2727
# Only for host architecture: tests with MIR optimizations
2828
MIRIFLAGS="-Z mir-opt-level=3" ./miri test --locked
2929
fi
30+
31+
# On Windows, there is always "python", not "python3" or "python2".
32+
if command -v python3 > /dev/null; then
33+
PYTHON=python3
34+
else
35+
PYTHON=python
36+
fi
37+
3038
# "miri test" has built the sysroot for us, now this should pass without
3139
# any interactive questions.
32-
${PYTHON:-python3} test-cargo-miri/run-test.py
33-
40+
${PYTHON} test-cargo-miri/run-test.py
3441
echo
3542
}
3643

3744
# host
3845
run_tests
3946

40-
if [ "${TRAVIS_OS_NAME:-}" == linux ]; then
41-
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
42-
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
43-
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
44-
elif [ "${TRAVIS_OS_NAME:-}" == osx ]; then
45-
MIRI_TEST_TARGET=mips64-unknown-linux-gnuabi64 run_tests # big-endian architecture
46-
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
47-
elif [ "${CI_WINDOWS:-}" == True ]; then
48-
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
49-
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
50-
else
51-
echo "FATAL: unknown CI platform"
52-
exit 1
53-
fi
47+
case $HOST_TARGET in
48+
x86_64-unknown-linux-gnu)
49+
MIRI_TEST_TARGET=i686-unknown-linux-gnu run_tests
50+
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
51+
MIRI_TEST_TARGET=i686-pc-windows-msvc run_tests
52+
;;
53+
x86_64-apple-darwin)
54+
MIRI_TEST_TARGET=mips64-unknown-linux-gnuabi64 run_tests # big-endian architecture
55+
MIRI_TEST_TARGET=x86_64-pc-windows-msvc run_tests
56+
;;
57+
i686-pc-windows-msvc)
58+
MIRI_TEST_TARGET=x86_64-unknown-linux-gnu run_tests
59+
MIRI_TEST_TARGET=x86_64-apple-darwin run_tests
60+
;;
61+
*)
62+
echo "FATAL: unknown OS"
63+
exit 1
64+
;;
65+
esac

0 commit comments

Comments
 (0)