Fix #3846 properly, so that subtrees can be skipped again #9494
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
merge_group: | |
pull_request: | |
branches: | |
- 'master' | |
schedule: | |
- cron: '44 4 * * *' # At 4:44 UTC every day. | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
host_target: x86_64-unknown-linux-gnu | |
- os: macos-14 | |
host_target: aarch64-apple-darwin | |
- os: windows-latest | |
host_target: i686-pc-windows-msvc | |
runs-on: ${{ matrix.os }} | |
env: | |
HOST_TARGET: ${{ matrix.host_target }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/setup | |
# The `style` job only runs on Linux; this makes sure the Windows-host-specific | |
# code is also covered by clippy. | |
- name: Check clippy | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: ./miri clippy -- -D warnings | |
- name: Test Miri | |
run: ./ci/ci.sh | |
style: | |
name: style checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/setup | |
- name: rustfmt | |
run: ./miri fmt --check | |
- name: clippy | |
run: ./miri clippy -- -D warnings | |
- name: clippy (no features) | |
run: ./miri clippy --no-default-features -- -D warnings | |
- name: clippy (all features) | |
run: ./miri clippy --all-features -- -D warnings | |
- name: rustdoc | |
run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items | |
coverage: | |
name: coverage report | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/setup | |
- name: coverage | |
run: ./miri test --coverage | |
# Summary job for the merge queue. | |
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! | |
# And they should be added below in `cron-fail-notify` as well. | |
conclusion: | |
needs: [build, style, coverage] | |
# We need to ensure this job does *not* get skipped if its dependencies fail, | |
# because a skipped job is considered a success by GitHub. So we have to | |
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run | |
# when the workflow is canceled manually. | |
if: ${{ !cancelled() }} | |
runs-on: ubuntu-latest | |
steps: | |
# Manually check the status of all dependencies. `if: failure()` does not work. | |
- name: Conclusion | |
run: | | |
# Print the dependent jobs to see them in the CI log | |
jq -C <<< '${{ toJson(needs) }}' | |
# Check if all jobs that we depend on (in the needs array) were successful. | |
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' | |
cron-fail-notify: | |
name: cronjob failure notification | |
runs-on: ubuntu-latest | |
permissions: | |
# The cronjob needs to be able to push to the repo... | |
contents: write | |
# ... and create a PR. | |
pull-requests: write | |
needs: [build, style, coverage] | |
if: ${{ github.event_name == 'schedule' && failure() }} | |
steps: | |
# Send a Zulip notification | |
- name: Install zulip-send | |
run: pip3 install zulip | |
- name: Send Zulip notification | |
env: | |
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }} | |
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }} | |
run: | | |
~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \ | |
--stream miri --subject "Miri Build Failure ($(date -u +%Y-%m))" \ | |
--message 'Dear @*T-miri*, | |
It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed. | |
This likely means that rustc changed the miri directory and | |
we now need to do a [`./miri rustc-pull`](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#importing-changes-from-the-rustc-repo). | |
Would you mind investigating this issue? | |
Thanks in advance! | |
Sincerely, | |
The Miri Cronjobs Bot' | |
# Attempt to auto-sync with rustc | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 256 # get a bit more of the history | |
- name: install josh-proxy | |
run: RUSTFLAGS="--cap-lints warn" cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r23.12.04 | |
- name: setup bot git name and email | |
run: | | |
git config --global user.name 'The Miri Cronjob Bot' | |
git config --global user.email '[email protected]' | |
- name: Install nightly toolchain | |
run: rustup toolchain install nightly --profile minimal | |
- name: get changes from rustc | |
run: ./miri rustc-pull | |
- name: Install rustup-toolchain-install-master | |
run: cargo install -f rustup-toolchain-install-master | |
- name: format changes (if any) | |
run: | | |
./miri toolchain | |
./miri fmt --check || (./miri fmt && git commit -am "fmt") | |
- name: Push changes to a branch | |
run: | | |
BRANCH="rustup-$(date -u +%Y-%m-%d)" | |
git switch -c $BRANCH | |
git push -u origin $BRANCH | |
- name: Create Pull Request | |
run: | | |
PR=$(gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.') | |
~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \ | |
--stream miri --subject "Miri Build Failure ($(date -u +%Y-%m))" \ | |
--message "A PR doing a rustc-pull [has been automatically created]($PR) for your convenience." | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }} | |
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }} |