Skip to content

Commit

Permalink
Ignore coverage report, increase coverage, adjust CI (#4)
Browse files Browse the repository at this point in the history
* Ignore coverage report, increase coverage, adjust CI

* remove test helper
  • Loading branch information
gretzke authored Jul 2, 2024
1 parent d95322b commit d0576d8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
# with:
# token: ${{ secrets.GITHUB_TOKEN }}

- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -34,6 +34,7 @@ jobs:
forge coverage | grep '^|' | grep -v 'test/'
echo EOF
} >> "$GITHUB_OUTPUT"
echo $GITHUB_OUTPUT
env:
FOUNDRY_RPC_URL: "${{ secrets.RPC_URL }}"

Expand All @@ -51,7 +52,7 @@ jobs:
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 | grep '^|' | grep -v 'test/' > coverage.txt`);
core.setFailed(`Code coverage not updated. Run : forge coverage --no-match-coverage "(test)" | grep '^|' > coverage.txt`);
}
- name: Comment on PR
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/out
/cache
/coverage
/report
lcov.info
.DS_Store
.env
Expand All @@ -10,7 +11,3 @@ lcov.info

broadcast/*/31337
deployments/**/31337.*

# storage layout checker library
storage_check_cache
storage_check_report
4 changes: 2 additions & 2 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {Counter} from 'src/Counter.sol';
contract Deploy is Script {
using stdJson for string;

function run() public {
function run() public returns (Counter) {
uint256 initialNumber = 5;
new Counter(initialNumber);
return new Counter(initialNumber);
}
}
16 changes: 14 additions & 2 deletions test/Counter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ pragma solidity 0.8.26;

import {GasSnapshot} from 'forge-gas-snapshot/GasSnapshot.sol';
import 'forge-std/Test.sol';
import 'test/util/TestHelpers.sol';

import {Deploy} from 'script/Deploy.s.sol';
import {Counter} from 'src/Counter.sol';

abstract contract Deployed is Test, TestHelpers {
abstract contract Deployed is Test {
Counter counter;

function setUp() public virtual {
Expand Down Expand Up @@ -38,3 +38,15 @@ contract CounterTest_Deployed is Deployed, GasSnapshot {
snapLastCall('Set counter number');
}
}

contract DeploymentTest is Test {
Counter counter;

function setUp() public virtual {
counter = new Deploy().run();
}

function test_IsDeployedCorrectly() public view {
assertEq(counter.number(), 5);
}
}
13 changes: 0 additions & 13 deletions test/util/TestHelpers.sol

This file was deleted.

0 comments on commit d0576d8

Please sign in to comment.