diff options
| -rw-r--r-- | src/tools/miri/.github/workflows/ci.yml | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/src/tools/miri/.github/workflows/ci.yml b/src/tools/miri/.github/workflows/ci.yml index 59bae513a58..86815fc60fb 100644 --- a/src/tools/miri/.github/workflows/ci.yml +++ b/src/tools/miri/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: branches: - 'master' schedule: - - cron: '44 4 * * *' # At 4:44 UTC every day. + - cron: '44 4,17 * * *' # At 4:44 UTC every day. defaults: run: @@ -89,41 +89,16 @@ jobs: # 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 + cron-rustc-pull: + name: automatic pull from rustc 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() }} + if: ${{ github.event_name == 'schedule' }} 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 @@ -143,18 +118,45 @@ jobs: run: | ./miri toolchain ./miri fmt --check || (./miri fmt && git commit -am "fmt") - - name: Push changes to a branch + - name: Push changes to a branch and create PR run: | + # `git diff --exit-code` "succeeds" if the diff is empty. + if git diff --exit-code HEAD^; then exit 0; fi + # The diff is non-empty, create a PR. 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." + gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }} ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }} + + cron-fail-notify: + name: cronjob failure notification + runs-on: ubuntu-latest + 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' |
