Merge pull request #77 from morpho-labs/feat/urd #172
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: | |
needs: build-no-ir | |
name: Tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
type: ["slow", "fast"] | |
include: | |
- type: "slow" | |
fuzz-runs: 100000 | |
max-test-rejects: 500000 | |
invariant-runs: 64 | |
invariant-depth: 1024 | |
- type: "fast" | |
fuzz-runs: 256 | |
max-test-rejects: 65536 | |
invariant-runs: 16 | |
invariant-depth: 256 | |
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 tests in ${{ matrix.type }} mode | |
run: yarn test:forge | |
env: | |
FOUNDRY_FUZZ_RUNS: ${{ matrix.fuzz-runs }} | |
FOUNDRY_FUZZ_MAX_TEST_REJECTS: ${{ matrix.max-test-rejects }} | |
FOUNDRY_INVARIANT_RUNS: ${{ matrix.invariant-runs }} | |
FOUNDRY_INVARIANT_DEPTH: ${{ matrix.invariant-depth }} | |
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }} |