-
Notifications
You must be signed in to change notification settings - Fork 97
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
Resolve cargo publish --dry-run
check failure
#1445
Conversation
cdfcbc3
to
c98d178
Compare
aac29c6
to
ae1f19c
Compare
ostd-macros = { version = "0.9.2", path = "libs/ostd-macros" } | ||
ostd-test = { version = "0.9.2", path = "libs/ostd-test" } | ||
ostd-macros = { path = "libs/ostd-macros", version = "0.9.2" } | ||
ostd-test = { path = "libs/ostd-test", version = "0.9.2" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the order important or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order is not important; I'm just aligning it with other dependencies: when both git/path
and version are specified, git/path
is placed before the version. This follows the official example.
I included this change in the PR to trigger the publish_ostd_and_osdk
CI, so I have to make a minor modification in ostd
.
cargo doc $TARGET_ARGS | ||
|
||
# Restore the original crate version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the previous two commands failed? The script will exit and the version number will not be restored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if the check fails, the restore command will be skipped.
Upon reviewing the code, I realized the restore step is unnecessary. Since the script runs on a temporary codebase in CI, there's no need to restore the version. And the check will still execute successfully without restoring.
current_version=$(cat $ASTER_SRC_DIR/VERSION) | ||
next_patched_version=$(echo "$current_version" | awk -F. '{printf "%d.%d.%d\n", $1, $2, $3 + 1}') | ||
pattern="^version = \"[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\"$" | ||
sed -i "0,/${pattern}/s/${pattern}/version = \"${next_patched_version}\"/1" Cargo.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update the version in other Cargo.toml
files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing only the version of the crate to be published should be sufficient.
For a crate that specifies a multi-location dependency like this:
ostd-macros = { path = "libs/ostd-macros", version = "0.9.2" }
It simply requires the version of crate at path libs/ostd-macros
to be compatible with version 0.9.2
. This means we can update the version of libs/ostd-macros
to 0.9.x
for any x that satisfies x >= 2
, and the compilation will still succeed. However, changing it to 0.10.0
wouldn't be compatible with 0.9.2
.
Therefore, we only need to adjust the version of libs/ostd-macros
and don't need to modify the dependency version for other crates that rely on ostd-macros
.
ae1f19c
to
37862e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the contribution!
Fix the CI publish_ostd_and_osdk failure.
The failure can be viewed at https://github.com/asterinas/asterinas/actions/runs/11320163469/job/31477283439?pr=1443