From f5d5ef2d11fe5e64c520a0f6501f90e5e47a8c65 Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Wed, 12 Jun 2024 09:15:18 +0200 Subject: [PATCH] Set up CI --- .github/workflows/ci.yml | 57 ++++++++++++++++++++++++++++++++++++++++ foundry.toml | 18 ++++++++++--- 2 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0b3b1aa --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: "CI" + +on: + pull_request: + push: + branches: + - main + +env: + FOUNDRY_PROFILE: ci + +jobs: + test-unit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Run tests + run: forge test --no-match-path "test/integration/**/*.sol" --fork-url https://mainnet.base.org + env: + FOUNDRY_PROFILE: ci + FORK_TESTS: false + + test-integration: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Run tests + run: forge test --match-path "test/integration/**/*.sol" + env: + FOUNDRY_PROFILE: ci + FORK_TESTS: false + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Build contracts + run: | + forge --version + forge build --sizes + + - name: Check formatting + run: forge fmt --check + env: + FOUNDRY_PROFILE: ci \ No newline at end of file diff --git a/foundry.toml b/foundry.toml index 25b918f..277890e 100644 --- a/foundry.toml +++ b/foundry.toml @@ -1,6 +1,16 @@ [profile.default] -src = "src" -out = "out" -libs = ["lib"] +src = 'src' +out = 'out' +libs = ['lib'] -# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options +solc_version = "0.8.21" +evm_version = "paris" # to prevent usage of PUSH0, which is not supported on all chains + +optimizer = true +optimizer_runs = 500 +verbosity = 3 + + +[profile.ci.fuzz] +runs = 1000 +max_test_rejects = 1_000_000 # Number of times `vm.assume` can fail