Skip to content

Commit

Permalink
ci: workflow for deep fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRBerg committed Jun 30, 2023
1 parent bbad34a commit 0bd143a
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 1 deletion.
103 changes: 103 additions & 0 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: "CI Deep"

env:
RPC_URL_GOERLI: ${{ secrets.RPC_URL_GOERLI }}

on:
schedule:
- cron: "0 3 * * 0" # at 3:00am UTC every Sunday
workflow_dispatch:
inputs:
forkFuzzRuns:
default: "250"
description: "Fork: number of fuzz runs."
required: false

jobs:
lint:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Lint the contracts"
run: "pnpm lint"

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
build:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Show the Foundry config"
run: "forge config"

- name: "Produce an optimized build with --via-ir"
run: "FOUNDRY_PROFILE=optimized forge build"

- name: "Cache the build so that it can be re-used by the other jobs"
uses: "actions/cache/save@v3"
with:
path: "out-optimized"
key: "foundry-build-${{ github.sha }}"

- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
test-fork:
env:
FOUNDRY_FUZZ_RUNS: ${{ inputs.forkFuzzRuns || '250' }}
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Restore the cached build"
uses: "actions/cache/restore@v3"
with:
fail-on-cache-miss: true
key: "foundry-build-${{ github.sha }}"
path: "out-optimized"

- name: "Run the fork tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test --match-path \"test/fork/**/*.sol\""

- name: "Add test summary"
run: |
echo "## Fork tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ jobs:
uses: "actions/checkout@v3"
with:
submodules: "recursive"
token: "${{ secrets.CI_TOKEN }}"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand Down

0 comments on commit 0bd143a

Please sign in to comment.