Skip to content
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

GitHub Actions workflow for running Forge tests #177

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Run Forge Tests
on: [pull_request]

jobs:
bootstrap:
name: Bootstrap environment
runs-on: ubuntu-latest
outputs:
cache-path: ${{ steps.cache.outputs.path }}
cache-key: ${{ steps.cache.outputs.key }}
env:
FORGE_REV: 03ea54c
steps:
- name: Build cache params
id: cache
run: |
echo "path=$CACHE_PATH" >> "$GITHUB_OUTPUT"
echo "$KEY_INPUT" | md5sum | awk '{print $1}' | xargs -I% echo "key=cargobin-%-${RUNNER_OS}" >> "$GITHUB_OUTPUT"
env:
CACHE_PATH: |
~/.cargo/bin/
KEY_INPUT: |
forge:${{env.FORGE_REV}}

- uses: actions/cache@v4
id: get-cache
with:
path: ${{ steps.cache.outputs.path }}
key: ${{ steps.cache.outputs.key }}

- name: Install forge & anvil
run: cargo install --git https://github.com/foundry-rs/foundry --rev "$FORGE_REV" --profile release --locked forge anvil
if: steps.get-cache.outputs.cache-hit != 'true'

foundry:
name: Foundry tests
runs-on: ubuntu-latest
needs: bootstrap
env:
FORGE_REV: 03ea54c
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/cache@v4
with:
path: ${{ needs.bootstrap.outputs.cache-path }}
key: ${{ needs.bootstrap.outputs.cache-key }}

- name: Install node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
cache-dependency-path: "**/yarn.lock"

- name: Build
run: forge build --sizes

- name: Run local integration tests
run: forge test
env:
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
4 changes: 4 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ test = 'test/kontrol'
line_length = 120
multiline_func_header = 'params_first_multi'

[fuzz]
runs = 2048
max_test_rejects = 500000

[etherscan]
mainnet = { key = "${ETHERSCAN_MAINNET_KEY}" }
holesky = { key = "${ETHERSCAN_MAINNET_KEY}", chain = "17000" }
2 changes: 1 addition & 1 deletion test/unit/committees/TiebreakerSubCommittee.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract TiebreakerSubCommitteeUnitTest is UnitTest {
tiebreakerSubCommittee = new TiebreakerSubCommittee(owner, committeeMembers, quorum, tiebreakerCore);
}

function test_constructor_HappyPath(address _owner, uint256 _quorum, address _tiebreakerCore) external {
function testFuzz_constructor_HappyPath(address _owner, uint256 _quorum, address _tiebreakerCore) external {
vm.assume(_owner != address(0));
vm.assume(_quorum > 0 && _quorum <= committeeMembers.length);
new TiebreakerSubCommittee(_owner, committeeMembers, _quorum, _tiebreakerCore);
Expand Down
Loading