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

Ci/cargo publish on release #569

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ErikssonJoakim
Copy link
Collaborator

@ErikssonJoakim ErikssonJoakim commented Jun 2, 2024

Addresses the following Issue

Crates.io require that dependencies of a published crate be already published.

Error dependency not published

Screenshot 2024-06-02 at 22 29 44

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
Loading

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.toml files across multiple packages to include detailed metadata such as authors, homepage, license, documentation, and repository information.
    • Upgraded edition to "2021" in relevant Cargo.toml files.
  • Documentation

    • Updated README.md for the axone-wasm package to reflect new functionality of managing CosmWasm data.

@ErikssonJoakim ErikssonJoakim self-assigned this Jun 2, 2024
Copy link

coderabbitai bot commented Jun 2, 2024

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?

Share
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 @coderabbitai in 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 @coderabbitai in 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to 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.yaml file 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.

@ErikssonJoakim ErikssonJoakim added documentation Improvements or additions to documentation enhancement New feature or request github_actions Pull requests that update GitHub Actions code labels Jun 2, 2024
@bot-anik
Copy link
Member

bot-anik commented Jun 2, 2024

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%)

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

@ErikssonJoakim ErikssonJoakim marked this pull request as ready for review June 13, 2024 22:00
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f54a8f9 and aac40dd.

Files selected for processing (12)
  • .github/workflows/release.yml (1 hunks)
  • Cargo.toml (2 hunks)
  • contracts/axone-cognitarium/Cargo.toml (1 hunks)
  • contracts/axone-dataverse/Cargo.toml (1 hunks)
  • contracts/axone-law-stone/Cargo.toml (1 hunks)
  • contracts/axone-objectarium/Cargo.toml (1 hunks)
  • packages/axone-cognitarium-client/Cargo.toml (1 hunks)
  • packages/axone-logic-bindings/Cargo.toml (1 hunks)
  • packages/axone-objectarium-client/Cargo.toml (1 hunks)
  • packages/axone-rdf/Cargo.toml (1 hunks)
  • packages/axone-wasm/Cargo.toml (1 hunks)
  • packages/axone-wasm/README.md (1 hunks)
Files skipped from review due to trivial changes (8)
  • contracts/axone-cognitarium/Cargo.toml
  • contracts/axone-law-stone/Cargo.toml
  • contracts/axone-objectarium/Cargo.toml
  • packages/axone-cognitarium-client/Cargo.toml
  • packages/axone-objectarium-client/Cargo.toml
  • packages/axone-rdf/Cargo.toml
  • packages/axone-wasm/Cargo.toml
  • packages/axone-wasm/README.md
Additional comments not posted (6)
packages/axone-logic-bindings/Cargo.toml (2)

2-11: LGTM! The addition of comprehensive metadata fields enhances the package's visibility and manageability on crates.io.


Line range hint 13-23: Consider ensuring consistency in the specification of dependency versions across the workspace, particularly for form_urlencoded and url.

Verification successful

Dependency versions for form_urlencoded and url are consistently specified across the workspace.

  • form_urlencoded = "1.2.1" is found in:

    • packages/axone-wasm/Cargo.toml
    • packages/axone-logic-bindings/Cargo.toml
  • url = "2.5.0" is found in:

    • packages/axone-wasm/Cargo.toml
    • packages/axone-logic-bindings/Cargo.toml
    • contracts/axone-law-stone/Cargo.toml
    • contracts/axone-dataverse/Cargo.toml
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check for consistency in dependency versions across the workspace.

# Test: Search for `form_urlencoded` and `url` versions across all Cargo.toml files. Expect: Consistent versioning.
rg --type toml $'form_urlencoded = "1.2.1"'
rg --type toml $'url = "2.5.0"'

Length of output: 403

Cargo.toml (2)

5-9: The updated workspace package metadata is well-defined and enhances project management.


24-32: Ensure that the update to version "5.0.0" for all internal dependencies is well-coordinated with dependent projects or modules to manage potential breaking changes.

contracts/axone-dataverse/Cargo.toml (1)

2-11: Excellent addition of metadata fields to enhance the contract's visibility and manageability on crates.io.

.github/workflows/release.yml (1)

80-99: The setup for CMake and the automated publishing steps using cargo smart-release are well-integrated into the release workflow. Ensure that environment variables and secrets like CARGO_REGISTRY_TOKEN are securely managed.

Copy link
Member

@amimart amimart left a comment

Choose a reason for hiding this comment

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

Thanks for solving the crucial need of publishing those crates!

I appreciated your analysis in description it truly helps the review. I've made some remarks I'd be happy to discuss :)

with:
cmake-version: "3.29.0"

- name: Publish crates to crates.io
Copy link
Member

@amimart amimart Jun 14, 2024

Choose a reason for hiding this comment

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

The publication should be part of its own workflow I guess, to separate the release from the publish. And this workflow could be triggered by the addition of a new tag.

] }
axone-cognitarium-client = { path = "packages/axone-cognitarium-client" }
axone-logic-bindings = { path = "packages/axone-logic-bindings" }
], version = "5.0.0" }
Copy link
Member

