Skip to content

Add CI: build, test, fmt, coverage#30

Merged
eric-ships merged 8 commits into
mainfrom
eric/ci
May 27, 2026
Merged

Add CI: build, test, fmt, coverage#30
eric-ships merged 8 commits into
mainfrom
eric/ci

Conversation

@eric-ships
Copy link
Copy Markdown
Collaborator

@eric-ships eric-ships commented May 20, 2026

Motivation

No CI exists on the repo. With audit kickoff on May 25, every PR should be automatically gated on compilation, tests, and formatting so reviewers and auditors can trust the green checkmark.

What changed

.github/workflows/ci.yml with three jobs that run on every push to main and every PR:

  • Build (forge build): catches compilation errors; contract sizes printed as a separate informational step
  • Test (forge test -v): runs the full test suite
  • Format (forge fmt --check): prevents unformatted code from landing

All jobs use foundry-rs/foundry-toolchain@v1 pinned to stable (currently v1.7.1).

How it was tested

Screenshot 2026-05-27 at 11 00 26 AM

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.
forge build --sizes exits non-zero when any contract exceeds EIP-170.
MockTokenFactory is a test mock that intentionally exceeds the limit.
Separate compilation (forge build) from the informational size report
so test mocks do not block CI.
@linear
Copy link
Copy Markdown

linear Bot commented May 27, 2026

BOP-107

Nightly foundry has different fmt rules than stable. Pinning to
stable aligns CI format checks with local development. Also fixes
a 403 rate-limit issue where foundryup would fail fetching release
tags from the GitHub API.
The CI stable toolchain is v1.7.1 which removes trailing blank lines
before closing braces in empty contract bodies. Update local format
to match.
Not actively monitored and Codecov token is not set up.
Comment thread .github/workflows/ci.yml
- name: Run tests
run: forge test -v

fmt:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if CI runs in order of definition or parallelizes, but fmt should be before test if sequential given it will fail faster

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parallelizes

Comment thread test/lib/mocks/MockB20Storage.sol Outdated
function sharesToTokensRatioSlot() internal pure returns (bytes32) { return slotOf(SHARES_TO_TOKENS_RATIO_OFFSET); }
function usedAnnouncementIdsBaseSlot() internal pure returns (bytes32) { return slotOf(USED_ANNOUNCEMENT_IDS_OFFSET); }
function identifiersBaseSlot() internal pure returns (bytes32) { return slotOf(IDENTIFIERS_OFFSET); }
function sharesToTokensRatioSlot() internal pure returns (bytes32) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added ignore comments to keep these lean on other storage definitions. Mind adding those here and reverting the newlines? Same for the rest of the diff on this file

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done - added // forgefmt: disable-start and end

Use forgefmt: disable-next-item on each function to prevent forge fmt
from expanding the compact lookup-table form.
Switch from per-function disable-next-item to a single block, and
add the same to minimumRedeemableSlot / redeemPolicyIdsSlot.
@eric-ships eric-ships merged commit f81cc3a into main May 27, 2026
6 checks passed
@eric-ships eric-ships deleted the eric/ci branch May 27, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants