src/tools/miri/.github/workflows/ci.yml YAML 299 lines View on github.com → Search inside
1name: CI23on:4  merge_group:5  pull_request:6    branches:7      - 'master'8  schedule:9    - cron: '14 4 * * *' # At 4:14 UTC every day.1011defaults:12  run:13    shell: bash1415permissions:16  contents: read1718jobs:19  test:20    name: test (${{ matrix.host_target }})21    strategy:22      fail-fast: false23      matrix:24        include:25          - host_target: x86_64-unknown-linux-gnu26            os: ubuntu-latest27          - host_target: i686-unknown-linux-gnu28            os: ubuntu-latest29            multiarch: i38630            gcc_cross: i686-linux-gnu31          - host_target: aarch64-unknown-linux-gnu32            os: ubuntu-24.04-arm33          - host_target: armv7-unknown-linux-gnueabihf34            os: ubuntu-24.04-arm35            multiarch: armhf36            gcc_cross: arm-linux-gnueabihf37          # Ubuntu mirrors are not reliable enough for these architectures38          # (see <https://bugs.launchpad.net/ubuntu/+bug/2130309>).39          # - host_target: riscv64gc-unknown-linux-gnu40          #   os: ubuntu-latest41          #   multiarch: riscv6442          #   gcc_cross: riscv64-linux-gnu43          #   qemu: true44          # - host_target: s390x-unknown-linux-gnu45          #   os: ubuntu-latest46          #   multiarch: s390x47          #   gcc_cross: s390x-linux-gnu48          #   qemu: true49          # - host_target: powerpc64le-unknown-linux-gnu50          #   os: ubuntu-latest51          #   multiarch: ppc64el52          #   gcc_cross: powerpc64le-linux-gnu53          #   qemu: true54          - host_target: aarch64-apple-darwin55            os: macos-latest56          - host_target: i686-pc-windows-msvc57            os: windows-latest58          - host_target: aarch64-pc-windows-msvc59            os: windows-11-arm60    runs-on: ${{ matrix.os }}61    env:62      HOST_TARGET: ${{ matrix.host_target }}63    steps:64      - uses: actions/checkout@v665      - name: install multiarch66        if: ${{ matrix.multiarch != '' }}67        run: |68          # armhf, s390x, ppc64el, riscv64 need Ubuntu Ports to be in the mirror list69          sudo bash -c "echo 'https://ports.ubuntu.com/	priority:4' >> /etc/apt/apt-mirrors.txt"70          # Add architecture71          sudo dpkg --add-architecture ${{ matrix.multiarch }}72          # Ubuntu Ports often has outdated mirrors so try a few times to get the apt repo73          for TRY in $(seq 3); do74            { sudo apt update && break; } || sleep 6075          done76          # Install needed packages77          sudo apt install $(echo "libatomic1: zlib1g-dev:" | sed 's/:/:${{ matrix.multiarch }}/g')78      - name: install qemu79        if: ${{ matrix.qemu }}80        run: sudo apt install qemu-user qemu-user-binfmt81      - uses: ./.github/workflows/setup82        with:83          toolchain_flags: "--host ${{ matrix.host_target }}"8485      # We set up the cross-compiler *after* the basic setup as setting CC would otherwise86      # cause confusion.87      - name: install gcc-cross88        if: ${{ matrix.gcc_cross != '' }}89        run: |90          sudo apt install gcc-${{ matrix.gcc_cross }}91          echo "Setting environment variables:"92          echo "CC_${{ matrix.host_target }}=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV93          TARGET_UPPERCASE=$(echo ${{ matrix.host_target }} | tr '[:lower:]-' '[:upper:]_')94          echo "CARGO_TARGET_${TARGET_UPPERCASE}_LINKER=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV9596      # The main test job! We don't run this in qemu as that is quite slow,97      # so those targets only get the clippy check below.98      - name: test Miri99        if: ${{ !matrix.qemu }}100        run: ./ci/ci.sh101102      # The `style` job only runs on Linux; this makes sure the host-specific103      # code is also covered by clippy.104      - name: clippy105        run: ./miri clippy -- -D warnings106107  style:108    name: style checks109    runs-on: ubuntu-latest110    steps:111      - uses: actions/checkout@v6112      - uses: ./.github/workflows/setup113114      - name: rustfmt115        run: ./miri fmt --check116      - name: clippy (no features)117        run: ./miri clippy --no-default-features -- -D warnings118      - name: clippy (all features)119        run: ./miri clippy --all-features -- -D warnings120      - name: rustdoc121        run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items122123  bootstrap:124    name: bootstrap build125    runs-on: ubuntu-latest126    steps:127      - uses: actions/checkout@v6128      # Deliberately skipping `./.github/workflows/setup` as we do our own setup129      - name: Add cache for cargo130        id: cache131        uses: actions/cache@v5132        with:133          path: |134            # Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.135            # Cache package/registry information136            ~/.cargo/registry/index137            ~/.cargo/registry/cache138            ~/.cargo/git/db139            # Cache bootstrap downloads140            ../rust/build/cache141          key: cargo-bootstrap-${{ hashFiles('rust-version') }}142          restore-keys: cargo-bootstrap143      - name: prepare build environment144        run: |145          MIRIDIR=$(pwd)146          cd ..147          # Bootstrap needs at least depth 2 to function.148          git clone https://github.com/rust-lang/rust/ rust --depth 2 --revision $(cat "$MIRIDIR/rust-version")149          cd rust150          # Replace the in-tree Miri with the current version.151          rm src/tools/miri -rf152          ln -s "$MIRIDIR" src/tools/miri153      - name: check build154        run: |155          cd ../rust # ./x does not seem to like being invoked from elsewhere156          ./x check miri157158  # This job is intentionally separate from `test` so that Priroda can be159  # developed as a separate crate inside the Miri repository for now.160  priroda:161    name: Priroda162    runs-on: ubuntu-latest163    steps:164      - uses: actions/checkout@v6165      - uses: ./.github/workflows/setup166      - name: install Miri driver167        run: ./miri install168      - name: build Priroda169        working-directory: priroda170        run: cargo build --locked171      - name: test Priroda172        working-directory: priroda173        run: |174          sysroot="$(cargo miri setup --print-sysroot)"175          MIRI_SYSROOT="$sysroot" cargo test --locked176177  coverage:178    name: coverage report179    runs-on: ubuntu-latest180    steps:181      - uses: actions/checkout@v6182      - uses: ./.github/workflows/setup183      - name: coverage184        run: ./miri test --coverage185186  # Summary job for the merge queue.187  # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!188  # And they should be added below in `cron-fail-notify` as well.189  conclusion:190    needs: [test, style, bootstrap, coverage, priroda]191    # We need to ensure this job does *not* get skipped if its dependencies fail,192    # because a skipped job is considered a success by GitHub. So we have to193    # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run194    # when the workflow is canceled manually.195    if: ${{ !cancelled() }}196    runs-on: ubuntu-latest197    steps:198      # Manually check the status of all dependencies. `if: failure()` does not work.199      - name: Conclusion200        run: |201            # Print the dependent jobs to see them in the CI log202            jq -C <<< '${{ toJson(needs) }}'203            # Check if all jobs that we depend on (in the needs array) were successful.204            jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'205206  cron-rustc-pull:207    name: automatic pull from rustc208    runs-on: ubuntu-latest209    permissions:210        # The cronjob needs to be able to push to the repo...211        contents: write212        # ... and create a PR.213        pull-requests: write214    if: ${{ github.event_name == 'schedule' }}215    steps:216      - uses: actions/checkout@v6217        with:218          fetch-depth: 256 # get a bit more of the history219      - name: install josh-sync220        run: cargo +stable install --locked --git https://github.com/rust-lang/josh-sync221      - name: setup bot git name and email222        run: |223          git config --global user.name 'The Miri Cronjob Bot'224          git config --global user.email 'miri@cron.bot'225      - name: Install nightly toolchain226        run: rustup toolchain install nightly --profile minimal227      - name: Install rustup-toolchain-install-master228        run: cargo install -f rustup-toolchain-install-master229      # Create a token for the next step so it can create a PR that actually runs CI.230      - uses: actions/create-github-app-token@v3231        id: app-token232        with:233          app-id: ${{ vars.APP_CLIENT_ID }}234          private-key: ${{ secrets.APP_PRIVATE_KEY }}235      - name: pull changes from rustc and create PR236        run: |237          # Make it easier to see what happens.238          set -x239          # Temporarily disable early exit to examine the status code of rustc-josh-sync240          set +e241          rustc-josh-sync pull242          exitcode=$?243          set -e244245          # If there were no changes to pull, rustc-josh-sync returns status code 2.246          # In that case, skip the rest of the job.247          if [ $exitcode -eq 2 ]; then248            echo "Nothing changed in rustc, skipping PR"249            exit 0250          elif [ $exitcode -ne 0 ]; then251            # If return code was not 0 or 2, rustc-josh-sync actually failed252            echo "error: rustc-josh-sync failed"253            exit ${exitcode}254          fi255256          # Store merge commit message257          git log -1 --pretty=%B > message.txt258259          # Format changes260          ./miri toolchain261          ./miri fmt --check || (./miri fmt && git commit -am "fmt")262263          # Create a PR264          BRANCH="rustup-$(date -u +%Y-%m-%d)"265          git switch -c $BRANCH266          git push -u origin $BRANCH267          gh pr create -B master --title 'Automatic Rustup' --body-file message.txt268        env:269          GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}270271  cron-fail-notify:272    name: cronjob failure notification273    runs-on: ubuntu-latest274    needs: [test, style, bootstrap, coverage, priroda]275    if: ${{ github.event_name == 'schedule' && failure() }}276    steps:277      # Send a Zulip notification278      - name: Install zulip-send279        run: pip3 install zulip280      - name: Send Zulip notification281        env:282          ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}283          ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}284        run: |285          ~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \286            --stream miri --subject "Miri Build Failure ($(date -u +%Y-%m))" \287            --message 'Dear @*T-miri*,288289          It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.290291          This likely means that rustc changed the miri directory and292          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).293294          Would you mind investigating this issue?295296          Thanks in advance!297          Sincerely,298          The Miri Cronjobs Bot'

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.