@@ -13,35 +13,94 @@ defaults:
1313 shell : bash
1414
1515jobs :
16- build :
16+ test :
17+ name : test (${{ matrix.host_target }})
1718 strategy :
1819 fail-fast : false
1920 matrix :
2021 include :
21- - os : ubuntu-latest
22- host_target : x86_64-unknown-linux-gnu
23- - os : macos-14
24- host_target : aarch64-apple-darwin
25- - os : windows-latest
26- host_target : i686-pc-windows-msvc
22+ - host_target : x86_64-unknown-linux-gnu
23+ os : ubuntu-latest
24+ - host_target : i686-unknown-linux-gnu
25+ os : ubuntu-latest
26+ multiarch : i386
27+ gcc_cross : i686-linux-gnu
28+ - host_target : aarch64-unknown-linux-gnu
29+ os : ubuntu-24.04-arm
30+ - host_target : armv7-unknown-linux-gnueabihf
31+ os : ubuntu-24.04-arm
32+ multiarch : armhf
33+ gcc_cross : arm-linux-gnueabihf
34+ - host_target : riscv64gc-unknown-linux-gnu
35+ os : ubuntu-latest
36+ multiarch : riscv64
37+ gcc_cross : riscv64-linux-gnu
38+ qemu : true
39+ - host_target : s390x-unknown-linux-gnu
40+ os : ubuntu-latest
41+ multiarch : s390x
42+ gcc_cross : s390x-linux-gnu
43+ qemu : true
44+ - host_target : aarch64-apple-darwin
45+ os : macos-latest
46+ - host_target : i686-pc-windows-msvc
47+ os : windows-latest
48+ - host_target : aarch64-pc-windows-msvc
49+ os : windows-11-arm
2750 runs-on : ${{ matrix.os }}
2851 env :
2952 HOST_TARGET : ${{ matrix.host_target }}
3053 steps :
3154 - uses : actions/checkout@v4
55+ - name : apt update
56+ if : ${{ startsWith(matrix.os, 'ubuntu') }}
57+ # The runners seem to have outdated apt repos sometimes
58+ run : sudo apt update
59+ - name : install qemu
60+ if : ${{ matrix.qemu }}
61+ run : sudo apt install qemu-user qemu-user-binfmt
62+ - name : install multiarch
63+ if : ${{ matrix.multiarch != '' }}
64+ run : |
65+ # s390x, ppc64el need Ubuntu Ports to be in the mirror list
66+ sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"
67+ # Add architecture
68+ sudo dpkg --add-architecture ${{ matrix.multiarch }}
69+ sudo apt update
70+ # Install needed packages
71+ sudo apt install $(echo "libatomic1: zlib1g-dev:" | sed 's/:/:${{ matrix.multiarch }}/g')
72+ - name : Install rustup on Windows ARM
73+ if : ${{ matrix.os == 'windows-11-arm' }}
74+ run : |
75+ curl -LOs https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
76+ ./rustup-init.exe -y --no-modify-path
77+ echo "$USERPROFILE/.cargo/bin" >> "$GITHUB_PATH"
3278 - uses : ./.github/workflows/setup
3379 with :
3480 toolchain_flags : " --host ${{ matrix.host_target }}"
3581
36- # The `style` job only runs on Linux; this makes sure the Windows-host-specific
37- # code is also covered by clippy.
38- - name : Check clippy
39- if : ${{ matrix.os == 'windows-latest' }}
40- run : ./miri clippy -- -D warnings
82+ # We set up the cross-compiler *after* the basic setup as setting CC would otherwise
83+ # cause confusion.
84+ - name : install gcc-cross
85+ 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_ENV
90+ TARGET_UPPERCASE=$(echo ${{ matrix.host_target }} | tr '[:lower:]-' '[:upper:]_')
91+ echo "CARGO_TARGET_${TARGET_UPPERCASE}_LINKER=${{ matrix.gcc_cross }}-gcc" | tee -a $GITHUB_ENV
4192
42- - name : Test Miri
93+ # 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 Miri
96+ if : ${{ !matrix.qemu }}
4397 run : ./ci/ci.sh
4498
99+ # The `style` job only runs on Linux; this makes sure the host-specific
100+ # code is also covered by clippy.
101+ - name : clippy
102+ run : ./miri clippy -- -D warnings
103+
45104 style :
46105 name : style checks
47106 runs-on : ubuntu-latest
51110
52111 - name : rustfmt
53112 run : ./miri fmt --check
54- - name : clippy
55- run : ./miri clippy -- -D warnings
56113 - name : clippy (no features)
57114 run : ./miri clippy --no-default-features -- -D warnings
58115 - name : clippy (all features)
73130 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
74131 # And they should be added below in `cron-fail-notify` as well.
75132 conclusion :
76- needs : [build , style, coverage]
133+ needs : [test , style, coverage]
77134 # We need to ensure this job does *not* get skipped if its dependencies fail,
78135 # because a skipped job is considered a success by GitHub. So we have to
79136 # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
@@ -102,40 +159,53 @@ jobs:
102159 - uses : actions/checkout@v4
103160 with :
104161 fetch-depth : 256 # get a bit more of the history
105- - name : install josh-proxy
106- run : cargo +stable install josh-proxy --git https://github.com/josh-project /josh --tag r24.10.04
162+ - name : install josh-sync
163+ run : cargo +stable install --locked --git https://github.com/rust-lang /josh-sync
107164 - name : setup bot git name and email
108165 run : |
109166 git config --global user.name 'The Miri Cronjob Bot'
110167 git config --global user.email 'miri@cron.bot'
111168 - name : Install nightly toolchain
112169 run : rustup toolchain install nightly --profile minimal
113- - name : get changes from rustc
114- run : ./miri rustc-pull
115170 - name : Install rustup-toolchain-install-master
116171 run : cargo install -f rustup-toolchain-install-master
117- - name : format changes (if any)
172+ - name : Push changes to a branch and create PR
118173 run : |
174+ # Make it easier to see what happens.
175+ set -x
176+ # Temporarily disable early exit to examine the status code of rustc-josh-sync
177+ set +e
178+ rustc-josh-sync pull
179+ exitcode=$?
180+ set -e
181+
182+ # If there were no changes to pull, rustc-josh-sync returns status code 2.
183+ # In that case, skip the rest of the job.
184+ if [ $exitcode -eq 2 ]; then
185+ echo "Nothing changed in rustc, skipping PR"
186+ exit 0
187+ elif [ $exitcode -ne 0 ]; then
188+ # If return code was not 0 or 2, rustc-josh-sync actually failed
189+ echo "error: rustc-josh-sync failed"
190+ exit ${exitcode}
191+ fi
192+
193+ # Format changes
119194 ./miri toolchain
120195 ./miri fmt --check || (./miri fmt && git commit -am "fmt")
121- - name : Push changes to a branch and create PR
122- run : |
123- # `git diff --exit-code` "succeeds" if the diff is empty.
124- if git diff --exit-code HEAD^; then echo "Nothing changed in rustc, skipping PR"; exit 0; fi
125- # The diff is non-empty, create a PR.
196+
197+ # Create a PR
126198 BRANCH="rustup-$(date -u +%Y-%m-%d)"
127199 git switch -c $BRANCH
128200 git push -u origin $BRANCH
129201 gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.'
130202 env :
131203 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
132- ZULIP_BOT_EMAIL : ${{ secrets.ZULIP_BOT_EMAIL }}
133- ZULIP_API_TOKEN : ${{ secrets.ZULIP_API_TOKEN }}
134204
135205 cron-fail-notify :
136206 name : cronjob failure notification
137207 runs-on : ubuntu-latest
138- needs : [build , style, coverage]
208+ needs : [test , style, coverage]
139209 if : ${{ github.event_name == 'schedule' && failure() }}
140210 steps :
141211 # Send a Zulip notification
@@ -153,7 +223,7 @@ jobs:
153223 It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.
154224
155225 This likely means that rustc changed the miri directory and
156- 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).
226+ 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).
157227
158228 Would you mind investigating this issue?
159229
0 commit comments