Skip to content

Commit

Permalink
chore: add husky hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
HrikB committed Feb 18, 2024
1 parent 0a8a3f5 commit d6527a7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
18 changes: 1 addition & 17 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,7 @@ jobs:

- name: Check Solidity formatting with forge fmt
run: |
# Stash changes from the checkout step to ignore in the formatting check
git stash -u
# Remember the current HEAD commit
BEFORE_FMT=$(git rev-parse HEAD)
# Run forge fmt to format Solidity files
forge fmt
# Check if there are any changes by comparing the current HEAD to the tree after running forge fmt
if [ -n "$(git diff $BEFORE_FMT)" ]; then
echo "Solidity files are not formatted correctly. Please run 'forge fmt' locally and commit the changes."
git diff $BEFORE_FMT
exit 1
else
echo "All Solidity files are formatted correctly."
fi
forge fmt --check
# Optional: Revert changes made by forge fmt to leave the working directory clean
- name: Revert formatting changes
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
forge fmt --check
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
forge test --ffi
Binary file modified bun.lockb
Binary file not shown.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"simulate": "rm -f report.csv; REPORT=1 forge test --mt 'invariantFoundry_report'",
"YieldOracle:deployment:configure": "forge script script/01_DeployYieldOracle.s.sol -s 'configureDeployment()' --ffi",
"YieldOracle:deployment:deploy:testnet": "forge script script/01_DeployYieldOracle.s.sol --rpc-url $GOERLI_RPC_URL --broadcast --slow",
"YieldOracle:deployment:deploy:mainnet": "forge script script/01_DeployYieldOracle.s.sol --rpc-url $MAINNET_RPC_URL --broadcast --slow --verify"
"YieldOracle:deployment:deploy:mainnet": "forge script script/01_DeployYieldOracle.s.sol --rpc-url $MAINNET_RPC_URL --broadcast --slow --verify",
"prepare": "husky"
},
"dependencies": {
"date-fns": "^2.30.0",
Expand All @@ -23,7 +24,8 @@
"web3": "^4.1.2"
},
"devDependencies": {
"bun-types": "latest"
"bun-types": "latest",
"husky": "^9.0.11"
},
"peerDependencies": {
"typescript": "^5.0.0"
Expand Down

0 comments on commit d6527a7

Please sign in to comment.