@amimart amimart Jun 14, 2024

Choose a reason for hiding this comment

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

I understand the need of duplicating the version here, but it brings a new responsibility that is not managed here, this version must be in sync the new released versions. And sadly cargo doesn't come with CLI tools to achieved that 😢..

Currently at release each contracts & packages have their version updated by semantic release, this is configured in the .releaserc.yml. However this replace plugin isn't suitable to update versions in the dependency list..

I think we could easily script this update using toml-cli, for example:

toml set Cargo.toml workspace.dependencies.axone-rdf.version 4.1.0

I think the changes made by toml-cli may need to be properly formatted to please the linter, and committed in the release commit.

All this logic may be embedded in a new task in the Makefile.toml I think.

Copy link
Member

@ccamel ccamel left a comment

Choose a reason for hiding this comment

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

Thanks @ErikssonJoakim for the very insightful analysis and preliminary implementation to tackle this issue.

After delving deeper into the issue, I wonder if we could leverage the cargo-workspaces tool. AFAIS, this tool offers several features, including:

For instance:

➜ cargo workspaces version --no-git-commit -y custom 6.0.0
info looking for changes since v5.0.0
info current common version 5.0.0

Changes:
 - axone-cognitarium: 5.0.0 => 6.0.0
 - axone-dataverse: 5.0.0 => 6.0.0
 - axone-law-stone: 5.0.0 => 6.0.0
 - axone-objectarium: 5.0.0 => 6.0.0
 - axone-cognitarium-client: 5.0.0 => 6.0.0
 - axone-logic-bindings: 5.0.0 => 6.0.0
 - axone-objectarium-client: 5.0.0 => 6.0.0
 - axone-rdf: 5.0.0 => 6.0.0
 - axone-wasm: 5.0.0 => 6.0.0

NB: toml-cli proposed by @amimart is also a good solution.

  • Publishing artifacts in the correct order according to dependencies (according to docs). It’s something to test (which I haven’t done yet), but I've a feeling it could meet our needs, or at least serve as a foundation to build upon.

what do you think ?

@ccamel ccamel linked an issue Jun 18, 2024 that may be closed by this pull request
@ccamel ccamel marked this pull request as draft June 24, 2024 10:23
@ErikssonJoakim
Copy link
Collaborator Author

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

Screenshot 2024-07-06 at 19 44 52

I'm sorry for the delay to respond, work and private life got in the way 😄

@ErikssonJoakim ErikssonJoakim marked this pull request as ready for review July 6, 2024 17:53
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aac40dd and 0eb2748.

Files selected for processing (14)
  • .github/workflows/publish.yml (1 hunks)
  • .releaserc.yml (1 hunks)
  • Cargo.toml (2 hunks)
  • Makefile.toml (2 hunks)
  • contracts/axone-cognitarium/Cargo.toml (1 hunks)
  • contracts/axone-dataverse/Cargo.toml (1 hunks)
  • contracts/axone-law-stone/Cargo.toml (1 hunks)
  • contracts/axone-objectarium/Cargo.toml (1 hunks)
  • packages/axone-cognitarium-client/Cargo.toml (1 hunks)
  • packages/axone-logic-bindings/Cargo.toml (1 hunks)
  • packages/axone-objectarium-client/Cargo.toml (1 hunks)
  • packages/axone-rdf/Cargo.toml (1 hunks)
  • packages/axone-wasm/Cargo.toml (1 hunks)
  • packages/axone-wasm/README.md (1 hunks)
Files skipped from review due to trivial changes (7)
  • contracts/axone-cognitarium/Cargo.toml
  • contracts/axone-dataverse/Cargo.toml
  • contracts/axone-objectarium/Cargo.toml
  • packages/axone-logic-bindings/Cargo.toml
  • packages/axone-objectarium-client/Cargo.toml
  • packages/axone-rdf/Cargo.toml
  • packages/axone-wasm/README.md
Additional comments not posted (43)
packages/axone-cognitarium-client/Cargo.toml (5)

2-2: Ensure the authors.workspace field is correctly set.

The authors.workspace = true line indicates that the authors are inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the authors.

Verification successful

The authors.workspace field is correctly set.

The workspace configuration specifies the authors as ["AXONE"], which appears to be correct.

  • packages/axone-cognitarium-client/Cargo.toml: authors.workspace = true
  • Workspace Cargo.toml: authors = ["AXONE"]
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the authors.

# Test: Check the authors field in the workspace Cargo.toml. Expect: Correct authors specified.
rg --type toml $'authors = ' Cargo.toml

Length of output: 60


7-8: Ensure the homepage.workspace and license-file.workspace fields are correctly set.

The homepage.workspace = true and license-file.workspace = true lines indicate that these fields are inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the homepage and license file.

Verification successful

Ensure the homepage.workspace and license-file.workspace fields are correctly set.

The homepage and license-file fields are correctly specified in the Cargo.toml file:

  • homepage = "https://axone.xyz/"
  • license-file = "LICENSE"

