Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 21 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,50 @@ jobs:
with:
submodules: recursive

- name: Install just
uses: extractions/setup-just@v3

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Show Forge version
run: forge --version

- name: Install Bun
uses: oven-sh/setup-bun@v1

- name: Show Bun version
run: bun --version

- name: Install Test-Tooling
run: just tooling

- name: Run Forge fmt
run: forge fmt --check
run: just fmt-check
id: fmt

- name: Run Solhint
run: just lint
id: solhint

- name: Install Slither
run: pip install slither-analyzer

- name: Show Slither version
run: slither --version

- name: Run Slither
run: slither .
run: just static-analysis
id: slither

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: Show Bun version
run: bun --version

- name: Install Test-Tooling
run: bun install

- name: Run Solhint in `src` dir
run: bunx --bun solhint --config .solhint.json 'src/**/*.sol'
id: solhint-src

- name: Run Solhint in `test` dir
run: bunx --bun solhint --config .solhint.other.json 'test/**/*.sol'
id: solhint-test

- name: Run Solhint in `script` dir
run: bunx --bun solhint --config .solhint.other.json 'script/**/*.sol'
id: solhint-script

- name: Run Forge clean
run: forge clean
run: just clean
id: clean

- name: Run Forge build
run: forge build --sizes --ast
run: just build
id: build

- name: Run Forge tests
run: forge test -vvv --gas-report
run: just test
id: test
59 changes: 59 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Show commands before running (helps debug failures)
set shell := ["bash", "-euo", "pipefail", "-c"]

# Default recipe
default:
@just --list

# Install/update git submodule dependencies
deps:
git submodule update --init --recursive

# Install test tooling (solhint, etc.)
tooling:
bun install

# Clean build artifacts
clean:
forge clean

# Build contracts
build *args:
forge build --sizes --ast {{ args }}

# Format contracts
fmt *args:
forge fmt {{ args }}

# Check contract formatting
fmt-check:
forge fmt --check

# Lint contracts (solhint)
lint:
bunx --bun solhint --config .solhint.json 'src/**/*.sol'
bunx --bun solhint --config .solhint.other.json 'test/**/*.sol'
bunx --bun solhint --config .solhint.other.json 'script/**/*.sol'

# Static analysis with slither
static-analysis:
slither .

# Run contract tests
test *args:
forge test -vvv --gas-report {{ args }}

# Prerequisites check (mirrors CI)
check:
@echo "==> Checking formatting..."
@just fmt-check
@echo "==> Linting..."
@just lint
@echo "==> Static analysis with slither..."
@just static-analysis
@echo "==> Cleaning..."
@just clean
@echo "==> Building..."
@just build
@echo "==> Testing..."
@just test
Loading