|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'master' |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - 'master' |
| 10 | + schedule: |
| 11 | + # Use <https://crontab.guru> to conveniently edit cron schedule. |
| 12 | + - cron: '0 7 * * *' # At 07:00 UTC every day. |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Install correct toolchain |
| 21 | + shell: bash |
| 22 | + run: | |
| 23 | + if [[ ${{ github.event_name }} == 'schedule' ]]; then |
| 24 | + RUST_TOOLCHAIN=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri) |
| 25 | + else |
| 26 | + RUST_TOOLCHAIN=$(cat rust-version) |
| 27 | + fi |
| 28 | + echo "Installing Rust version: $RUST_TOOLCHAIN" |
| 29 | + rustup default $RUST_TOOLCHAIN |
| 30 | +
|
| 31 | + - name: Show Rust version |
| 32 | + run: | |
| 33 | + rustup show |
| 34 | + rustc -Vv |
| 35 | + cargo -V |
| 36 | +
|
| 37 | + - name: Test |
| 38 | + run: bash ./ci.sh |
| 39 | + |
| 40 | + fmt: |
| 41 | + name: check formatting (ignored by bors) |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v2 |
| 45 | + - name: Install latest nightly |
| 46 | + uses: actions-rs/toolchain@v1 |
| 47 | + with: |
| 48 | + toolchain: nightly |
| 49 | + components: rustfmt |
| 50 | + default: true |
| 51 | + - name: Check formatting (miri) |
| 52 | + uses: actions-rs/cargo@v1 |
| 53 | + with: |
| 54 | + command: fmt |
| 55 | + args: --all -- --check |
| 56 | + - name: Check formatting (cargo-miri) |
| 57 | + uses: actions-rs/cargo@v1 |
| 58 | + with: |
| 59 | + command: fmt |
| 60 | + args: --manifest-path cargo-miri/Cargo.toml --all -- --check |
| 61 | + |
| 62 | + # These jobs doesn't actually test anything, but they're only used to tell |
| 63 | + # bors the build completed, as there is no practical way to detect when a |
| 64 | + # workflow is successful listening to webhooks only. |
| 65 | + # |
| 66 | + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! |
| 67 | + # (`fmt` is deliberately not listed, we want bors to ignore it.) |
| 68 | + end-success: |
| 69 | + name: bors build finished |
| 70 | + runs-on: ubuntu-latest |
| 71 | + needs: [build] |
| 72 | + if: github.event.pusher.name == 'bors' && success() |
| 73 | + steps: |
| 74 | + - name: mark the job as a success |
| 75 | + run: exit 0 |
| 76 | + end-failure: |
| 77 | + name: bors build finished |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: [build] |
| 80 | + if: github.event.pusher.name == 'bors' && (failure() || cancelled()) |
| 81 | + steps: |
| 82 | + - name: mark the job as a failure |
| 83 | + run: exit 1 |
| 84 | + |
| 85 | + # Send a Zulip notification when a cron job fails |
| 86 | + cron-fail-notify: |
| 87 | + name: cronjob failure notification |
| 88 | + runs-on: ubuntu-latest |
| 89 | + needs: [build] |
| 90 | + if: github.event_name == 'schedule' && (failure() || cancelled()) |
| 91 | + steps: |
| 92 | + - name: Install zulip-send |
| 93 | + run: pip3 install zulip |
| 94 | + - name: Send Zulip notification |
| 95 | + shell: bash |
| 96 | + env: |
| 97 | + ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }} |
| 98 | + ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }} |
| 99 | + run: | |
| 100 | + ~/.local/bin/zulip-send --stream miri --subject "Cron Job Failure $(date -uI)" \ |
| 101 | + --message 'Dear @**RalfJ** and @**oli** |
| 102 | +
|
| 103 | + It would appear that the Miri cron job build failed. Would you mind investigating this issue? |
| 104 | +
|
| 105 | + Thanks in advance! |
| 106 | + Sincerely, |
| 107 | + The Miri Cronjobs Bot' \ |
| 108 | + --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com |
0 commit comments