These fields are inherited from the workspace configuration as indicated by homepage.workspace = true and license-file.workspace = true.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the homepage and license file.

# Test: Check the homepage and license-file fields in the workspace Cargo.toml. Expect: Correct homepage and license file specified.
rg --type toml $'homepage = ' Cargo.toml
rg --type toml $'license-file = ' Cargo.toml

Length of output: 144


10-11: Verify the readme and repository fields.

Ensure that the readme and repository fields are accurate and reflect the package's documentation and repository location correctly.

Verification successful

The readme and repository fields have been verified and are accurate.

  • The README.md file exists in the specified location.
  • The repository URL is valid and reachable.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the readme and repository fields are accurate.

# Test: Check the readme and repository fields in the Cargo.toml. Expect: Accurate readme and repository location.
rg --type toml $'readme = ' packages/axone-cognitarium-client/Cargo.toml
rg --type toml $'repository = ' packages/axone-cognitarium-client/Cargo.toml

Length of output: 275


Script:

#!/bin/bash
# Check if the README.md file exists in the specified location
if [ -f packages/axone-cognitarium-client/README.md ]; then
  echo "README.md exists"
else
  echo "README.md does not exist"
fi

# Validate the repository URL by checking its reachability
if curl --output /dev/null --silent --head --fail "https://github.com/axone-protocol/contracts/tree/main/packages/axone-cognitarium-client"; then
  echo "Repository URL is valid"
else
  echo "Repository URL is invalid"
fi

Length of output: 293


14-14: Ensure the axone-cognitarium.workspace field is correctly set.

The axone-cognitarium.workspace = true line indicates that the dependency is inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the dependency.

Verification successful

The axone-cognitarium.workspace field is correctly set.

  • The field axone-cognitarium.workspace = true is present in packages/axone-cognitarium-client/Cargo.toml and contracts/axone-dataverse/Cargo.toml.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the axone-cognitarium dependency.

# Test: Check the axone-cognitarium dependency in the workspace Cargo.toml. Expect: Correct axone-cognitarium dependency specified.
rg --type toml $'axone-cognitarium = ' Cargo.toml

Length of output: 123


Script:

#!/bin/bash
# Description: Verify that the axone-cognitarium.workspace field is correctly set in the workspace configuration.

# Test: Check if the axone-cognitarium.workspace = true is specified in the workspace Cargo.toml.
rg --type toml 'axone-cognitarium.workspace = true' Cargo.toml

Length of output: 64


Script:

#!/bin/bash
# Description: Verify that the axone-cognitarium.workspace field is correctly set in the workspace configuration.

# Test: Check all Cargo.toml files for any mention of axone-cognitarium to ensure comprehensive verification.
rg --type toml 'axone-cognitarium' --glob '**/Cargo.toml'

Length of output: 1047


3-4: Verify the categories and description fields.

Ensure that the categories and description fields are accurate and reflect the package's purpose correctly.

packages/axone-wasm/Cargo.toml (6)

2-2: Ensure the authors.workspace field is correctly set.

The authors.workspace = true line indicates that the authors are inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the authors.

Verification successful

The authors.workspace field is correctly set.

The workspace configuration specifies the authors as ["AXONE"], and the authors.workspace = true line in the package's Cargo.toml correctly inherits this value.

  • Cargo.toml (workspace): authors = ["AXONE"]
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the authors.

# Test: Check the authors field in the workspace Cargo.toml. Expect: Correct authors specified.
rg --type toml $'authors = ' Cargo.toml

Length of output: 60


11-12: Ensure the homepage.workspace and license-file.workspace fields are correctly set.

The homepage.workspace = true and license-file.workspace = true lines indicate that these fields are inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the homepage and license file.

Verification successful

Verification successful: The homepage.workspace and license-file.workspace fields are correctly set in the workspace configuration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the homepage and license file.

# Test: Check the homepage and license-file fields in the workspace Cargo.toml. Expect: Correct homepage and license file specified.
rg --type toml $'homepage = ' Cargo.toml
rg --type toml $'license-file = ' Cargo.toml

Length of output: 144


8-9: Verify the description field.

Ensure that the description field is accurate and reflects the package's purpose correctly.

Verification successful

The description field is accurate.

The description in the Cargo.toml file matches the one in the README file, confirming that it accurately reflects the package's purpose.

  • Cargo.toml description: "Package that holds useful components to manage with CosmWasm data, typically reading / writing."
  • README description: "Package that holds useful components to manage with CosmWasm data, typically reading / writing."
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the description field is accurate.

# Test: Check the description field in the Cargo.toml. Expect: Accurate description.
rg --type toml $'description = ' packages/axone-wasm/Cargo.toml

Length of output: 178


Script:

#!/bin/bash
# Find and display the contents of the README file or other relevant documentation files within the packages/axone-wasm directory.
fd -e md -e txt -e rst -e adoc -e org --search-path packages/axone-wasm/ | xargs cat

Length of output: 192


14-15: Verify the readme and repository fields.

Ensure that the readme and repository fields are accurate and reflect the package's documentation and repository location correctly.

