1name: CI23on:4 merge_group:5 pull_request:6 branches:7 - 'master'8 schedule:9 - cron: '44 4 * * *' # At 4:44 UTC every day.1011defaults:12 run:13 shell: bash1415jobs:16 test:17 name: test (${{ matrix.host_target }})18 strategy:19 fail-fast: false20 matrix:21 include:22 - host_target: x86_64-unknown-linux-gnu23 os: ubuntu-latest24 - host_target: i686-unknown-linux-gnu25 os: ubuntu-latest26 multiarch: i38627 gcc_cross: i686-linux-gnu28 - host_target: aarch64-unknown-linux-gnu29 os: ubuntu-24.04-arm30 - host_target: armv7-unknown-linux-gnueabihf31 os: ubuntu-24.04-arm32 multiarch: armhf33 gcc_cross: arm-linux-gnueabihf34 # Ubuntu mirrors are not reliable enough for these architectures35 # (see <https://bugs.launchpad.net/ubuntu/+bug/2130309>).36 # - host_target: riscv64gc-unknown-linux-gnu37 # os: ubuntu-latest38 # multiarch: riscv6439 # gcc_cross: riscv64-linux-gnu40 # qemu: true41 # - host_target: s390x-unknown-linux-gnu42 # os: ubuntu-latest43 # multiarch: s390x44 # gcc_cross: s390x-linux-gnu45 # qemu: true46 # - host_target: powerpc64le-unknown-linux-gnu47 # os: ubuntu-latest48 # multiarch: ppc64el49 # gcc_cross: powerpc64le-linux-gnu50 # qemu: true51 - host_target: aarch64-apple-darwin52 os: macos-latest53 - host_target: i686-pc-windows-msvc54 os: windows-latest55 - host_target: aarch64-pc-windows-msvc56 os: windows-11-arm57 runs-on: ${{ matrix.os }}58 env:59 HOST_TARGET: ${{ matrix.host_target }}60 steps:61 - uses: actions/checkout@v662 - name: install multiarch63 if: ${{ matrix.multiarch != '' }}64 run: |65 # armhf, s390x, ppc64el, riscv64 need Ubuntu Ports to be in the mirror list66 sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"67 # Add architecture68 sudo dpkg --add-architecture ${{ matrix.multiarch }}69 # Ubuntu Ports often has outdated mirrors so try a few times to get the apt repo70 for TRY in $(seq 3); do71 { sudo apt update && break; } || sleep 6072 done73 # Install needed packages74 sudo apt install $(echo "libatomic1: zlib1g-dev:" | sed 's/:/:${{ matrix.multiarch }}/g')75 - name: install qemu76 if: ${{ matrix.qemu }}77 run: sudo apt install qemu-user qemu-user-binfmt78 - uses: ./.github/workflows/setup79 with:80 toolchain_flags: "--host ${{ matrix.host_target }}"8182 # We set up the cross-compiler *after* the basic setup as setting CC would otherwise83 # cause confusion.84 - name: install gcc-cross85 if: ${{ matrix.gcc_cross != '' }}86 run: |87 sudo apt install gcc-${{ matrix.gcc_cross }}88 echo "Setting environment variables:"89 echo "CC_${{ matrix.host_target }}=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV90 TARGET_UPPERCASE=$(echo ${{ matrix.host_target }} | tr '[:lower:]-' '[:upper:]_')91 echo "CARGO_TARGET_${TARGET_UPPERCASE}_LINKER=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV9293 # The main test job! We don't run this in qemu as that is quite slow,94 # so those targets only get the clippy check below.95 - name: test Miri96 if: ${{ !matrix.qemu }}97 run: ./ci/ci.sh9899 # The `style` job only runs on Linux; this makes sure the host-specific100 # code is also covered by clippy.101 - name: clippy102 run: ./miri clippy -- -D warnings103104 style:105 name: style checks106 runs-on: ubuntu-latest107 steps:108 - uses: actions/checkout@v6109 - uses: ./.github/workflows/setup110111 - name: rustfmt112 run: ./miri fmt --check113 - name: clippy (no features)114 run: ./miri clippy --no-default-features -- -D warnings115 - name: clippy (all features)116 run: ./miri clippy --all-features -- -D warnings117 - name: rustdoc118 run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items119120 bootstrap:121 name: bootstrap build122 runs-on: ubuntu-latest123 steps:124 - uses: actions/checkout@v6125 # Deliberately skipping `./.github/workflows/setup` as we do our own setup126 - name: Add cache for cargo127 id: cache128 uses: actions/cache@v5129 with:130 path: |131 # Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.132 # Cache package/registry information133 ~/.cargo/registry/index134 ~/.cargo/registry/cache135 ~/.cargo/git/db136 # Cache bootstrap downloads137 ../rust/build/cache138 key: cargo-bootstrap-${{ hashFiles('rust-version') }}139 restore-keys: cargo-bootstrap140 - name: prepare build environment141 run: |142 MIRIDIR=$(pwd)143 cd ..144 # Bootstrap needs at least depth 2 to function.145 git clone https://github.com/rust-lang/rust/ rust --depth 2 --revision $(cat "$MIRIDIR/rust-version")146 cd rust147 # Replace the in-tree Miri with the current version.148 rm src/tools/miri -rf149 ln -s "$MIRIDIR" src/tools/miri150 - name: check build151 run: |152 cd ../rust # ./x does not seem to like being invoked from elsewhere153 ./x check miri154155 coverage:156 name: coverage report157 runs-on: ubuntu-latest158 steps:159 - uses: actions/checkout@v6160 - uses: ./.github/workflows/setup161 - name: coverage162 run: ./miri test --coverage163164 # Summary job for the merge queue.165 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!166 # And they should be added below in `cron-fail-notify` as well.167 conclusion:168 needs: [test, style, bootstrap, coverage]169 # We need to ensure this job does *not* get skipped if its dependencies fail,170 # because a skipped job is considered a success by GitHub. So we have to171 # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run172 # when the workflow is canceled manually.173 if: ${{ !cancelled() }}174 runs-on: ubuntu-latest175 steps:176 # Manually check the status of all dependencies. `if: failure()` does not work.177 - name: Conclusion178 run: |179 # Print the dependent jobs to see them in the CI log180 jq -C <<< '${{ toJson(needs) }}'181 # Check if all jobs that we depend on (in the needs array) were successful.182 jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'183184 cron-rustc-pull:185 name: automatic pull from rustc186 runs-on: ubuntu-latest187 permissions:188 # The cronjob needs to be able to push to the repo...189 contents: write190 # ... and create a PR.191 pull-requests: write192 if: ${{ github.event_name == 'schedule' }}193 steps:194 - uses: actions/checkout@v6195 with:196 fetch-depth: 256 # get a bit more of the history197 - name: install josh-sync198 run: cargo +stable install --locked --git https://github.com/rust-lang/josh-sync199 - name: setup bot git name and email200 run: |201 git config --global user.name 'The Miri Cronjob Bot'202 git config --global user.email 'miri@cron.bot'203 - name: Install nightly toolchain204 run: rustup toolchain install nightly --profile minimal205 - name: Install rustup-toolchain-install-master206 run: cargo install -f rustup-toolchain-install-master207 # Create a token for the next step so it can create a PR that actually runs CI.208 - uses: actions/create-github-app-token@v3209 id: app-token210 with:211 app-id: ${{ vars.APP_CLIENT_ID }}212 private-key: ${{ secrets.APP_PRIVATE_KEY }}213 - name: pull changes from rustc and create PR214 run: |215 # Make it easier to see what happens.216 set -x217 # Temporarily disable early exit to examine the status code of rustc-josh-sync218 set +e219 rustc-josh-sync pull220 exitcode=$?221 set -e222223 # If there were no changes to pull, rustc-josh-sync returns status code 2.224 # In that case, skip the rest of the job.225 if [ $exitcode -eq 2 ]; then226 echo "Nothing changed in rustc, skipping PR"227 exit 0228 elif [ $exitcode -ne 0 ]; then229 # If return code was not 0 or 2, rustc-josh-sync actually failed230 echo "error: rustc-josh-sync failed"231 exit ${exitcode}232 fi233234 # Store merge commit message235 git log -1 --pretty=%B > message.txt236237 # Format changes238 ./miri toolchain239 ./miri fmt --check || (./miri fmt && git commit -am "fmt")240241 # Create a PR242 BRANCH="rustup-$(date -u +%Y-%m-%d)"243 git switch -c $BRANCH244 git push -u origin $BRANCH245 gh pr create -B master --title 'Automatic Rustup' --body-file message.txt246 env:247 GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}248249 cron-fail-notify:250 name: cronjob failure notification251 runs-on: ubuntu-latest252 needs: [test, style, bootstrap, coverage]253 if: ${{ github.event_name == 'schedule' && failure() }}254 steps:255 # Send a Zulip notification256 - name: Install zulip-send257 run: pip3 install zulip258 - name: Send Zulip notification259 env:260 ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}261 ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}262 run: |263 ~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \264 --stream miri --subject "Miri Build Failure ($(date -u +%Y-%m))" \265 --message 'Dear @*T-miri*,266267 It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.268269 This likely means that rustc changed the miri directory and270 we now need to do a [`rustc-josh-sync pull`](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#importing-changes-from-the-rustc-repo).271272 Would you mind investigating this issue?273274 Thanks in advance!275 Sincerely,276 The Miri Cronjobs Bot'
Findings
✓ No findings reported for this file.