Skip to content

Commit a03f2d7

Browse files
authored
Merge pull request #4490 from Kobzol/use-josh-sync
Use `josh-sync` instead of `miri-script` for Josh synchronization
2 parents ae56827 + f08b06b commit a03f2d7

File tree

7 files changed

+41
-354
lines changed

7 files changed

+41
-354
lines changed

.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 'miri@cron.bot'
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

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

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"

miri-script/Cargo.lock

Lines changed: 2 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)