Verification successful

The readme and repository fields are accurate.

  • The README.md file exists in the packages/axone-wasm directory.
  • The repository URL follows a valid GitHub URL structure.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the readme and repository fields are accurate.

# Test: Check the readme and repository fields in the Cargo.toml. Expect: Accurate readme and repository location.
rg --type toml $'readme = ' packages/axone-wasm/Cargo.toml
rg --type toml $'repository = ' packages/axone-wasm/Cargo.toml

Length of output: 233


Script:

#!/bin/bash
# Check if the README.md file exists in the packages/axone-wasm directory
if [ -f packages/axone-wasm/README.md ]; then
  echo "README.md exists"
else
  echo "README.md does not exist"
fi

Length of output: 85


3-7: Verify the categories field.

Ensure that the categories field is accurate and reflects the package's purpose correctly.

Verification successful

The categories field is accurate.

The categories listed in the Cargo.toml file reflect the package's purpose of managing CosmWasm data, typically involving cryptographic, parsing, and data structure functionalities.

  • Categories:
    • "cryptography::cryptocurrencies"
    • "parser-implementations"
    • "data-structures"
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the categories field is accurate.

# Test: Check the categories field in the Cargo.toml. Expect: Accurate categories.
rg --type toml $'categories = ' packages/axone-wasm/Cargo.toml

Length of output: 78


Script:

#!/bin/bash
# Description: Extract the package description and categories from the Cargo.toml file for verification.

# Extract the package description
rg --type toml 'description = ' packages/axone-wasm/Cargo.toml

# Extract the categories field
rg --type toml 'categories = ' -A 3 packages/axone-wasm/Cargo.toml

Length of output: 347


17-17: Ensure the cosmwasm-std.workspace field is correctly set.

The cosmwasm-std.workspace = true line indicates that the dependency is inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the dependency.

Verification successful

The cosmwasm-std.workspace field is correctly set.

  • The cosmwasm-std.workspace = true line is present in the Cargo.toml file of the axone-wasm package.
  • The workspace configuration is correctly specified in the workspace Cargo.toml file.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the cosmwasm-std dependency.

# Test: Check the cosmwasm-std dependency in the workspace Cargo.toml. Expect: Correct cosmwasm-std dependency specified.
rg --type toml $'cosmwasm-std = ' Cargo.toml

Length of output: 111


Script:

#!/bin/bash
# Description: Verify the presence of the `cosmwasm-std.workspace = true` line in the `Cargo.toml` file of the `axone-wasm` package and check the workspace configuration.

# Test 1: Check for the `cosmwasm-std.workspace = true` line in the `Cargo.toml` file of the `axone-wasm` package.
rg --type toml 'cosmwasm-std.workspace = true' packages/axone-wasm/Cargo.toml

# Test 2: Check the workspace configuration in the workspace `Cargo.toml` file.
rg --type toml '\[workspace\]' Cargo.toml

Length of output: 165

Cargo.toml (2)

5-8: Verify the authors, homepage, and license-file fields in the workspace configuration.

Ensure that the authors, homepage, and license-file fields are correctly specified in the workspace configuration.

Verification successful

The authors, homepage, and license-file fields are correctly specified in the workspace configuration.

  • authors = ["AXONE"]
  • homepage = "https://axone.xyz/"
  • license-file = "LICENSE"
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the authors, homepage, and license-file fields are correctly specified in the workspace configuration.

# Test: Check the authors, homepage, and license-file fields in the workspace Cargo.toml. Expect: Correct authors, homepage, and license file specified.
rg --type toml $'authors = ' Cargo.toml
rg --type toml $'homepage = ' Cargo.toml
rg --type toml $'license-file = ' Cargo.toml

Length of output: 205


24-32: Ensure the workspace dependencies are correctly set.

The dependencies listed under [workspace.dependencies] should have the correct paths and versions specified. Verify that these dependencies are correctly set.

Verification successful

Workspace dependencies are correctly set.

The paths, versions, and features for all dependencies in the Cargo.toml file are correctly specified.

  • axone-cognitarium
  • axone-cognitarium-client
  • axone-logic-bindings
  • axone-objectarium
  • axone-objectarium-client
  • axone-rdf
  • axone-wasm
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace dependencies are correctly set.

# Test: Check the workspace dependencies in the Cargo.toml. Expect: Correct paths and versions specified.
rg --type toml $'axone-cognitarium = ' Cargo.toml
rg --type toml $'axone-cognitarium-client = ' Cargo.toml
rg --type toml $'axone-logic-bindings = ' Cargo.toml
rg --type toml $'axone-objectarium = ' Cargo.toml
rg --type toml $'axone-objectarium-client = ' Cargo.toml
rg --type toml $'axone-rdf = ' Cargo.toml
rg --type toml $'axone-wasm = ' Cargo.toml

Length of output: 903


Script:

#!/bin/bash
# Description: Verify the full details of axone-cognitarium and axone-objectarium dependencies in the Cargo.toml file.

# Extract the dependency details for axone-cognitarium
rg --type toml 'axone-cognitarium =' Cargo.toml -A 3

