fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1name: CI 2 3on: 4 push: 5 # Run in PRs and for bors, but not on master. 6 branches: 7 - 'auto' 8 - 'try' 9 pull_request: 10 branches: 11 - 'master' 12 schedule: 13 - cron: '44 4 * * *' # At 4:44 UTC every day. 14 15defaults: 16 run: 17 shell: bash 18 19jobs: 20 build: 21 strategy: 22 fail-fast: false 23 matrix: 24 include: 25 - os: ubuntu-latest 26 host_target: x86_64-unknown-linux-gnu 27 - os: macos-latest 28 host_target: x86_64-apple-darwin 29 - os: windows-latest 30 host_target: i686-pc-windows-msvc 31 runs-on: ${{ matrix.os }} 32 env: 33 RUST_BACKTRACE: 1 34 HOST_TARGET: ${{ matrix.host_target }} 35 steps: 36 - uses: actions/checkout@v3 37 38 - name: Set the tag GC interval to 1 on linux 39 if: runner.os == 'Linux' 40 run: echo "MIRIFLAGS=-Zmiri-tag-gc=1" >> $GITHUB_ENV 41 42 # Cache the global cargo directory, but NOT the local `target` directory which 43 # we cannot reuse anyway when the nightly changes (and it grows quite large 44 # over time). 45 - name: Add cache for cargo 46 id: cache 47 uses: actions/cache@v3 48 with: 49 path: | 50 # Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>. 51 ~/.cargo/bin 52 ~/.cargo/registry/index 53 ~/.cargo/registry/cache 54 ~/.cargo/git/db 55 # contains package information of crates installed via `cargo install`. 56 ~/.cargo/.crates.toml 57 ~/.cargo/.crates2.json 58 key: ${{ runner.os }}-cargo-reset20230315-${{ hashFiles('**/Cargo.lock') }} 59 restore-keys: ${{ runner.os }}-cargo-reset20230315 60 61 - name: Install rustup-toolchain-install-master 62 if: ${{ steps.cache.outputs.cache-hit != 'true' }} 63 run: cargo install -f rustup-toolchain-install-master 64 65 - name: Install "master" toolchain 66 run: | 67 if [[ ${{ github.event_name }} == 'schedule' ]]; then 68 echo "Building against latest rustc git version" 69 git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version 70 fi 71 ./miri toolchain --host ${{ matrix.host_target }} 72 73 - name: Show Rust version 74 run: | 75 rustup show 76 rustc -Vv 77 cargo -V 78 79 - name: Test 80 run: ./ci.sh 81 82 style: 83 name: style checks 84 runs-on: ubuntu-latest 85 steps: 86 - uses: actions/checkout@v3 87 88 # This is exactly duplicated from above. GHA is pretty terrible when it comes 89 # to avoiding code duplication. 90 91 # Cache the global cargo directory, but NOT the local `target` directory which 92 # we cannot reuse anyway when the nightly changes (and it grows quite large 93 # over time). 94 - name: Add cache for cargo 95 id: cache 96 uses: actions/cache@v3 97 with: 98 path: | 99 # Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>. 100 ~/.cargo/bin 101 ~/.cargo/registry/index 102 ~/.cargo/registry/cache 103 ~/.cargo/git/db 104 # contains package information of crates installed via `cargo install`. 105 ~/.cargo/.crates.toml 106 ~/.cargo/.crates2.json 107 key: ${{ runner.os }}-cargo-reset20230315-${{ hashFiles('**/Cargo.lock') }} 108 restore-keys: ${{ runner.os }}-cargo-reset20230315 109 110 - name: Install rustup-toolchain-install-master 111 if: ${{ steps.cache.outputs.cache-hit != 'true' }} 112 run: cargo install -f rustup-toolchain-install-master 113 114 - name: Install "master" toolchain 115 run: | 116 if [[ ${{ github.event_name }} == 'schedule' ]]; then 117 echo "Building against latest rustc git version" 118 git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version 119 fi 120 ./miri toolchain 121 122 - name: Show Rust version 123 run: | 124 rustup show 125 rustc -Vv 126 cargo -V 127 128 - name: rustfmt 129 run: ./miri fmt --check 130 - name: clippy 131 run: ./miri clippy -- -D warnings 132 - name: rustdoc 133 run: RUSTDOCFLAGS="-Dwarnings" ./miri cargo doc --document-private-items 134 135 # These jobs doesn't actually test anything, but they're only used to tell 136 # bors the build completed, as there is no practical way to detect when a 137 # workflow is successful listening to webhooks only. 138 # 139 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! 140 end-success: 141 name: bors build finished 142 runs-on: ubuntu-latest 143 needs: [build, style] 144 if: github.event.pusher.name == 'bors' && success() 145 steps: 146 - name: mark the job as a success 147 run: exit 0 148 end-failure: 149 name: bors build finished 150 runs-on: ubuntu-latest 151 needs: [build, style] 152 if: github.event.pusher.name == 'bors' && (failure() || cancelled()) 153 steps: 154 - name: mark the job as a failure 155 run: exit 1 156 157 cron-fail-notify: 158 name: cronjob failure notification 159 runs-on: ubuntu-latest 160 needs: [build, style] 161 if: github.event_name == 'schedule' && (failure() || cancelled()) 162 steps: 163 # Send a Zulip notification 164 - name: Install zulip-send 165 run: pip3 install zulip 166 - name: Send Zulip notification 167 env: 168 ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }} 169 ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }} 170 run: | 171 ~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \ 172 --stream miri --subject "Cron Job Failure (miri, $(date -u +%Y-%m))" \ 173 --message 'Dear @*T-miri*, 174 175 It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed. 176 177 This likely means that rustc changed the miri directory and 178 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). 179 180 Would you mind investigating this issue? 181 182 Thanks in advance! 183 Sincerely, 184 The Miri Cronjobs Bot' 185 186 # Attempt to auto-sync with rustc 187 - uses: actions/checkout@v3 188 with: 189 fetch-depth: 256 # get a bit more of the history 190 - name: install josh-proxy 191 run: cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r22.12.06 192 - name: setup bot git name and email 193 run: | 194 git config --global user.name 'The Miri Conjob Bot' 195 git config --global user.email 'miri@cron.bot' 196 - name: get changes from rustc 197 run: ./miri rustc-pull 198 - name: Install rustup-toolchain-install-master 199 run: cargo install -f rustup-toolchain-install-master 200 - name: format changes (if any) 201 run: | 202 ./miri toolchain 203 ./miri fmt --check || (./miri fmt && git commit -am "fmt") 204 - name: Push changes to a branch 205 run: | 206 BRANCH="rustup-$(date -u +%Y-%m-%d)" 207 git switch -c $BRANCH 208 git push -u origin $BRANCH 209 - name: Create Pull Request 210 run: | 211 PR=$(gh pr create -B master --title 'Automatic sync from rustc' --body '') 212 ~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \ 213 --stream miri --subject "Cron Job Failure (miri, $(date -u +%Y-%m))" \ 214 --message "A PR doing a rustc-pull [has been automatically created]($PR) for your convenience." 215 env: 216 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 217 ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }} 218 ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}