Skip to content

Commit cbd1557

Browse files
authored
Merge pull request rust-lang#4490 from Kobzol/use-josh-sync
Use `josh-sync` instead of `miri-script` for Josh synchronization
2 parents 037b2f6 + 8664aa7 commit cbd1557

File tree

7 files changed

+41
-354
lines changed

7 files changed

+41
-354
lines changed

src/tools/miri/.github/workflows/ci.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,35 +155,48 @@ jobs:
155155
- uses: actions/checkout@v4
156156
with:
157157
fetch-depth: 256 # get a bit more of the history
158-
- name: install josh-proxy
159-
run: cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
158+
- name: install josh-sync
159+
run: cargo +stable install --locked --git https://github.com/rust-lang/josh-sync
160160
- name: setup bot git name and email
161161
run: |
162162
git config --global user.name 'The Miri Cronjob Bot'
163163
git config --global user.email '[email protected]'
164164
- name: Install nightly toolchain
165165
run: rustup toolchain install nightly --profile minimal
166-
- name: get changes from rustc
167-
run: ./miri rustc-pull
168166
- name: Install rustup-toolchain-install-master
169167
run: cargo install -f rustup-toolchain-install-master
170-
- name: format changes (if any)
168+
- name: Push changes to a branch and create PR
171169
run: |
170+
# Make it easier to see what happens.
171+
set -x
172+
# Temporarily disable early exit to examine the status code of rustc-josh-sync
173+
set +e
174+
rustc-josh-sync pull
175+
exitcode=$?
176+
set -e
177+
178+
# If there were no changes to pull, rustc-josh-sync returns status code 2.
179+
# In that case, skip the rest of the job.
180+
if [ $exitcode -eq 2 ]; then
181+
echo "Nothing changed in rustc, skipping PR"
182+
exit 0
183+
elif [ $exitcode -ne 0 ]; then
184+
# If return code was not 0 or 2, rustc-josh-sync actually failed
185+
echo "error: rustc-josh-sync failed"
186+
exit ${exitcode}
187+
fi
188+
189+
# Format changes
172190
./miri toolchain
173191
./miri fmt --check || (./miri fmt && git commit -am "fmt")
174-
- name: Push changes to a branch and create PR
175-
run: |
176-
# `git diff --exit-code` "succeeds" if the diff is empty.
177-
if git diff --exit-code HEAD^; then echo "Nothing changed in rustc, skipping PR"; exit 0; fi
178-
# The diff is non-empty, create a PR.
192+
193+
# Create a PR
179194
BRANCH="rustup-$(date -u +%Y-%m-%d)"
180195
git switch -c $BRANCH
181196
git push -u origin $BRANCH
182197
gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.'
183198
env:
184199
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185-
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
186-
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}
187200

188201
cron-fail-notify:
189202
name: cronjob failure notification

src/tools/miri/CONTRIBUTING.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,25 +297,27 @@ You can also directly run Miri on a Rust source file:
297297

298298
## Advanced topic: Syncing with the rustc repo
299299