# Extract the dependency details for axone-objectarium
rg --type toml 'axone-objectarium =' Cargo.toml -A 3

Length of output: 513

contracts/axone-law-stone/Cargo.toml (5)

2-2: Ensure the authors.workspace field is correctly set.

The authors.workspace = true line indicates that the authors are inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the authors.

Verification successful

The authors.workspace field is correctly set.

The workspace configuration specifies the authors as ["AXONE"], which will be inherited by the contracts/axone-law-stone package.

  • contracts/axone-law-stone/Cargo.toml:

    authors.workspace = true
  • Workspace Cargo.toml:

    authors = ["AXONE"]
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the authors.

# Test: Check the authors field in the workspace Cargo.toml. Expect: Correct authors specified.
rg --type toml $'authors = ' Cargo.toml

Length of output: 60


7-8: Ensure the homepage.workspace and license-file.workspace fields are correctly set.

The homepage.workspace = true and license-file.workspace = true lines indicate that these fields are inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the homepage and license file.

Verification successful

The homepage.workspace and license-file.workspace fields are correctly set.

The workspace configuration specifies:

  • homepage = "https://axone.xyz/"
  • license-file = "LICENSE"

No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the homepage and license file.

# Test: Check the homepage and license-file fields in the workspace Cargo.toml. Expect: Correct homepage and license file specified.
rg --type toml $'homepage = ' Cargo.toml
rg --type toml $'license-file = ' Cargo.toml

Length of output: 144


3-4: Verify the categories and description fields.

Ensure that the categories and description fields are accurate and reflect the package's purpose correctly.

Verification successful

The categories and description fields are accurate.

The categories field ["cryptography::cryptocurrencies"] and the description field "A CosmWasm Smart Contract which aims to provide GaaS (Governance as a Service) in any Cosmos blockchains." in the Cargo.toml file accurately reflect the purpose and functionality of the axone-law-stone smart contract as described in the README.md.

  • The description field aligns with the overview provided in the README.
  • The categories field is appropriate given the context of the smart contract operating within the Cosmos blockchain ecosystem.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the categories and description fields are accurate.

# Test: Check the categories and description fields in the Cargo.toml. Expect: Accurate categories and description.
rg --type toml $'categories = ' contracts/axone-law-stone/Cargo.toml
rg --type toml $'description = ' contracts/axone-law-stone/Cargo.toml

Length of output: 310


Script:

#!/bin/bash
# Search for README files to cross-reference the purpose and functionality of the package.
fd README

Length of output: 609


Script:

#!/bin/bash
# Read the content of the README.md file to cross-reference the purpose and functionality of the package.
cat contracts/axone-law-stone/README.md

Length of output: 1212


10-11: Verify the readme and repository fields.

Ensure that the readme and repository fields are accurate and reflect the package's documentation and repository location correctly.

Verification successful

The readme and repository fields are accurate.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the readme and repository fields are accurate.

# Test: Check the readme and repository fields in the Cargo.toml. Expect: Accurate readme and repository location.
rg --type toml $'readme = ' contracts/axone-law-stone/Cargo.toml
rg --type toml $'repository = ' contracts/axone-law-stone/Cargo.toml

Length of output: 251


Script:

#!/bin/bash
# Check if README.md exists in the contracts/axone-law-stone directory
if [ -f contracts/axone-law-stone/README.md ]; then
  echo "README.md exists."
else
  echo "README.md does not exist."
fi

# Verify the repository URL by checking if the URL is reachable
repository_url="https://github.com/axone-protocol/contracts/tree/main/contracts/axone-law-stone"
if curl --output /dev/null --silent --head --fail "$repository_url"; then
  echo "Repository URL is reachable."
else
  echo "Repository URL is not reachable."
fi

Length of output: 386


14-14: Ensure the axone-logic-bindings.workspace field is correctly set.

The axone-logic-bindings.workspace = true line indicates that the dependency is inherited from the workspace configuration. Verify that the workspace configuration correctly specifies the dependency.

Verification successful

Ensure the axone-logic-bindings.workspace field is correctly set.

The workspace configuration correctly specifies the axone-logic-bindings dependency. Now, verify that the axone-logic-bindings.workspace field is set to true in the contracts/axone-law-stone/Cargo.toml file.


The axone-logic-bindings.workspace field is correctly set.

  • The axone-logic-bindings.workspace field is set to true in the contracts/axone-law-stone/Cargo.toml file.
  • The workspace configuration correctly specifies the axone-logic-bindings dependency.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the workspace configuration correctly specifies the axone-logic-bindings dependency.

# Test: Check the axone-logic-bindings dependency in the workspace Cargo.toml. Expect: Correct axone-logic-bindings dependency specified.
rg --type toml $'axone-logic-bindings = ' Cargo.toml

Length of output: 138


Script:

#!/bin/bash
# Description: Verify that the axone-logic-bindings.workspace field is correctly set to true in the contracts/axone-law-stone/Cargo.toml file.

