-
Notifications
You must be signed in to change notification settings - Fork 22
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
Generate schema through workspace build script #303
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release/v2_contracts #303 +/- ##
========================================================
+ Coverage 88.50% 88.56% +0.06%
========================================================
Files 252 243 -9
Lines 23602 23586 -16
========================================================
+ Hits 20888 20889 +1
+ Misses 2714 2697 -17 ☔ View full report in Codecov by Sentry. |
Elected to exclude |
Testing GitHub actions to see if the workflow will trigger a comment for forgetting to include a schema.
Fixes the build_schemas fail_diff_flag for not checking new, uncommitted files.
Schema generation failed. Please run |
Schema generation had missing jobs: |
Schema generation had missing jobs:
Please run |
Schema generation had missing jobs:
Please run |
Schema generation had missing jobs:
Please run |
Good to review, finally :) |
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 great work never heard of xtask until now but looks like its even used by Cargo 🤯
It was a great find to run scripts for the workspace that need access to our Rust interfaces. I was also not aware of how widespread the pattern is in the Rust ecosystem, but it certainly looks like a nice complement to |
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.
Great job!!
Description and Motivation
We currently generate schemas by having a binary
schema.rs
on each contract which will use thecosmwasm_schema
API to write a schema.While this works, it requires us to maintain the binary for each contract. This is tedious (extra files per contract, including a
.cargo
alias definition), and also requires us to correctly use thecosmwasm_schema
per contract. Additionally, we were getting Cargo binary name collisions:This PR aims to standardize the process of creating a schema for a contract by moving the logic to a new
xtask
:generate_schemas
. This task will generate all the schema files for the entire workspace at once.This is similar work to the previous
just schemas
(which was broken), however we now get the benefit of being able to remove the binary from each contract. This could potentially speed up compile times.This PR also moves the schema PR workflow check to a new workflow file, and aims to add a comment to the PR if the schemas failed.
Checklist:
Update index.md
)cargo fmt --all --
.cargo clippy -- -D warnings
.just schemas
.