300-
We use the [`josh` proxy](https://github.com/josh-project/josh) to transmit changes between the
300+
We use the [`josh-sync`](https://github.com/rust-lang/josh-sync) tool to transmit changes between the
301301
rustc and Miri repositories. You can install it as follows:
302302

303303
```sh
304-
cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
304+
cargo install --locked --git https://github.com/rust-lang/josh-sync
305305
```
306306

307-
Josh will automatically be started and stopped by `./miri`.
307+
The commands below will automatically install and manage the [Josh](https://github.com/josh-project/josh) proxy that performs the actual work.
308308

309309
### Importing changes from the rustc repo
310310

311311
*Note: this usually happens automatically, so these steps rarely have to be done by hand.*
312312

313313
We assume we start on an up-to-date master branch in the Miri repo.
314314

315+
1) First, create a branch for the pull, e.g. `git checkout -b rustup`
316+
2) Then run the following:
315317
```sh
316318
# Fetch and merge rustc side of the history. Takes ca 5 min the first time.
317319
# This will also update the `rustc-version` file.
318-
./miri rustc-pull
320+
rustc-josh-sync pull
319321
# Update local toolchain and apply formatting.
320322
./miri toolchain && ./miri fmt
321323
git commit -am "rustup"
@@ -328,12 +330,12 @@ needed.
328330

329331
### Exporting changes to the rustc repo
330332

331-
We will use the josh proxy to push to your fork of rustc. Run the following in the Miri repo,
333+
We will use the `josh-sync` tool to push to your fork of rustc. Run the following in the Miri repo,
332334
assuming we are on an up-to-date master branch:
333335

334336
```sh
335337
# Push the Miri changes to your rustc fork (substitute your github handle for YOUR_NAME).
336-
./miri rustc-push YOUR_NAME miri
338+
rustc-josh-sync push miri YOUR_NAME
337339
```
338340

339341
This will create a new branch called `miri` in your fork, and the output should include a link that

src/tools/miri/josh-sync.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
repo = "miri"
2+
filter = ":rev(75dd959a3a40eb5b4574f8d2e23aa6efbeb33573:prefix=src/tools/miri):/src/tools/miri"

src/tools/miri/miri-script/Cargo.lock

Lines changed: 2 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -116,27 +116,6 @@ version = "1.0.4"
116116
source = "registry+https://github.com/rust-lang/crates.io-index"
117117
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
118118

119-
[[package]]
120-
name = "directories"
121-
version = "6.0.0"
122-
source = "registry+https://github.com/rust-lang/crates.io-index"
123-
checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"
124-
dependencies = [
125-
"dirs-sys",
126-
]
127-
128-
[[package]]
129-
name = "dirs-sys"
130-
version = "0.5.0"
131-
source = "registry+https://github.com/rust-lang/crates.io-index"
132-
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
133-
dependencies = [
134-
"libc",
135-
"option-ext",
136-
"redox_users",
137-
"windows-sys 0.60.2",
138-
]
139-
140119
[[package]]
141120
name = "dunce"
142121
version = "1.0.5"
@@ -165,17 +144,6 @@ version = "2.3.0"
165144
source = "registry+https://github.com/rust-lang/crates.io-index"
166145
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
167146

168-
[[package]]
169-
name = "getrandom"
170-
version = "0.2.16"
171-
source = "registry+https://github.com/rust-lang/crates.io-index"
172-
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
173-
dependencies = [
174-
"cfg-if",
175-
"libc",
176-
"wasi 0.11.1+wasi-snapshot-preview1",
177-
]
178-
179147
[[package]]
180148
name = "getrandom"
181149
version = "0.3.3"
@@ -185,7 +153,7 @@ dependencies = [
185153
"cfg-if",
186154
"libc",
187155
"r-efi",
188-
"wasi 0.14.2+wasi-0.2.4",
156+
"wasi",
189157
]
190158

191159
[[package]]
@@ -221,16 +189,6 @@ version = "0.2.174"
221189
source = "registry+https://github.com/rust-lang/crates.io-index"
222190
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
223191

224-
[[package]]
225-
name = "libredox"
226-
version = "0.1.4"
227-
source = "registry+https://github.com/rust-lang/crates.io-index"
228-
checksum = "1580801010e535496706ba011c15f8532df6b42297d2e471fec38ceadd8c0638"
229-
dependencies = [
230-
"bitflags",
231-
"libc",
232-
]
233-
234192
[[package]]
235193
name = "linux-raw-sys"
236194
version = "0.9.4"
@@ -249,7 +207,6 @@ version = "0.1.0"
249207
dependencies = [
250208
"anyhow",
251209
"clap",
252-
"directories",
253210
"dunce",
254211
"itertools",
255212
"path_macro",
@@ -275,12 +232,6 @@ version = "1.70.1"
275232
source = "registry+https://github.com/rust-lang/crates.io-index"
276233
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
277234

278-
[[package]]
279-
name = "option-ext"
280-
version = "0.2.0"
281-
source = "registry+https://github.com/rust-lang/crates.io-index"
282-
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
283-
284235
[[package]]
285236
name = "path_macro"
286237
version = "1.0.0"
@@ -311,17 +262,6 @@ version = "5.3.0"
311262
source = "registry+https://github.com/rust-lang/crates.io-index"
312263
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
313264

314-
[[package]]
315-
name = "redox_users"
316-
version = "0.5.0"
317-
source = "registry+https://github.com/rust-lang/crates.io-index"
318-
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
319-
dependencies = [
320-
"getrandom 0.2.16",
321-
"libredox",
322-
"thiserror",
323-
]
324-
325265
[[package]]
326266
name = "rustc_version"
327267
version = "0.4.1"
@@ -427,32 +367,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
427367
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
428368
dependencies = [
429369
"fastrand",
430-
"getrandom 0.3.3",
370+
"getrandom",
431371
"once_cell",
432372
"rustix",
433373
"windows-sys 0.59.0",
434374
]
435375

436-
[[package]]
437-
name = "thiserror"
438-
version = "2.0.12"
439-
source = "registry+https://github.com/rust-lang/crates.io-index"
440-
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
441-
dependencies = [
442-
"thiserror-impl",
443-
]
444-
445-
[[package]]
446-
name = "thiserror-impl"
447-
version = "2.0.12"
448-
source = "registry+https://github.com/rust-lang/crates.io-index"
449-
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
450-
dependencies = [
451-
"proc-macro2",
452-
"quote",
453-
"syn",
454-
]
455-
456376
[[package]]
457377
name = "unicode-ident"
458378
version = "1.0.18"
@@ -475,12 +395,6 @@ dependencies = [
475395
"winapi-util",
476396
]
477397

478-
[[package]]
479-
name = "wasi"
480-
version = "0.11.1+wasi-snapshot-preview1"
481-
source = "registry+https://github.com/rust-lang/crates.io-index"
482-
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
483-
484398
[[package]]
485399
name = "wasi"
486400
version = "0.14.2+wasi-0.2.4"

src/tools/miri/miri-script/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ anyhow = "1.0"
2222
xshell = "0.2.6"
2323
rustc_version = "0.4"
2424
dunce = "1.0.4"
25-
directories = "6"
2625
serde = "1"
2726
serde_json = "1"
2827
serde_derive = "1"

0 commit comments

Comments
 (0)