Skip to content

Commit

Permalink
Merge pull request #118 from morpho-labs/ci/hardhat
Browse files Browse the repository at this point in the history
Hardhat CI
  • Loading branch information
QGarchery authored Jul 12, 2023
2 parents 70d50a5 + 8b9f57f commit c68c25f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/test.yml → .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: Foundry CI
name: Foundry

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test:
forge-test:
strategy:
fail-fast: true

Expand All @@ -22,7 +24,7 @@ jobs:
- name: Run Forge tests
run: forge test -vvv
env:
FOUNDRY_FUZZ_RUNS: 100000
FOUNDRY_FUZZ_MAX_TEST_REJECTS: 500000
FOUNDRY_INVARIANT_RUNS: 1000
FOUNDRY_FUZZ_RUNS: 100000
FOUNDRY_FUZZ_MAX_TEST_REJECTS: 500000
FOUNDRY_INVARIANT_RUNS: 1000
FOUNDRY_INVARIANT_DEPTH: 100
34 changes: 34 additions & 0 deletions .github/workflows/hardhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Hardhat

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
yarn-test:
strategy:
fail-fast: true

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Run Hardhat tests
run: yarn test
4 changes: 2 additions & 2 deletions test/hardhat/Blue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BigNumber, Wallet, constants, utils } from "ethers";
import hre from "hardhat";
import { Blue, OracleMock, ERC20Mock, IrmMock } from "types";

const iterations = 500;
const iterations = 400;
const closePositions = false;
const nbLiquidations = 50;
// The liquidations gas test expects that 2*nbLiquidations + 1 is strictly less than the number of signers.
Expand Down Expand Up @@ -99,7 +99,7 @@ describe("Blue", () => {

it("should simulate gas cost [main]", async () => {
for (let i = 1; i < iterations; ++i) {
console.log(i, "/", iterations);
if (i % 20 == 0) console.log("main:", (100 * i) / iterations, "% complete");

const user = new Wallet(hexZeroPad(BigNumber.from(i).toHexString(), 32), hre.ethers.provider);
await setBalance(user.address, initBalance);
Expand Down

0 comments on commit c68c25f

Please sign in to comment.