Skip to content

Commit cef2a33

Browse files
Setup CI/CD (#165)
1 parent cc5bdc5 commit cef2a33

File tree

5 files changed

+49
-35
lines changed

5 files changed

+49
-35
lines changed

.github/workflows/push.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
FOUNDRY_PROFILE: prod
7+
OPTIMISM_GOERLI_RPC: ${{ secrets.OPTIMISM_GOERLI_RPC }}
8+
GOERLI_RPC: ${{ secrets.GOERLI_RPC }}
9+
POLYGON_MUMBAI_RPC: ${{ secrets.POLYGON_MUMBAI_RPC }}
10+
11+
jobs:
12+
tests:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Install Foundry
18+
uses: onbjerg/foundry-toolchain@v1
19+
with:
20+
version: nightly
21+
22+
- name: Install dependencies
23+
run: forge install
24+
25+
- name: Check contract sizes
26+
run: forge build --sizes
27+
28+
- name: Run tests
29+
run: forge test

foundry.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ test = 'test'
77
solc_version = '0.8.7'
88
optimizer = true
99
optimizer_runs = 99999
10-
via_ir = true
11-
1210
via_ir = false
11+
1312
verbosity = 3
1413

1514
# ignore solc warnings for missing license

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"test": "forge test"
6060
},
6161
"pre-commit": [
62-
"lint"
62+
"lint",
63+
"compile"
6364
],
6465
"dependencies": {
6566
"axios": "^1.3.6",

test/capacitors/CapacitorFactory.t.sol

+16-21
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ contract CapacitorFactoryTest is Setup {
1717
error NoPermit(bytes32 role);
1818

1919
function setUp() external {
20-
uint256 fork = vm.createFork(vm.envString("ETHEREUM_RPC"), 16333752);
21-
vm.selectFork(fork);
22-
2320
_cf = new CapacitorFactory(_owner);
2421
_token = new ERC20PresetFixedSupply("TEST", "T", tokenSupply, _owner);
2522
}
@@ -28,30 +25,28 @@ contract CapacitorFactoryTest is Setup {
2825
(ICapacitor singleCapacitor, IDecapacitor singleDecapacitor) = _cf
2926
.deploy(1, siblingChainSlug, DEFAULT_BATCH_LENGTH);
3027

31-
// TODO
32-
// assertEq(
33-
// address(singleCapacitor),
34-
// 0x582e4a5B8F0c154922e086061cC6Dd07F056EAC1
35-
// );
36-
// assertEq(
37-
// address(singleDecapacitor),
38-
// 0x0636b2c3241e32Be3dD768C063D278d9ba7bbcB1
39-
// );
28+
assertEq(
29+
address(singleCapacitor),
30+
0x104fBc016F4bb334D775a19E8A6510109AC63E00
31+
);
32+
assertEq(
33+
address(singleDecapacitor),
34+
0x037eDa3aDB1198021A9b2e88C22B464fD38db3f3
35+
);
4036
}
4137

4238
function testDeployHashChainCapacitor() external {
4339
(ICapacitor singleCapacitor, IDecapacitor singleDecapacitor) = _cf
4440
.deploy(2, siblingChainSlug, DEFAULT_BATCH_LENGTH);
4541

46-
// TODO
47-
// assertEq(
48-
// address(singleCapacitor),
49-
// 0x582e4a5B8F0c154922e086061cC6Dd07F056EAC1
50-
// );
51-
// assertEq(
52-
// address(singleDecapacitor),
53-
// 0x0636b2c3241e32Be3dD768C063D278d9ba7bbcB1
54-
// );
42+
assertEq(
43+
address(singleCapacitor),
44+
0x104fBc016F4bb334D775a19E8A6510109AC63E00
45+
);
46+
assertEq(
47+
address(singleDecapacitor),
48+
0x037eDa3aDB1198021A9b2e88C22B464fD38db3f3
49+
);
5550
}
5651

5752
function testDeploy(uint256 capacitorType) external {

test/oracle/GasPriceOracle.t.sol

+1-11
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ contract GasPriceOracleTest is Setup {
6666
sourceGasPrice,
6767
sig
6868
);
69-
70-
vm.stopPrank();
7169
assert(gasPriceOracle.sourceGasPrice() == sourceGasPrice);
7270
}
7371

@@ -130,7 +128,6 @@ contract GasPriceOracleTest is Setup {
130128
relativeGasPrice,
131129
sig
132130
);
133-
vm.stopPrank();
134131

135132
(
136133
uint256 sourceGasPriceActual,
@@ -161,8 +158,6 @@ contract GasPriceOracleTest is Setup {
161158
relativeGasPrice,
162159
sig
163160
);
164-
165-
vm.stopPrank();
166161
}
167162

168163
function testNonTransmitterUpdateSrcGasPrice() public {
@@ -179,16 +174,11 @@ contract GasPriceOracleTest is Setup {
179174
sourceGasPrice,
180175
sig
181176
);
182-
183-
vm.stopPrank();
184177
}
185178

186179
function testNonOwnerUpdateTransmitManager() public {
187-
vm.startPrank(transmitter);
188-
180+
hoax(transmitter);
189181
vm.expectRevert();
190182
gasPriceOracle.setTransmitManager(transmitManager);
191-
192-
vm.stopPrank();
193183
}
194184
}

0 commit comments

Comments
 (0)