-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve CI/CD with lint, build, test steps
- Loading branch information
1 parent
335e548
commit be0974b
Showing
3 changed files
with
91 additions
and
40 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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: CI | ||
|
||
env: | ||
FOUNDRY_PROFILE: "ci" | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
|
||
- name: Check formatting | ||
run: forge fmt --check | ||
|
||
- name: "Add lint summary" | ||
run: | | ||
echo "## Lint result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
|
||
- name: Install dependencies | ||
run: forge install | ||
|
||
- name: Compile contracts | ||
run: forge build | ||
|
||
- name: Check contract sizes | ||
run: | | ||
forge build --sizes && \ | ||
for file in out/*.sol/*.json; do | ||
if [[ "$file" == *".t.sol"* || "$file" == *".s.sol"* ]]; then | ||
continue | ||
fi | ||
size=$(cat "$file" | jq '.deployedBytecode.object' | wc -c | awk '{print int(($1-2)/2)}') | ||
if [ $size -gt 24576 ]; then | ||
echo "Contract in $file exceeds max size of 24576 bytes (Size: $size bytes)" | ||
exit 1 | ||
fi | ||
done | ||
- name: "Add build summary" | ||
run: | | ||
echo "## Build result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
tests: | ||
needs: ["lint", "build"] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
|
||
- name: Install dependencies | ||
run: forge install | ||
|
||
- name: Compile contracts | ||
run: forge build | ||
|
||
- name: Run tests | ||
run: forge test | ||
|
||
- name: Add test summary | ||
run: | | ||
echo "## Tests result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY |
This file was deleted.
Oops, something went wrong.
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,12 +1,16 @@ | ||
[profile.default] | ||
bytecode_hash = "none" | ||
optimizer_runs = 20 | ||
timeout = 30000 | ||
block_gas_limit = 300000000 | ||
gas_limit = 3000000000 | ||
gas_price = 1500000000 | ||
bytecode_hash = "none" | ||
optimizer_runs = 20 | ||
timeout = 30000 | ||
block_gas_limit = 300000000 | ||
gas_limit = 3000000000 | ||
gas_price = 1500000000 | ||
|
||
solc_version = "0.8.21" | ||
evm_version = 'paris' | ||
solc_version = "0.8.21" | ||
evm_version = 'paris' | ||
|
||
[profile.ci] | ||
fuzz = { runs = 10_000 } | ||
verbosity = 4 | ||
|
||
fs_permissions = [{ access = "read-write", path = "./"}] |