Ci/cargo publish on release
Addresses the following Issue
- #527
Crates.io require that dependencies of a published crate be already published.
Error dependency not published
Smart-release fixes this by taking into consideration the interdependency of the crates. For the moment I've disabled changelog generation and github release but these are features that could be used if wanted.
%%{init: {'theme': 'neutral', 'themeVariables': {'padding': 20}}}%%
graph TD;
subgraph DD[Dependency Diagram]
axone-law-stone-->axone-objectarium;
axone-objectarium-client-->axone-objectarium;
axone-objectarium-client-->axone-wasm;
axone-logic-bindings-->axone-wasm;
axone-law-stone-->axone-wasm;
axone-law-stone-->axone-objectarium-client;
axone-law-stone-->axone-logic-bindings;
axone-cognitarium-->axone-rdf;
axone-dataverse-->axone-rdf;
axone-dataverse-->axone-cognitarium;
axone-cognitarium-client-->axone-cognitarium;
axone-dataverse-->axone-cognitarium-client;
end
I've taken the liberty of filling missing crate manifest fields useful for crate adoption. I leave it up to the team to decide if they're appropriate.
OBS
- Smart-release requires cmake to run
- There is a list of acceptable categories to chose from on crates.io
- Dependencies declared by path in the workspace manifest do not inherit the crate version as of date. See the following issue with comments
- Crates.io requires a token for publishing.
- keywords might be something we'd want to add. For now I leave it at your discretion.
- The publish has not been tested more than doing a dry run. Seeing as there is no crate currently available on crates.io the dry run fails, but should work in prod as the relative crate would have been published just before.
TODO:
Summary by CodeRabbit
-
New Features
- Added a new GitHub Actions workflow to publish crates to crates.io.
- Implemented tasks for updating workspace dependency versions and publishing crates.
-
Enhancements
- Updated
Cargo.tomlfiles across multiple packages to include detailed metadata such as authors, homepage, license, documentation, and repository information. - Upgraded
editionto "2021" in relevantCargo.tomlfiles.
- Updated
-
Documentation
- Updated
README.mdfor theaxone-wasmpackage to reflect new functionality of managing CosmWasm data.
- Updated
Walkthrough
A comprehensive update has been made to various configuration files and Rust packages within the project. Key changes include enhanced GitHub Actions workflows for release and publishing, updated metadata in Cargo.toml files, and additional tasks in Makefile.toml for version management and publishing. The updates streamline the build, test, and release processes, ensuring better dependency management and automated crate publishing.
Changes
| File(s) | Summary of Changes |
|---|---|
| .github/workflows/release.yml | Added setup for CMake 3.29.0, steps to publish crates to crates.io using Cargo smart-release. |
| .github/workflows/publish.yml | Defined a workflow named "Publish" that triggers on any tag push, including jobs for linting, building, testing, and publishing. |
| .releaserc.yml | Updated prepareCmd script to update workspace dependency versions before build commands. |
| Cargo.toml | Added metadata for AXONE, specified authors, homepage, license file, and version settings for dependencies. |
| Makefile.toml | Added tasks for updating workspace dependency versions and publishing crates. |
| .../contracts/axone-cognitarium/Cargo.toml | Modified authors, added categories, description, documentation, homepage, and updated version to 5.0.0. |
| .../contracts/axone-dataverse/Cargo.toml | Added workspace configurations, updated categories, description, and metadata fields. |
| .../contracts/axone-law-stone/Cargo.toml | Updated authors, categories, description, documentation, homepage, and other metadata fields. |
| .../contracts/axone-objectarium/Cargo.toml | Added workspace-related metadata and updated fields. |
| .../packages/axone-cognitarium-client/Cargo.toml | Updated authors, categories, description, documentation, homepage, and other metadata fields. |
| .../packages/axone-logic-bindings/Cargo.toml | Added workspace-related metadata, updated descriptions and URLs. |
| .../packages/axone-objectarium-client/Cargo.toml | Updated authors, categories, description, documentation, homepage, and other metadata fields. |
| .../packages/axone-rdf/Cargo.toml | Added workspace-related metadata, updated authors, and increased edition to "2021". |
| .../packages/axone-wasm/Cargo.toml | Replaced authors field, added new metadata fields, and updated edition. |
| .../packages/axone-wasm/README.md | Renamed from managing RDF data to managing CosmWasm data. |
Poem
In the land of code, where updates flow, New workflows dance, with a vibrant glow. Metadata set, crates on the rise, Publishing dreams reach the skies. With Cargo's help and CMake's might, The project gleams, a coder's delight.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai generate interesting stats about this repository and render them as a table. -
@coderabbitai show all the console.log statements in this repository. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (invoked as PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
size-limit report 📦
| Path | Size |
|---|---|
| target/wasm32-unknown-unknown/release/axone_objectarium.wasm | 400.67 KB (0%) |
| target/wasm32-unknown-unknown/release/axone_law_stone.wasm | 599.48 KB (0%) |
| target/wasm32-unknown-unknown/release/axone_cognitarium.wasm | 762.25 KB (0%) |
| target/wasm32-unknown-unknown/release/axone_dataverse.wasm | 622.17 KB (0%) |
Thanks for the feedback @ccamel @amimart , as you point out the versioning is not correctly handled.
I've taken into consideration your suggestions and I think the simplest way to handle the versioning is to keep the current system and build upon it as you suggest.
I've tried cargo-workspaces to publish but found it unsatisfactory as it basically has the same problems as smart-release, requiring versioning on workspace dependencies.
As expected the toml-cli does not support outputting to file while keeping the format and therefore I am using this unix command trick where I create a temporary file to preserve the format. See below for task result
cargo make update-workspace-dependency-versions 6.0.0
I'm sorry for the delay to respond, work and private life got in the way 😄
After further investigation of the cargo-smart-release crate I realise it does not support publishing crates without also handling the release.
cargo-smart-release can decide not to publish a crate if it deems that the crate has already been published. This is done by checking the existence of release tags in the github repository.
I'd say our best bet for publication is cargo workspaces, the tool @ccamel suggested for version control, although I am not able to correctly test the publication.
cargo workspaces publish looks at the workspace manifest to decide which crates to publish.
What do you think @ccamel @amimart @bdeneux ? Should we try out cargo workspaces?
Superseded by #672. Thanks for the exploration phase and the great initial work on resolving this issue! 🙌