# Test: Check the axone-logic-bindings.workspace field in contracts/axone-law-stone/Cargo.toml. Expect: axone-logic-bindings.workspace = true.
rg --type toml 'axone-logic-bindings.workspace = true' contracts/axone-law-stone/Cargo.toml

Length of output: 131

.github/workflows/publish.yml (8)

9-11: Lint Job Configuration Looks Good

The lint job is correctly configured to run on the main branch and when the actor is bot-anik.


13-15: Build Job Configuration Looks Good

The build job is correctly configured to run on the main branch and when the actor is bot-anik.


17-19: Test Job Configuration Looks Good

The test job is correctly configured to run on the main branch and when the actor is bot-anik.


29-32: Repository Checkout Step Looks Good

The step for checking out the repository using actions/checkout@v4 is correctly configured.


34-40: Rust Setup Step Looks Good

The step for setting up Rust using actions-rs/toolchain@v1 with toolchain version 1.75 is correctly configured.


41-45: CMake Setup Step Looks Good

The step for setting up CMake using jwlawson/actions-setup-cmake@v2 with version 3.29.0 is correctly configured.


46-47: Cargo Smart-Release Installation Step Looks Good

The step for installing cargo-smart-release using cargo install is correctly configured.


49-62: Crates Publishing Step Looks Good

The step for publishing crates to crates.io using cargo smart-release with the appropriate options and environment variable CARGO_REGISTRY_TOKEN is correctly configured.

.releaserc.yml (7)

Line range hint 4-8: Commit Analyzer Plugin Configuration Looks Good

The @semantic-release/commit-analyzer plugin is correctly configured with the conventionalcommits preset and specific release rules.


Line range hint 9-10: Release Notes Generator Plugin Configuration Looks Good

The @semantic-release/release-notes-generator plugin is correctly configured with the conventionalcommits preset.


Line range hint 11-13: Changelog Plugin Configuration Looks Good

The @semantic-release/changelog plugin is correctly configured to update CHANGELOG.md with the title # AXONE contracts.


Line range hint 14-17: Replace Plugin Configuration Looks Good

The semantic-release-replace-plugin is correctly configured to update version numbers in Cargo.toml files.


Line range hint 18-22: Exec Plugin Configuration Looks Good

The @semantic-release/exec plugin is correctly configured to run several commands during the prepare step.


Line range hint 23-32: GitHub Plugin Configuration Looks Good

The @semantic-release/github plugin is correctly configured to upload assets and disable success comments.


Line range hint 33-37: Git Plugin Configuration Looks Good

The @semantic-release/git plugin is correctly configured to commit specific files with the message "chore(release): perform release ${nextRelease.version}".

Makefile.toml (10)

603-614: Workspace Dependency Versions Update Task Looks Good

The task update-workspace-dependency-versions is correctly configured to update the version of workspace dependencies using toml-cli.


615-615: LLVM Tools Preview Installation Task Looks Good

The task install-llvm-tools-preview is correctly configured to install the llvm-tools-preview component.


616-616: Clippy Installation Task Looks Good

The task install-clippy is correctly configured to install the clippy component.


617-617: Cranky Installation Task Looks Good

The task install-cranky is correctly configured to install the cranky crate with a minimum version of 0.3.0.


618-618: Rustfmt Installation Task Looks Good

The task install-rustfmt is correctly configured to install the rustfmt component.


Line range hint 619-619: Taplo CLI Installation Task Looks Good

The task install-taplo-cli is correctly configured to install the taplo-cli crate with a minimum version of 0.9.0.


Line range hint 620-620: Cargo Toml Lint Installation Task Looks Good

The task install-cargo-toml-lint is correctly configured to install the cargo-toml-lint crate with a minimum version of 0.1.1.


Line range hint 621-621: LLVM Cov Installation Task Looks Good

The task install-llvm-cov is correctly configured to install the cargo-llvm-cov crate with a minimum version of 0.6.9 and the --force argument.


Line range hint 622-622: CosmWasm Check Installation Task Looks Good

The task install-cosmwasm-check is correctly configured to install the cosmwasm-check crate with a minimum version of 1.5.3.


Line range hint 623-627: Ffizer Installation Task Looks Good

The task install-ffizer is correctly configured to ensure ffizer is installed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0eb2748 and e777c96.

