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

Add Dockerhub publishing step to the release GitHub Action workflow #740

Merged
merged 7 commits into from
Jul 12, 2024

Conversation

vsbogd
Copy link
Collaborator

@vsbogd vsbogd commented Jul 11, 2024

Fix version checking procedure in REPL to not hardcode the required version (@luketpeterson please review).
Add Docker image building and publishing step into release workflow.
Separate test and production environments for PyPi and DockerHub to be able approve each step separately.

@vsbogd vsbogd requested a review from luketpeterson July 11, 2024 12:14
repl/Cargo.toml Outdated
@@ -14,6 +14,7 @@ signal-hook = "0.3.17"
pyo3 = { version = "0.19.2", features = ["auto-initialize"], optional = true }
pep440_rs = { version = "0.3.11", optional = true }
hyperon = { workspace = true, optional = true } #TODO: We can only link Hyperon directly or through Python, but not both at the same time. The right fix is to allow HyperonPy to be built within Hyperon, See https://github.com/trueagi-io/hyperon-experimental/issues/283
semver = "1.0.23"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python module versions aren't semver, they're pep440. It turns out there is enough overlap that it's possible to parse one as the other in the common cases, but I don't think it's right to rely on this coincidence.

@@ -93,6 +93,27 @@ pub mod metta_interface_mod {
}
}

fn required_hyperon_version() -> String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit my hard-coded requirement was a bad solution and I am glad you are improving it.

I agree with what I think you're trying to do by using the repl's package.version; to reduce the number of configs we need to update and worry about when turning a release.

However, I don't like this approach of creating a VersionReq for HyperonPy by assuming it'll be within 1 minor version of the repl version.

One thought is to use a requirement string created from the actual hyperonpy version in CMake. This makes releasing easy, but it becomes annoying to use cargo directly to build the repl.

Another thought is to use a custom metadata key in the Cargo.toml. It's still two keys to update but they're in one place.

For example:

[workspace.package.metadata.hyperonpy]
hyperonpy-version-req = "==0.2.0"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPDATE: After trying to implement the custom Cargo.toml metadata solution, it seems like a clumsy solution. It appears to require parsing the Cargo.toml file ourselves. (At lease if the way docs.rs does it is the recommended way. https://github.com/rust-lang/docs.rs/blob/7ad8c626bd63a95dc483143274ff6f2410a34af9/crates/metadata/lib.rs#L103)

My thinking is that, if a "correct" solution is clumsy and probably not necessary, we should go with a "mostly-works" solution that is as simple as possible.

The purpose of the check is to prevent version incompatibilities from showing up as mysterious bugs that we waste time chasing. So if we plan to keep the components within a release in version lock-step, then I don't think we need the semver range.

So how about something like this:

        fn required_hyperon_version() -> String {
            const PACKAGE_VERSION: &str = env!("CARGO_PKG_VERSION");
            format!("=={PACKAGE_VERSION}")
        }

Copy link
Collaborator Author

@vsbogd vsbogd Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree that if we split repo on different components: corelib, python lib, repl, then we need to specify repl dependency manually. And keeping it in metadata looks like a proper way of doing this. I didn't think about it on the first place because Python package version right now is formed from the GitHub tag and its major.minor.patch version in a common case is equal to the version of the repl. In my suggestion I was trying to reproduce the previous code behavior using repl package version. Strictly speaking we cannot just rely repl and hyperonpy versions are changed by the same rules (because standards are different) but on the other hand while we are changing them we can rely on this.

I agree that we can just require this versions to be equal while we have them in a same repo. This implementation should cover most of the cases. In practice dev Python package version always contains local version like +ga9d9ff1a.d20240712 but as PEP440 requires local version to be compatible with non local one it passes check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied your suggestion in 61ee39b

While we keep them in the same repo and version them synchronously it
works. Local version of the Python package doesn't intervene to the
check because PEP440 requires it to be compatible with a public version.
@vsbogd vsbogd requested a review from luketpeterson July 12, 2024 07:07
Copy link
Contributor

@luketpeterson luketpeterson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the semver crate

Co-authored-by: luketpeterson <[email protected]>
@vsbogd vsbogd requested a review from luketpeterson July 12, 2024 07:48
@vsbogd vsbogd merged commit 5f85d87 into trueagi-io:main Jul 12, 2024
2 checks passed
@vsbogd vsbogd deleted the automate-release branch July 12, 2024 08:24
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