From c148de0c9f1fd4d1de6299032d9f8dbc18756283 Mon Sep 17 00:00:00 2001 From: Eric Shenghsiung Liu Date: Wed, 20 May 2026 10:06:18 -0400 Subject: [PATCH] Add CI workflow: build, test, fmt, coverage Runs on every push to main and every PR: - forge build --sizes (compilation + contract size report) - forge test -v (full test suite with fuzz) - forge fmt --check (formatting gate) - forge coverage --report lcov + Codecov upload (informational, not a gate) Codecov upload requires CODECOV_TOKEN secret to be set in repo settings. --- .github/workflows/ci.yml | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) 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..24fddb0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,67 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: foundry-rs/foundry-toolchain@v1 + + - name: Build + run: forge build --sizes + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: foundry-rs/foundry-toolchain@v1 + + - name: Run tests + run: forge test -v + + fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: foundry-rs/foundry-toolchain@v1 + + - name: Check formatting + run: forge fmt --check + + coverage: + name: Coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: foundry-rs/foundry-toolchain@v1 + + - name: Generate coverage report + run: forge coverage --report lcov + + - name: Upload to Codecov + uses: codecov/codecov-action@v4 + with: + files: lcov.info + fail_ci_if_error: false + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}