Files selected for processing (1)
  • Makefile.toml (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • Makefile.toml

Copy link
Contributor

@bdeneux bdeneux left a comment

Choose a reason for hiding this comment

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

Great work, @ErikssonJoakim, thank you!

One concern I have is the manual specification of crates for publication, which requires us to be vigilant about including any new packages or contracts. This can be managed for the publishing task if the order of crates is not critical, as per my suggestion. However, for the update-workspaces-versions task, automating this process seems challenging, so we need to be careful 😓.

Let's see if this works seamlessly without a dry-run 🤞🙂.

Comment on lines 46 to 62
- name: Cargo install smart-release
run: cargo install cargo-smart-release

- name: Publish crates to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo smart-release --execute --update-crates-index --no-push --no-changelog --no-changelog-github-release \
axone-rdf \
axone-wasm \
axone-objectarium-client \
axone-logic-bindings \
axone-cognitarium-client \
axone-objectarium \
axone-cognitarium \
axone-law-stone \
axone-dataverse
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about putting this in a specific task inside Makefile.toml, and call this task here ?

Suggested change
- name: Cargo install smart-release
run: cargo install cargo-smart-release
- name: Publish crates to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo smart-release --execute --update-crates-index --no-push --no-changelog --no-changelog-github-release \
axone-rdf \
axone-wasm \
axone-objectarium-client \
axone-logic-bindings \
axone-cognitarium-client \
axone-objectarium \
axone-cognitarium \
axone-law-stone \
axone-dataverse
- name: Publish crates to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo make publish

Copy link
Collaborator Author

@ErikssonJoakim ErikssonJoakim Jul 12, 2024

Choose a reason for hiding this comment

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

Sure that's not a problem 🙂 I see it's the preferred way in the repository.

I've noticed however that publish is a keyword in cargo make, extending the cargo publish functionality, so the name of the task cannot be publish ^^

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Altough creating a task opens the possibility to run this command locally, so installing cargo-smart-release is required.

This requires the system to have cmake already installed and I cannot find a satisfying way to install cmake on task invocation (installation depends on user operating system).
Best solution so far is to keep the cmake install in the workflow and if the user wants to run locally he'd have to install cmake. I could add a link to cmake download documentation in the pre-requisites part of the README.

What do you guys think @ccamel @amimart @bdeneux ?

Comment on lines 53 to 62
cargo smart-release --execute --update-crates-index --no-push --no-changelog --no-changelog-github-release \
axone-rdf \
axone-wasm \
axone-objectarium-client \
axone-logic-bindings \
axone-cognitarium-client \
axone-objectarium \
axone-cognitarium \
axone-law-stone \
axone-dataverse
Copy link
Contributor

Choose a reason for hiding this comment

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

Another suggestion is to dynamically generate the list of crates to publish, avoiding forgetting future packages or smart contract creation. I don't know if the order is important, but if not, this should be good (I put in priority the packages list then contracts) 🙂.

Suggested change
cargo smart-release --execute --update-crates-index --no-push --no-changelog --no-changelog-github-release \
axone-rdf \
axone-wasm \
axone-objectarium-client \
axone-logic-bindings \
axone-cognitarium-client \
axone-objectarium \
axone-cognitarium \
axone-law-stone \
axone-dataverse
PACKAGES=$(find packages contracts -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | tr '\n' ' ')
echo $PACKAGES | xargs cargo smart-release --execute --update-crates-index --no-push --no-changelog --no-changelog-github-release

@ErikssonJoakim ErikssonJoakim marked this pull request as draft July 13, 2024 09:43
@ErikssonJoakim
Copy link
Collaborator Author

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?

Makefile.toml Outdated

[tasks.publish-crates]
dependencies = ["install-cargo-workspaces"]
script = "cargo workspaces publish --publish-as-is --allow-branch main"
Copy link
Contributor

Choose a reason for hiding this comment

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

Since all version as already been bumped through releaserc previous steps in a release process, I'm wondering if you need to pass --from-git argument avoiding execute cargo workspaces version before publish, accordingly to the documentation ? (https://github.com/pksunkara/cargo-workspaces#publish)

Publish all the crates from the workspace in the correct order according to the dependencies. By default, this command runs version first. If you do not want that to happen, you can supply the --from-git option.

Also, you don't need to add --allow-branch main because after some check, the help command say that the default branch is master but an issue has been resolved to allow both master and main branch by default (it's has not been added in the documentation) : pksunkara/cargo-workspaces#32 (https://github.com/pksunkara/cargo-workspaces/blob/master/cargo-workspaces/src/utils/git.rs#L139)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since all version as already been bumped through releaserc previous steps in a release process, I'm wondering if you need to pass --from-git argument avoiding execute cargo workspaces version before publish, accordingly to the documentation ? (https://github.com/pksunkara/cargo-workspaces#publish)

I saw this but the option --publish-as-is is supposed to do this as well.

Also, you don't need to add --allow-branch main because after some check, the help command say that the default branch is master but an issue has been resolved to allow both master and main branch by default (it's has not been added in the documentation) : pksunkara/cargo-workspaces#32 (https://github.com/pksunkara/cargo-workspaces/blob/master/cargo-workspaces/src/utils/git.rs#L139)

Ah cool I didn't see this

@ErikssonJoakim ErikssonJoakim marked this pull request as ready for review July 16, 2024 19:03
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e777c96 and 8e67725.

Files selected for processing (2)
  • .github/workflows/publish.yml (1 hunks)
  • Makefile.toml (2 hunks)
Additional comments not posted (3)
.github/workflows/publish.yml (2)

3-26: Ensure conditional execution logic is correct for all jobs.

All jobs are conditioned to run only when the github.actor is bot-anik and the branch is main. Confirm that this is the intended behavior, as it restricts the workflow to a specific user and branch.

Verification successful

Conditional execution logic is correctly implemented for all jobs.

