Skip to content

Commit

Permalink
refactor: foundry ci
Browse files Browse the repository at this point in the history
  • Loading branch information
0xClandestine committed Jan 30, 2025
1 parent bf699d8 commit c9cea56
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 78 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/forge-fmt.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/forge-test.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/forge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow runs the complete Forge suite of tools for code quality and testing.
name: Forge Suite

# Trigger workflow on manual dispatch, pull requests, or pushes to dev branch.
on:
workflow_dispatch:
pull_request:
push:
branches:
- "dev"

# Set environment variables for Foundry configuration and RPC endpoints.
env:
FOUNDRY_PROFILE: ci
RPC_MAINNET: ${{ secrets.RPC_MAINNET }}
RPC_HOLESKY: ${{ secrets.RPC_HOLESKY }}
CHAIN_ID: ${{ secrets.CHAIN_ID }}

jobs:
forge-suite:
name: CI

# Stop all jobs if one fails to prevent cascading failures.
strategy:
fail-fast: true

# Use latest Ubuntu runner.
runs-on: ubuntu-latest

steps:
# Check out repository with all submodules for complete codebase access.
- uses: actions/checkout@v4
with:
submodules: recursive

# Install the Foundry toolchain.
- name: "Install Foundry"
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable

# Run Forge's formatting checker to ensure consistent code style.
- name: "Forge Fmt"
run: |
forge fmt --check
id: fmt

# Install Bun package manager for JavaScript dependencies (faster than npm).
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

# Run Solhint linter to check for Solidity code quality issues.
- name: "Solhint"
run: bun run hint

# Build the project and display contract sizes, then add summary.
- name: "Forge Build"
run: |
forge --version
forge build --sizes
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
id: build

# Run local tests (unit and integration).
- name: "Forge Test (Local)"
run: forge test

# Run integration tests using a mainnet fork.
- name: "Forge Test Integration (Fork)"
run: forge test --match-contract Integration
env:
FOUNDRY_PROFILE: "forktest"

0 comments on commit c9cea56

Please sign in to comment.