diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fc110a..b73d43e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0 with: - version: nightly + version: "v1.3.6" - name: Show Forge version run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4c7503a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,15 @@ +# Contributing + +## Formatting + +CI enforces `forge fmt` with a pinned Foundry version (**v1.3.6**) so formatting is +reproducible regardless of your local Foundry. Before committing: + +```sh +make fmt # format using the pinned version +make fmt-check # verify (identical to the CI check) +``` + +`make fmt` installs Foundry v1.3.6 side-by-side on first run — it does not have to be +your default. The initial install switches your active Foundry to v1.3.6; run +`foundryup -u stable` to switch back. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3aa704e --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +# Foundry version CI uses for `forge fmt`. Pinned so formatting output is +# reproducible regardless of your default Foundry install. +FMT_VER := 1.3.6 +FORGE_FMT := $(HOME)/.foundry/versions/v$(FMT_VER)/forge + +.PHONY: fmt fmt-check + +## Format all Solidity with the pinned Foundry version (installed side-by-side on first run). +fmt: + @[ -x "$(FORGE_FMT)" ] || foundryup -i $(FMT_VER) >/dev/null + @"$(FORGE_FMT)" fmt + +## Verify formatting - identical to the CI check. +fmt-check: + @[ -x "$(FORGE_FMT)" ] || foundryup -i $(FMT_VER) >/dev/null + @"$(FORGE_FMT)" fmt --check