Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: parallelize foundry workflows #1094

Merged
merged 8 commits into from
Feb 13, 2025
Merged
Changes from 5 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
40 changes: 16 additions & 24 deletions .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ jobs:
# Forge Test
# -----------------------------------------------------------------------

test:
test-suite:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
suite: [Unit, Integration, Fork]

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"
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
Expand All @@ -41,32 +43,22 @@ jobs:
forge fmt --check
id: fmt

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

# Install NPM packages.
- name: "Install NPM Packages"
run: bun install

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

# Build the project and display contract sizes.
- name: "Forge Build"
- name: Forge build
run: |
forge --version
forge build --sizes
id: build

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

# Run integration tests using a mainnet fork.
- name: "Forge Test Integration (Fork)"
run: FOUNDRY_PROFILE=forktest forge test --match-contract Integration -vvv
# Run the test suite in parallel based on the matrix configuration.
- name: Run ${{ matrix.suite }} tests
run: |
case "${{ matrix.suite }}" in
Unit) forge test --no-match-contract Integration ;;
Integration) forge test --match-contract Integration ;;
Fork) forge test --match-contract Integration ;;
esac
env:
FOUNDRY_PROFILE: ${{ matrix.suite == 'Fork' && 'forktest' || 'ci' }}

# -----------------------------------------------------------------------
# Forge Test (Intense)
Expand Down
Loading