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

ci: auto-discover all strategies and matrix forge tests across them #50

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 19 additions & 3 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,25 @@ on:
pull_request:

jobs:
# Discover all strategies in the project
strategy-list:
name: Strategy list
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- id: set-matrix
run: echo "matrix=$(ls ./crates/strategies | jq -R -s -c 'split("\n")[:-1]')" >> "$GITHUB_OUTPUT"

# Matrix across all discovered strategies
tests:
runs-on: ubuntu-latest
needs: [strategy-list]
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.strategy-list.outputs.matrix) }}
env:
ETH_MAINNET_HTTP: https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf
steps:
Expand All @@ -21,6 +38,5 @@ jobs:
- name: Foundry version
run: forge --version

# We need to run tests for every strategy independently
- name: Run Opensea Sudo Arb tests
run: forge test --root ./crates/strategies/opensea-sudo-arb/contracts
- name: Run ${{ matrix.target }} tests
run: forge test --root ./crates/strategies/${{ matrix.target }}/contracts
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ monitoring/grafana/data/

# Dotenv file
.env

.idea/