forked from gretzke/foundry-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new functionality to template repo (#3)
* Dev (#2) * Remove default MIT license * Remove libraries Co-authored-by: Madeveda <[email protected]> * forge install: forge-gas-snapshot * add testing info * remove versioning * add gasmetering to tests (#1) * update solidity version * add issue templates * add coverage script * add formatting rules * add RPCs --------- Co-authored-by: Madeveda <[email protected]> * Ignore coverage report, increase coverage, adjust CI (#4) * Ignore coverage report, increase coverage, adjust CI * remove test helper * Dev (#5) * Ignore coverage report, increase coverage, adjust CI * remove test helper * Add testing as option * Add requirements for merging --------- Co-authored-by: Madeveda <[email protected]>
- Loading branch information
Showing
33 changed files
with
308 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
PRIVATE_KEY= | ||
INFURA_KEY= | ||
ETHERSCAN_API_KEY= | ||
POLYGONSCAN_API_KEY= | ||
POLYGONSCAN_ZKEVM_API_KEY= | ||
ETHERSCAN_API_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
26304 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
26394 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Bug report | ||
description: File a bug report to help us improve the code | ||
title: "[Bug]: " | ||
labels: ["bug"] | ||
|
||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Please check that the bug is not already being tracked. | ||
- type: textarea | ||
attributes: | ||
label: Describe the bug | ||
description: Provide a clear and concise description of what the bug is and which contracts it affects. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Expected Behavior | ||
description: Provide a clear and concise description of the desired fix. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: To Reproduce | ||
description: If you have written tests to showcase the bug, what can we run to reproduce the issue? | ||
placeholder: "git checkout <branchname> / forge test --isolate --mt <testName>" | ||
- type: textarea | ||
attributes: | ||
label: Additional context | ||
description: If there is any additional context needed like a dependency or integrating contract that is affected please describe it below. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Feature Improvement | ||
description: Suggest an improvement. | ||
labels: ["triage"] | ||
|
||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Please ensure that the feature has not already been requested. | ||
- type: dropdown | ||
attributes: | ||
label: Component | ||
description: Which area of code does your idea improve? | ||
multiple: true | ||
options: | ||
- Gas Optimization | ||
- General design optimization (improving efficiency, cleanliness, or developer experience) | ||
- Testing | ||
- Documentation | ||
- type: textarea | ||
attributes: | ||
label: Describe the suggested feature and problem it solves. | ||
description: Provide a clear and concise description of what feature you would like to see, and what problems it solves. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Describe the desired implementation. | ||
description: If possible, provide a suggested architecture change or implementation. | ||
- type: textarea | ||
attributes: | ||
label: Describe alternatives. | ||
description: If possible, describe the alternatives you've considered, or describe the current functionality and how it may be sub-optimal. | ||
- type: textarea | ||
attributes: | ||
label: Additional context. | ||
description: Please list any additional dependencies or integrating contacts that are affected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: code coverage | ||
|
||
on: | ||
pull_request: | ||
branches: [main, master, staging, dev] | ||
|
||
jobs: | ||
comment-forge-coverage: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
- name: Run Forge build | ||
run: | | ||
forge --version | ||
forge build --sizes | ||
id: build | ||
- name: Run forge coverage | ||
id: coverage | ||
run: | | ||
{ | ||
echo 'COVERAGE<<EOF' | ||
forge coverage | grep '^|' | grep -v 'test/' | ||
echo EOF | ||
} >> "$GITHUB_OUTPUT" | ||
echo $GITHUB_OUTPUT | ||
env: | ||
FOUNDRY_RPC_URL: "${{ secrets.RPC_URL }}" | ||
|
||
- name: Check coverage is updated | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require('fs'); | ||
const file = "coverage.txt" | ||
if(!fs.existsSync(file)) { | ||
console.log("Nothing to check"); | ||
return | ||
} | ||
const currentCoverage = fs.readFileSync(file, "utf8").trim(); | ||
const newCoverage = (`${{ steps.coverage.outputs.COVERAGE }}`).trim(); | ||
if (newCoverage != currentCoverage) { | ||
core.setFailed(`Code coverage not updated. Run : forge coverage --no-match-coverage "(test)" | grep '^|' > coverage.txt`); | ||
} | ||
- name: Comment on PR | ||
id: comment | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const {data: comments} = await github.rest.issues.listComments({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number, | ||
}) | ||
const botComment = comments.find(comment => comment.user.id === 41898282) | ||
const output = `${{ steps.coverage.outputs.COVERAGE }}`; | ||
const commentBody = `Forge code coverage:\n${output}\n`; | ||
if (botComment) { | ||
github.rest.issues.updateComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
comment_id: botComment.id, | ||
body: commentBody | ||
}) | ||
} else { | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: commentBody | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,9 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/openzeppelin/openzeppelin-contracts | ||
[submodule "lib/openzeppelin-contracts-upgradeable"] | ||
path = lib/openzeppelin-contracts-upgradeable | ||
url = https://github.com/openzeppelin/openzeppelin-contracts-upgradeable | ||
[submodule "lib/solady"] | ||
path = lib/solady | ||
url = https://github.com/vectorized/solady | ||
[submodule "lib/storage-delta"] | ||
path = lib/storage-delta | ||
url = https://github.com/0xPolygon/storage-delta | ||
[submodule "lib/deployer-kit"] | ||
path = lib/deployer-kit | ||
url = https://github.com/0xPolygon/deployer-kit | ||
[submodule "lib/forge-chronicles"] | ||
path = lib/forge-chronicles | ||
url = https://github.com/0xPolygon/forge-chronicles | ||
[submodule "lib/forge-gas-snapshot"] | ||
path = lib/forge-gas-snapshot | ||
url = https://github.com/marktoda/forge-gas-snapshot |
Oops, something went wrong.