2020-10-04 06:53:13 -05:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# Run in PRs and for bors, but not on master.
|
|
|
|
branches:
|
|
|
|
- 'auto'
|
|
|
|
- 'try'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
schedule:
|
2021-11-17 09:34:32 -06:00
|
|
|
- cron: '5 15 * * *' # At 15:05 UTC every day.
|
2020-10-04 06:53:13 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
env:
|
|
|
|
RUST_BACKTRACE: 1
|
2020-10-04 10:01:10 -05:00
|
|
|
HOST_TARGET: ${{ matrix.host_target }}
|
2020-10-04 06:53:13 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
build: [linux64, macos, win32]
|
|
|
|
include:
|
|
|
|
- build: linux64
|
|
|
|
os: ubuntu-latest
|
|
|
|
host_target: x86_64-unknown-linux-gnu
|
|
|
|
- build: macos
|
|
|
|
os: macos-latest
|
|
|
|
host_target: x86_64-apple-darwin
|
|
|
|
- build: win32
|
|
|
|
os: windows-latest
|
|
|
|
host_target: i686-pc-windows-msvc
|
|
|
|
steps:
|
2022-04-29 22:25:04 -05:00
|
|
|
- uses: actions/checkout@v3
|
2020-10-06 04:11:14 -05:00
|
|
|
|
2020-10-04 10:01:10 -05:00
|
|
|
# We install gnu-tar because BSD tar is buggy on macOS builders of GHA.
|
|
|
|
# See <https://github.com/actions/cache/issues/403>.
|
|
|
|
- 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: |
|
|
|
|
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
|
|
|
|
~/.cargo/bin
|
|
|
|
~/.cargo/registry/index
|
|
|
|
~/.cargo/registry/cache
|
|
|
|
~/.cargo/git/db
|
|
|
|
# contains package information of crates installed via `cargo install`.
|
|
|
|
~/.cargo/.crates.toml
|
2022-05-21 02:33:47 -05:00
|
|
|
~/.cargo/.crates2.json
|
2022-06-01 05:28:27 -05:00
|
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'cargo-miri/version.rs') }}
|
2020-10-04 10:01:10 -05:00
|
|
|
restore-keys: ${{ runner.os }}-cargo
|
|
|
|
|
|
|
|
- name: Install rustup-toolchain-install-master and xargo
|
2021-01-10 12:12:11 -06:00
|
|
|
shell: bash
|
2020-10-04 10:01:10 -05:00
|
|
|
run: |
|
2022-06-01 05:31:08 -05:00
|
|
|
# Only install tools if we don't have them cached
|
|
|
|
if ! which rustup-toolchain-install-master; then cargo install rustup-toolchain-install-master; fi
|
2022-06-01 05:28:27 -05:00
|
|
|
if ! which xargo; then cargo install xargo; fi
|
2020-10-04 10:01:10 -05:00
|
|
|
|
|
|
|
- name: Install "master" toolchain
|
2021-01-10 12:12:11 -06:00
|
|
|
shell: bash
|
2020-10-04 10:01:10 -05:00
|
|
|
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
|
2021-07-02 03:20:55 -05:00
|
|
|
# We need a nightly cargo for parts of the cargo miri test suite.
|
2020-10-04 10:01:10 -05:00
|
|
|
rustup-toolchain-install-master \
|
|
|
|
-f \
|
|
|
|
-n master "$RUSTC_HASH" \
|
2021-06-26 07:43:31 -05:00
|
|
|
-c cargo \
|
2020-10-04 10:01:10 -05:00
|
|
|
-c rust-src \
|
|
|
|
-c rustc-dev \
|
|
|
|
-c llvm-tools \
|
|
|
|
--host ${{ matrix.host_target }}
|
|
|
|
rustup default master
|
|
|
|
|
|
|
|
- name: Show Rust version
|
|
|
|
run: |
|
|
|
|
rustup show
|
|
|
|
rustc -Vv
|
|
|
|
cargo -V
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: bash ./ci.sh
|
|
|
|
|
2021-05-19 03:47:17 -05:00
|
|
|
fmt:
|
2021-05-19 03:57:38 -05:00
|
|
|
name: check formatting (ignored by bors)
|
2021-05-19 03:47:17 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-29 22:25:04 -05:00
|
|
|
- uses: actions/checkout@v3
|
2021-05-19 03:47:17 -05:00
|
|
|
- name: Install latest nightly
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
components: rustfmt
|
2021-05-19 03:57:38 -05:00
|
|
|
default: true
|
2021-05-19 03:47:17 -05:00
|
|
|
- name: Check formatting (miri)
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: fmt
|
|
|
|
args: --all -- --check
|
|
|
|
- name: Check formatting (cargo-miri)
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: fmt
|
|
|
|
args: --manifest-path cargo-miri/Cargo.toml --all -- --check
|
|
|
|
|
2020-10-06 04:11:14 -05:00
|
|
|
# These jobs doesn't actually test anything, but they're only used to tell
|
|
|
|
# bors the build completed, as there is no practical way to detect when a
|
|
|
|
# workflow is successful listening to webhooks only.
|
|
|
|
#
|
|
|
|
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
|
2021-05-19 03:47:17 -05:00
|
|
|
# (`fmt` is deliberately not listed, we want bors to ignore it.)
|
2020-10-06 04:11:14 -05:00
|
|
|
end-success:
|
|
|
|
name: bors build finished
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build]
|
|
|
|
if: github.event.pusher.name == 'bors' && success()
|
|
|
|
steps:
|
|
|
|
- name: mark the job as a success
|
|
|
|
run: exit 0
|
|
|
|
end-failure:
|
|
|
|
name: bors build finished
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build]
|
|
|
|
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
|
|
|
|
steps:
|
|
|
|
- name: mark the job as a failure
|
|
|
|
run: exit 1
|
2021-01-10 12:12:11 -06:00
|
|
|
|
|
|
|
# Send a Zulip notification when a cron job fails
|
|
|
|
cron-fail-notify:
|
|
|
|
name: cronjob failure notification
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build]
|
|
|
|
if: github.event_name == 'schedule' && (failure() || cancelled())
|
|
|
|
steps:
|
|
|
|
- name: Install zulip-send
|
|
|
|
run: pip3 install zulip
|
|
|
|
- name: Send Zulip notification
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
|
|
|
|
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}
|
|
|
|
run: |
|
2021-03-02 04:09:06 -06:00
|
|
|
~/.local/bin/zulip-send --stream miri --subject "Cron Job Failure $(date -uI)" \
|
2021-01-25 02:10:28 -06:00
|
|
|
--message 'Dear @**RalfJ** and @**oli**
|
|
|
|
|
|
|
|
It would appear that the Miri cron job build failed. Would you mind investigating this issue?
|
|
|
|
|
|
|
|
Thanks in advance!
|
|
|
|
Sincerely,
|
|
|
|
The Miri Cronjobs Bot' \
|
2021-01-15 08:23:20 -06:00
|
|
|
--user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com
|