Merge pull request #176 from morpho-labs/refactor/errors #423
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Foundry | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
cancel-in-progress: true | |
jobs: | |
build-via-ir: | |
name: Compilation (via IR) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate a token | |
id: generate-token | |
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
submodules: recursive | |
- uses: ./.github/actions/install | |
- name: Build contracts via IR & check sizes | |
run: yarn build:forge --force # don't use compilation cache | |
build-no-ir: | |
name: Compilation (without IR) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate a token | |
id: generate-token | |
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
submodules: recursive | |
- uses: ./.github/actions/install-cache | |
- name: Build contracts without IR | |
run: yarn build:forge | |
env: | |
FOUNDRY_PROFILE: test | |
- name: Save forge compilation cache | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
cache | |
out | |
key: forge-${{ github.ref_name }} | |
test-local: | |
needs: build-no-ir | |
name: Local tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
type: ["slow", "fast"] | |
include: | |
- type: "slow" | |
fuzz-runs: 25000 | |
max-test-rejects: 10000 | |
- type: "fast" | |
fuzz-runs: 2048 | |
max-test-rejects: 65536 | |
steps: | |
- name: Generate a token | |
id: generate-token | |
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
submodules: recursive | |
- uses: ./.github/actions/install-cache | |
- name: Run local tests in ${{ matrix.type }} mode | |
run: yarn test:forge:local | |
env: | |
FOUNDRY_FUZZ_RUNS: ${{ matrix.fuzz-runs }} | |
FOUNDRY_FUZZ_MAX_TEST_REJECTS: ${{ matrix.max-test-rejects }} | |
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }} | |
test-mainnet: | |
needs: build-no-ir | |
name: Ethereum tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
type: ["slow", "fast"] | |
include: | |
- type: "slow" | |
fuzz-runs: 128 | |
max-test-rejects: 65536 | |
- type: "fast" | |
fuzz-runs: 16 | |
max-test-rejects: 65536 | |
steps: | |
- name: Generate a token | |
id: generate-token | |
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
submodules: recursive | |
- uses: ./.github/actions/install-cache | |
- name: Run mainnet tests in ${{ matrix.type }} mode | |
run: yarn test:forge:mainnet | |
env: | |
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }} | |
FOUNDRY_FUZZ_RUNS: ${{ matrix.fuzz-runs }} | |
FOUNDRY_FUZZ_MAX_TEST_REJECTS: ${{ matrix.max-test-rejects }} | |
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }} |