forked from compound-finance/comet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get a basic foundry test running (compound-finance#606)
* Get a basic foundry test running * Don't copy lib * Attempt forge test workflow * Document usage in the README
- Loading branch information
Showing
7 changed files
with
97 additions
and
0 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,33 @@ | ||
name: Run Forge Tests | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
jobs: | ||
forge-tests: | ||
name: Forge tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Foundry | ||
uses: onbjerg/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Install dependencies | ||
run: forge install | ||
|
||
- name: Run tests | ||
run: forge test -vvv | ||
env: | ||
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }} | ||
SNOWTRACE_KEY: ${{ secrets.SNOWTRACE_KEY }} | ||
INFURA_KEY: ${{ secrets.INFURA_KEY }} | ||
POLYGONSCAN_KEY: ${{ secrets.POLYGONSCAN_KEY }} | ||
|
||
- name: Build Comet with older solc versions | ||
run: | | ||
forge build --contracts contracts/Comet.sol --use solc:0.8.15 |
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
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,3 @@ | ||
[submodule "forge/lib/forge-std"] | ||
path = forge/lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std |
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
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,41 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Test.sol"; | ||
import "../../contracts/Comet.sol"; | ||
import "../../contracts/CometConfiguration.sol"; | ||
|
||
contract CometTest is Test { | ||
Comet public comet; | ||
|
||
function setUp() public { | ||
// XXX | ||
} | ||
|
||
function testFailXXX() public { | ||
CometConfiguration.AssetConfig[] memory assets = new CometConfiguration.AssetConfig[](0); | ||
CometConfiguration.Configuration memory config = | ||
CometConfiguration.Configuration(address(0), | ||
address(0), | ||
address(0), | ||
address(0), | ||
address(0), | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
0, | ||
assets); | ||
comet = new Comet(config); | ||
} | ||
} |
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,6 @@ | ||
[profile.default] | ||
src = 'contracts' | ||
out = 'forge/out' | ||
libs = ['node_modules', 'forge/lib'] | ||
test = 'forge/test' | ||
cache_path = 'forge/cache' |