Skip to content

Use josh-sync instead of miri-script for Josh synchronization #4490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,35 +147,48 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 256 # get a bit more of the history
- name: install josh-proxy
run: cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
- name: install josh-sync
run: cargo +stable install --locked --git https://github.com/rust-lang/josh-sync
- name: setup bot git name and email
run: |
git config --global user.name 'The Miri Cronjob Bot'
git config --global user.email 'miri@cron.bot'
- name: Install nightly toolchain
run: rustup toolchain install nightly --profile minimal
- name: get changes from rustc
run: ./miri rustc-pull
- name: Install rustup-toolchain-install-master
run: cargo install -f rustup-toolchain-install-master
- name: format changes (if any)
- name: Push changes to a branch and create PR
run: |
# Make it easier to see what happens.
set -x
# Temporarily disable early exit to examine the status code of rustc-josh-sync
set +e
rustc-josh-sync pull
exitcode=$?
set -e

# If there were no changes to pull, rustc-josh-sync returns status code 2.
# In that case, skip the rest of the job.
if [ $exitcode -eq 2 ]; then
echo "Nothing changed in rustc, skipping PR"
exit 0
elif [ $exitcode -ne 0 ]; then
# If return code was not 0 or 2, rustc-josh-sync actually failed
echo "error: rustc-josh-sync failed"
exit ${exitcode}
fi

# Format changes
./miri toolchain
./miri fmt --check || (./miri fmt && git commit -am "fmt")
- name: Push changes to a branch and create PR
run: |
# `git diff --exit-code` "succeeds" if the diff is empty.
if git diff --exit-code HEAD^; then echo "Nothing changed in rustc, skipping PR"; exit 0; fi
# The diff is non-empty, create a PR.

# Create a PR
BRANCH="rustup-$(date -u +%Y-%m-%d)"
git switch -c $BRANCH
git push -u origin $BRANCH
gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}

cron-fail-notify:
name: cronjob failure notification
Expand Down
14 changes: 8 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,25 +297,27 @@ You can also directly run Miri on a Rust source file:

## Advanced topic: Syncing with the rustc repo

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

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

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

### Importing changes from the rustc repo

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

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

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

### Exporting changes to the rustc repo

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

```sh
# Push the Miri changes to your rustc fork (substitute your github handle for YOUR_NAME).
./miri rustc-push YOUR_NAME miri
rustc-josh-sync push miri YOUR_NAME
```

This will create a new branch called `miri` in your fork, and the output should include a link that
Expand Down
2 changes: 2 additions & 0 deletions josh-sync.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
repo = "miri"
filter = ":rev(75dd959a3a40eb5b4574f8d2e23aa6efbeb33573:prefix=src/tools/miri):/src/tools/miri"
90 changes: 2 additions & 88 deletions miri-script/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion miri-script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ anyhow = "1.0"
xshell = "0.2.6"
rustc_version = "0.4"
dunce = "1.0.4"
directories = "6"
serde = "1"
serde_json = "1"
serde_derive = "1"
Expand Down
Loading
Loading