5 # Run in PRs and for bors, but not on master.
13 - cron: '5 15 * * *' # At 15:05 UTC every day.
17 runs-on: ${{ matrix.os }}
20 HOST_TARGET: ${{ matrix.host_target }}
23 build: [linux64, macos, win32]
27 host_target: x86_64-unknown-linux-gnu
30 host_target: x86_64-apple-darwin
33 host_target: i686-pc-windows-msvc
35 - uses: actions/checkout@v3
37 - name: Set the tag GC interval to 1 on linux
38 if: runner.os == 'macOS'
39 run: echo "MIRIFLAGS=-Zmiri-tag-gc=1" >> $GITHUB_ENV
41 # We install gnu-tar because BSD tar is buggy on macOS builders of GHA.
42 # See <https://github.com/actions/cache/issues/403>.
43 - name: Install GNU tar
44 if: runner.os == 'macOS'
47 echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
49 # Cache the global cargo directory, but NOT the local `target` directory which
50 # we cannot reuse anyway when the nightly changes (and it grows quite large
52 - name: Add cache for cargo
54 uses: actions/cache@v3
57 # Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
59 ~/.cargo/registry/index
60 ~/.cargo/registry/cache
62 # contains package information of crates installed via `cargo install`.
64 ~/.cargo/.crates2.json
65 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'cargo-miri/src/version.rs') }}
66 restore-keys: ${{ runner.os }}-cargo
68 - name: Install rustup-toolchain-install-master and xargo
69 if: ${{ steps.cache.outputs.cache-hit == 'false' }}
72 cargo install rustup-toolchain-install-master
75 - name: Install "master" toolchain
78 if [[ ${{ github.event_name }} == 'schedule' ]]; then
79 ./rustup-toolchain HEAD --host ${{ matrix.host_target }}
81 ./rustup-toolchain "" --host ${{ matrix.host_target }}
84 - name: Show Rust version
95 runs-on: ubuntu-latest
97 - uses: actions/checkout@v3
98 - name: Install required toolchain
99 # We need a toolchain that can actually build Miri, just a nightly won't do.
101 cargo install rustup-toolchain-install-master # TODO: cache this?
102 ./rustup-toolchain "" -c clippy
104 run: ./miri fmt --check
106 run: ./miri clippy -- -D warnings
108 run: RUSTDOCFLAGS="-Dwarnings" cargo doc --document-private-items
110 # These jobs doesn't actually test anything, but they're only used to tell
111 # bors the build completed, as there is no practical way to detect when a
112 # workflow is successful listening to webhooks only.
114 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
115 # (`fmt` is deliberately not listed, we want bors to ignore it.)
117 name: bors build finished
118 runs-on: ubuntu-latest
119 needs: [build, style]
120 if: github.event.pusher.name == 'bors' && success()
122 - name: mark the job as a success
125 name: bors build finished
126 runs-on: ubuntu-latest
127 needs: [build, style]
128 if: github.event.pusher.name == 'bors' && (failure() || cancelled())
130 - name: mark the job as a failure
133 # Send a Zulip notification when a cron job fails
135 name: cronjob failure notification
136 runs-on: ubuntu-latest
137 needs: [build, style]
138 if: github.event_name == 'schedule' && (failure() || cancelled())
140 - name: Install zulip-send
141 run: pip3 install zulip
142 - name: Send Zulip notification
145 ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
146 ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}
148 ~/.local/bin/zulip-send --stream miri --subject "Cron Job Failure (miri, $(date -u +%Y-%m))" \
149 --message 'Dear @*T-miri*,
151 It would appear that the Miri cron job build failed. Would you mind investigating this issue?
155 The Miri Cronjobs Bot' \
156 --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com