Skip to content

Commit f0b472c

Browse files
authored
Revert a mistake in v0.22 that prevents cargo publish (#1065)
#1055 removed the version for `mmtk-macros` in `Cargo.toml`. I thought it was fine, as it uses a local path as the dependency. But `cargo publish` actually requires all the dependencies to specify a version. So `cargo publish` failed for https://github.com/mmtk/mmtk-core/releases/tag/v0.22.0 in https://github.com/mmtk/mmtk-core/actions/runs/7284255107/job/19849376243. The action did not return a non-zero code so I was not aware of the issue. `v0.22` was not published to `crates.io`. This PR adds back the version for `mmtk-macros`, adds a check for `cargo publish` dry run in the style check, and fixes the publish script so the script properly fails if all the attempts of `cargo publish` fail.
1 parent b66fa35 commit f0b472c

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

.github/scripts/ci-style.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,9 @@ style_check_auxiliary_crate() {
4242
}
4343

4444
style_check_auxiliary_crate macros
45+
46+
# --- cargo publish dry run ---
47+
# Main crate
48+
cargo publish --dry-run
49+
# Macros
50+
cargo publish --dry-run --manifest-path=macros/Cargo.toml

.github/workflows/cargo-publish.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@ jobs:
3333
# The script will retry publish for 5 times with 60 seconds between the retries.
3434
- name: Public mmtk-core
3535
run: |
36+
success=false
37+
3638
for n in {1..5}; do
37-
echo "Attempt #"$n
38-
cargo publish && break
39-
echo "Wait for Retry #"$n
40-
sleep 60
39+
echo "Attempt #"$n
40+
cargo publish && { success=true; break; }
41+
echo "Wait for Retry #"$n
42+
sleep 60
4143
done
44+
45+
if [ "$success" = false ]; then
46+
echo "All attempts to publish failed."
47+
exit 1
48+
fi

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ libc = "0.2"
3737
log = { version = "0.4", features = ["max_level_trace", "release_max_level_off"] }
3838
memoffset = "0.9"
3939
mimalloc-sys = { version = "0.1.6", optional = true }
40-
# MMTk macros
41-
mmtk-macros = { path = "macros/" }
40+
# MMTk macros - we have to specify a version here in order to publish the crate, even though we use the dependency from a local path.
41+
mmtk-macros = { version="0.22.0", path = "macros/" }
4242
num_cpus = "1.8"
4343
num-traits = "0.2"
4444
pfm = { version = "0.1.1", optional = true }

docs/team/release.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ If the current version is `0.X.x`, the new version should be `0.X+1.0`.
3232
The PR should include these changes:
3333

3434
1. Bump version in `Cargo.toml`.
35-
2. Bump version in `macros/Cargo.toml`.
35+
2. Bump version in `macros/Cargo.toml`. Use the new version for the `mmtk-macros` dependency in `Cargo.toml`.
3636
3. Update `CHANGELOG.md`:
3737
1. Add a section for the new version number and the cut-off date (when the PR is created)
3838
2. Add change logs for the release. The following shows one convenient way to do it. If there is a better way, we should adopt.
@@ -81,7 +81,13 @@ Once the PRs are merged, we can tag releases on Github.
8181
2. Keep an eye on the CI status for the latest commit in MMTk core.
8282
3. Do point release for fixing severe issues. Currently we normally do not need point releases. Normal bug fixes or any other issues can be fixed in the next release.
8383
But in rare cases, such as the current tagged release cannot build, cannot run, or it somehow fails in publishing, we may need to do a point release.
84-
* If there is no other commit in `master` yet, doing a point release follows exactly the same process above. Depending on the changes, we may or may not need a point release
85-
for the bindings.
86-
* If there are commits in `master` that we do not want to include in the point release, the point release should be in a separate branch in the upstream repository.
87-
The changes for the point release should be merged back to `master`.
84+
85+
### Point release
86+
87+
1. Create a pull request to fix the issue.
88+
2. Create a pull request to bump the version number, following the same process [above](#create-prs-to-bump-the-version-number).
89+
3. Once the PRs are merged,
90+
* Create a branch in the main repository based on the last release `v0.x.y` (from `master` or from the last point release branch), named with the new point release version, such as `v0.x.y+1`.
91+
* Cherry pick commits from `master` that should be included in the new point release.
92+
* Tag a release from the branch, following the same process [above](#tag-releases).
93+
* If there is no other commit in `master` yet, there is no need to create a different branch for the release, and we can tag a release from `master`.

0 commit comments

Comments
 (0)