Skip to content
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

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

StevenJiang1110
Copy link
Collaborator

@StevenJiang1110 StevenJiang1110 commented Oct 14, 2024

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

@StevenJiang1110 StevenJiang1110 marked this pull request as draft October 14, 2024 07:28
@StevenJiang1110 StevenJiang1110 force-pushed the fix-publish-dry-run branch 3 times, most recently from cdfcbc3 to c98d178 Compare October 14, 2024 07:51
@StevenJiang1110 StevenJiang1110 marked this pull request as ready for review October 14, 2024 07:53
@StevenJiang1110 StevenJiang1110 marked this pull request as draft October 14, 2024 08:07
@StevenJiang1110 StevenJiang1110 force-pushed the fix-publish-dry-run branch 4 times, most recently from aac29c6 to ae1f19c Compare October 14, 2024 09:22
@StevenJiang1110 StevenJiang1110 marked this pull request as ready for review October 14, 2024 09:22
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" }
Copy link
Contributor

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?

Copy link
Collaborator Author

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
Copy link
Contributor

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?

Copy link
Collaborator Author

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
Copy link
Contributor

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?

Copy link
Collaborator Author

@StevenJiang1110 StevenJiang1110 Oct 15, 2024

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.

Copy link
Contributor

@tatetian tatetian left a 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!

@tatetian tatetian merged commit b269118 into asterinas:main Oct 16, 2024
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants