Skip to content

infra: Foundry CI workflow + foundry.toml (closes #32)#34

Merged
abhicris merged 2 commits into
mainfrom
infra/foundry-ci
Apr 23, 2026
Merged

infra: Foundry CI workflow + foundry.toml (closes #32)#34
abhicris merged 2 commits into
mainfrom
infra/foundry-ci

Conversation

@abhicris
Copy link
Copy Markdown
Contributor

Summary

Closes #32. Muzix ships three Forge suites (MUSD.t.sol, MuzixCatalog.t.sol, MuzixAIProvenance.t.sol from #29) but has no Foundry CI — they only get exercised when contributors run forge locally.

Changes

  • foundry.toml — standard profile: solc 0.8.24 (matches pragma in src/*), optimizer on (200 runs), remappings for @openzeppelin/ (installed from npm) and forge-std/ (submodule, bootstrapped by the workflow).
  • .github/workflows/forge.yml — trigger on push / PR to main or master. foundry-rs/foundry-toolchain@v1 stable, bootstraps lib/forge-std, npm install @openzeppelin/contracts@^5.0.0 to satisfy the OZ remapping, runs forge build --sizes + forge test -vvv + forge fmt --check (non-blocking for now — flip to blocking in a follow-up once a fmt sweep lands).
  • .gitignore — ignore node_modules/, out/, cache_forge/, lib/forge-std.

Verification

  • YAML validates locally.
  • Forge is not installable in the sandbox; first CI run on this PR is the verification. Expect forge build --sizes + forge test -vvv to exercise the three .t.sol files shipped so far.

Follow-ups

  • Once a forge fmt baseline lands, flip forge fmt --check to blocking.
  • Optional forge coverage job with artifact upload.

Test plan

  • First CI run on this PR exercises all three Forge suites
  • Remapping resolves OZ imports correctly
  • No phantom failures from missing forge-std

kcolbchain / Abhishek Krishna

Muzix ships three Forge suites (MUSD.t.sol, MuzixCatalog.t.sol,
MuzixAIProvenance.t.sol from #29) but has no Foundry CI — they only
get exercised when contributors run `forge test` locally. That's the
regression window this PR closes.

Changes:

- `foundry.toml` — standard profile: solc 0.8.24 (matches `pragma` in
  src/*), optimizer on with 200 runs, remappings for
  `@openzeppelin/` (installed from npm) and `forge-std/` (installed
  as a submodule by the workflow).

- `.github/workflows/forge.yml`:
  - Trigger: push / PR to main or master.
  - Setup: `foundry-rs/foundry-toolchain@v1` pinned to `stable`.
  - Bootstraps `lib/forge-std` on first run; uses `npm install
    @openzeppelin/contracts@^5.0.0` to satisfy the OZ remapping.
  - Runs `forge build --sizes`, `forge test -vvv`, then
    `forge fmt --check` (non-blocking for now — flip to blocking in a
    follow-up once a fmt sweep lands).

- `.gitignore` — ignore `node_modules/`, `out/`, `cache_forge/`,
  `lib/forge-std` so CI-bootstrapped deps don't trip up contributors.

Closes #32.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The CI workflow in this PR is now actually running `forge test` — that
exposed three pre-existing failures on master. This fixes all three so
the PR merges green.

1. MuzixCatalog.t.sol — `testMintAndMetadata` /
   `testRoyaltySplitSetsPoolRoyalty` both reverted with
   `ERC721InvalidReceiver`. `mintMusic()` calls `_safeMint(msg.sender, ...)`
   and `msg.sender` is the test contract itself (the deployer / owner).
   The test contract didn't implement `IERC721Receiver`. Added the
   `onERC721Received` hook returning its selector so the contract can
   hold tokens.

2. MuzixAIProvenance.t.sol::testRevertWhenTooManyModels — expected
   `TooManyModels(17, 16)`, actual `NotTokenOwner(..., artist_addr)`.
   Root cause: `registry.MAX_AI_MODEL_TOKENS()` inside the
   `abi.encodeWithSelector(...)` argument to `vm.expectRevert` is an
   external call to `registry` — it consumed the `vm.prank(artist)`
   before the real `setProvenance` call. Moved the external read out of
   the expectRevert expression to before the prank; the prank now
   actually applies to `setProvenance` and the test reaches the
   `TooManyModels` check.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@abhicris abhicris merged commit b8a8674 into main Apr 23, 2026
1 check passed
@abhicris abhicris deleted the infra/foundry-ci branch April 23, 2026 13:13
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.

infra: Foundry CI workflow for forge-test suite

1 participant