@@ -13,35 +13,94 @@ defaults:
13
13
shell : bash
14
14
15
15
jobs :
16
- build :
16
+ test :
17
+ name : test (${{ matrix.host_target }})
17
18
strategy :
18
19
fail-fast : false
19
20
matrix :
20
21
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
27
50
runs-on : ${{ matrix.os }}
28
51
env :
29
52
HOST_TARGET : ${{ matrix.host_target }}
30
53
steps :
31
54
- 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"
32
78
- uses : ./.github/workflows/setup
33
79
with :
34
80
toolchain_flags : " --host ${{ matrix.host_target }}"
35
81
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
41
92
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 }}
43
97
run : ./ci/ci.sh
44
98
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
+
45
104
style :
46
105
name : style checks
47
106
runs-on : ubuntu-latest
51
110
52
111
- name : rustfmt
53
112
run : ./miri fmt --check
54
- - name : clippy
55
- run : ./miri clippy -- -D warnings
56
113
- name : clippy (no features)
57
114
run : ./miri clippy --no-default-features -- -D warnings
58
115
- name : clippy (all features)
73
130
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
74
131
# And they should be added below in `cron-fail-notify` as well.
75
132
conclusion :
76
- needs : [build , style, coverage]
133
+ needs : [test , style, coverage]
77
134
# We need to ensure this job does *not* get skipped if its dependencies fail,
78
135
# because a skipped job is considered a success by GitHub. So we have to
79
136
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
@@ -102,40 +159,53 @@ jobs:
102
159
- uses : actions/checkout@v4
103
160
with :
104
161
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
107
164
- name : setup bot git name and email
108
165
run : |
109
166
git config --global user.name 'The Miri Cronjob Bot'
110
167
git config --global user.email '[email protected] '
111
168
- name : Install nightly toolchain
112
169
run : rustup toolchain install nightly --profile minimal
113
- - name : get changes from rustc
114
- run : ./miri rustc-pull
115
170
- name : Install rustup-toolchain-install-master
116
171
run : cargo install -f rustup-toolchain-install-master
117
- - name : format changes (if any)
172
+ - name : Push changes to a branch and create PR
118
173
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
119
194
./miri toolchain
120
195
./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
126
198
BRANCH="rustup-$(date -u +%Y-%m-%d)"
127
199
git switch -c $BRANCH
128
200
git push -u origin $BRANCH
129
201
gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.'
130
202
env :
131
203
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
132
- ZULIP_BOT_EMAIL : ${{ secrets.ZULIP_BOT_EMAIL }}
133
- ZULIP_API_TOKEN : ${{ secrets.ZULIP_API_TOKEN }}
134
204
135
205
cron-fail-notify :
136
206
name : cronjob failure notification
137
207
runs-on : ubuntu-latest
138
- needs : [build , style, coverage]
208
+ needs : [test , style, coverage]
139
209
if : ${{ github.event_name == 'schedule' && failure() }}
140
210
steps :
141
211
# Send a Zulip notification
@@ -153,7 +223,7 @@ jobs:
153
223
It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.
154
224
155
225
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).
157
227
158
228
Would you mind investigating this issue?
159
229
0 commit comments