The conditions restricting the workflow to run only when the github.actor is bot-anik and the branch is main are correctly set for all jobs in the workflow file.

  • .github/workflows/publish.yml
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditional logic in the workflow file.

# Test: Search for the conditional logic. Expect: Only occurrences with 'bot-anik' and 'main'.
rg --type yaml -A 5 $'if: github.ref == \'refs/heads/main\' && github.actor == \'bot-anik\''

Length of output: 101


Script:

#!/bin/bash
# Description: Verify the conditional logic in the workflow file.

# Check if the file exists
if [ -f ".github/workflows/publish.yml" ]; then
  # Search for the conditional logic in the publish.yml file.
  rg --type yaml -A 5 "if: github.ref == 'refs/heads/main' && github.actor == 'bot-anik'" .github/workflows/publish.yml
else
  echo "File .github/workflows/publish.yml does not exist."
fi

Length of output: 688


41-44: Review the environment variable and command for publishing crates.

The environment variable CARGO_REGISTRY_TOKEN is correctly set for publishing. However, the command cargo make publish-crates should be verified to ensure it aligns with the new changes in the Makefile.toml regarding smart-release and other publishing configurations.

Verification successful

The command for publishing crates is correctly configured.

The command cargo make publish-crates used in the GitHub Actions workflow aligns with the Makefile.toml configuration, which specifies cargo workspaces publish --publish-as-is for the publish-crates task.

  • The environment variable CARGO_REGISTRY_TOKEN is correctly set.
  • No additional configurations related to smart-release were found in the Makefile.toml.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the command used in the publishing step.

# Test: Search for the command in the Makefile. Expect: Details on 'publish-crates'.
rg --type toml -A 5 $'publish-crates' Makefile.toml

Length of output: 270


Script:

#!/bin/bash
# Description: Verify if there are any configurations related to smart-release in Makefile.toml

# Test: Search for 'smart-release' keyword in Makefile.toml
rg --type toml 'smart-release' Makefile.toml

# Test: Search for other relevant publishing configurations in Makefile.toml
rg --type toml 'publish' Makefile.toml

Length of output: 158

Makefile.toml (1)

623-625: Ensure the publishing task uses the correct command.

The task uses cargo workspaces publish --publish-as-is. Verify that this command correctly handles the publication process as intended, especially considering the dependencies and order of crate publishing.

Comment on lines +603 to +621
[tasks.update-workspace-dependency-versions]
dependencies = ["install-toml-cli"]
script = '''
next_version=$1

workspace_dependencies=( \
axone-cognitarium \
axone-rdf \
axone-wasm \
axone-cognitarium-client \
axone-logic-bindings \
axone-objectarium \
axone-objectarium-client \
)

for workspace_dependency in ${workspace_dependencies[@]}; do
toml set Cargo.toml workspace.dependencies.$workspace_dependency.version $next_version > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml
done
'''
Copy link

Choose a reason for hiding this comment

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

Review the script for updating workspace dependency versions.

The script updates the versions of specified workspace dependencies in Cargo.toml. Ensure that the command toml set correctly modifies the file and that the temporary file handling is secure and error-proof.

- toml set Cargo.toml workspace.dependencies.$workspace_dependency.version $next_version > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml
+ toml set Cargo.toml workspace.dependencies.$workspace_dependency.version $next_version > Cargo.toml.tmp
+ if [ $? -eq 0 ]; then
+   mv Cargo.toml.tmp Cargo.toml
+ else
+   echo "Error updating workspace dependency versions"
+   rm Cargo.toml.tmp
+   exit 1
+ fi
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[tasks.update-workspace-dependency-versions]
dependencies = ["install-toml-cli"]
script = '''
next_version=$1
workspace_dependencies=( \
axone-cognitarium \
axone-rdf \
axone-wasm \
axone-cognitarium-client \
axone-logic-bindings \
axone-objectarium \
axone-objectarium-client \
)
for workspace_dependency in ${workspace_dependencies[@]}; do
toml set Cargo.toml workspace.dependencies.$workspace_dependency.version $next_version > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml
done
'''
[tasks.update-workspace-dependency-versions]
dependencies = ["install-toml-cli"]
script = '''
next_version=$1
workspace_dependencies=( \
axone-cognitarium \
axone-rdf \
axone-wasm \
axone-cognitarium-client \
axone-logic-bindings \
axone-objectarium \
axone-objectarium-client \
)
for workspace_dependency in ${workspace_dependencies[@]}; do
toml set Cargo.toml workspace.dependencies.$workspace_dependency.version $next_version > Cargo.toml.tmp
if [ $? -eq 0 ]; then
mv Cargo.toml.tmp Cargo.toml
else
echo "Error updating workspace dependency versions"
rm Cargo.toml.tmp
exit 1
fi
done
'''

@ccamel ccamel marked this pull request as draft October 28, 2024 16:13
@ccamel ccamel added the help wanted Extra attention is needed label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request github_actions Pull requests that update GitHub Actions code help wanted Extra attention is needed
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

💚 Implement Crate Publication in CI Upon Release
5 participants