-
Notifications
You must be signed in to change notification settings - Fork 60
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
[Proposal] Automate pre-commit and pre-push checks #775
Conversation
Go solidity wrappers are out-of-date, regenerate them via the |
Go solidity wrappers are out-of-date, regenerate them via the |
Go solidity wrappers are out-of-date, regenerate them via the |
Go solidity wrappers are out-of-date, regenerate them via the |
1 similar comment
Go solidity wrappers are out-of-date, regenerate them via the |
7445ae2
to
6f330aa
Compare
if [ "$snapshot_answer" != "${snapshot_answer#[Yy]}" ] ;then | ||
# Create gas snapshot & commit gas snapshot | ||
make snapshot | ||
make wrappers |
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.
Note: there's a great solution that was recently implemented in core - generating wrappers on CI - which I would love to pull in from the next PR.
This could be adopted to also generate snapshots and (possibly) apply formatting changes.
However, there are still some actions that benefit from a pre-push check (build, test, solhint and changeset verification) - since these require manual intervention.
LCOV of commit
|
@@ -1,1061 +1,56 @@ | |||
lockfileVersion: '9.0' |
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.
Ahh this one uses pnpm 9 and the other <9.... we need to align on a single version for all lockfiles. Ideally whatever we have from chainlink
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.
Seems like it's 6.0 in chainlink
Motivation
Proposal to automate pre-commit and pre-push
contracts
development tasks by automatically running the required commands. The benefits of the setup are:--no-verify
), making the checks less intrusiveSolution
husky to implement git workflow hooks
lint-staged to automatically apply changes on files pre-commit
pre-commit hook: runs lint-staged which automatically applies & commits
forge fmt
changes to all Solidity filespre-push hook: build, test, solhint, optional wrapper / snapshot generation and changeset verification. If any of the commands fail, the pushing is stopped
git push --no-verify
again due to a git workflow limitation)How it works:
pnpm i
,pnpm prepare
is ran automatically, which setups huskygit commit
,husky
intercepts the pre-commit event, and runs.husky/pre-commit
, which then runslint-staged
on all detected filesgit push
,husky
intercepts the pre-push event, and runs.husky/pre-push
, which executes all commands in the scriptAdditional features:
.env
file configurations.env
fileTODOs