Skip to content

Commit 7f8e939

Browse files
committed
ci: split unit and fork jobs, add gas/coverage reports
1 parent 94013de commit 7f8e939

File tree

3 files changed

+70
-48
lines changed

3 files changed

+70
-48
lines changed

.github/workflows/audit.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
workflow_dispatch:
11+
12+
env:
13+
FOUNDRY_PROFILE: ci
14+
15+
jobs:
16+
unit:
17+
name: Unit Tests & Reports
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
24+
- name: Install Foundry
25+
uses: foundry-rs/foundry-toolchain@v1
26+
with:
27+
cache: true
28+
29+
- name: Format Check
30+
run: forge fmt --check
31+
32+
- name: Build with Sizes
33+
run: forge build --sizes
34+
35+
- name: Run Unit Tests
36+
run: forge test -vvv
37+
38+
- name: Gas Snapshot
39+
run: forge snapshot --check --tolerance 500
40+
41+
- name: Coverage Report
42+
run: forge coverage --report lcov
43+
44+
fork:
45+
name: Fork Tests (Mainnet + Sepolia)
46+
runs-on: ubuntu-latest
47+
needs: unit # Only run if unit passes
48+
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
49+
steps:
50+
- uses: actions/checkout@v4
51+
with:
52+
submodules: recursive
53+
54+
- name: Install Foundry
55+
uses: foundry-rs/foundry-toolchain@v1
56+
with:
57+
cache: true
58+
59+
- name: Run Mainnet Fork Tests
60+
run: forge test --fork-url ${{ secrets.ALCHEMY_MAINNET }} -vvv
61+
62+
- name: Run Sepolia Fork Tests
63+
run: forge test --fork-url ${{ secrets.ALCHEMY_SEPOLIA }} -vvv

.github/workflows/test.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/AsyncVault.t.sol

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,16 @@ contract AsyncVaultTest is Test {
6161
(address usdcAddress,) = helperConfig.activeNetworkConfig();
6262
usdc = IERC20(usdcAddress);
6363

64-
// In local: mock was minted in HelperConfig broadcast
65-
// In fork: real USDC → need to fund users
66-
if (block.chainid != 31337) {
67-
// not anvil
68-
// Fund via deal on fork
64+
if (block.chainid == 31337) { // local anvil
65+
// Mock has mint function
66+
MockUSDC mock = MockUSDC(usdcAddress);
67+
mock.mint(alice, 10000 * 1e6);
68+
mock.mint(bob, 10000 * 1e6);
69+
} else {
70+
// Fork: real token
6971
deal(address(usdc), alice, 10000 * 1e6);
7072
deal(address(usdc), bob, 10000 * 1e6);
7173
}
72-
73-
74-
// Better: Always fund after deploy
75-
// Local: mock has mint()
76-
// Fork: use deal
7774
}
7875

7976
/* ================ HAPPY PATH ================ */

0 commit comments

Comments
 (0)