Skip to content
Merged
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
176 changes: 176 additions & 0 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: "CI Deep"

env:
API_KEY_ETHERSCAN: ${{ secrets.API_KEY_ETHERSCAN }}
API_KEY_INFURA: ${{ secrets.API_KEY_INFURA }}
RPC_URL_MAINNET: ${{ secrets.RPC_URL_MAINNET }}

on:
schedule:
- cron: "0 3 * * 1" # at 3:00am UTC every Monday
workflow_dispatch:
inputs:
forkRuns:
default: "100000"
description: 'Number of fork test runs. Defaults to 1000'
required: false
fuzzRuns:
default: "100000"
description: 'Number of fuzz test runs. Defaults to 100,000'
required: false
invariantDepth:
default: "100"
description: 'Number of function calls made in a given run. Defaults to 100'
required: false
invariantRuns:
default: "100"
description: 'Number of sequences of function calls generated and run. Defaults to 100'
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: "optimized-out"
key: "foundry-build-${{ github.sha }}"

- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

test-fuzz:
env:
FOUNDRY_FUZZ_RUNS: ${{ inputs.fuzzRuns || "100000" }}
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: "optimized-out"

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

- name: "Add test summary"
run: |
echo "## Fuzz tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

test-invariant:
env:
FOUNDRY_INVARIANT_DEPTH: ${{ inputs.invariantDepth || "100" }}
FOUNDRY_INVARIANT_RUNS: ${{ inputs.invariantRuns || "100" }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the || "100" because we declared the inputs as required: false.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need the || syntax for the cron-triggered workflow runs. Workflow inputs are not available in cron:

https://stackoverflow.com/a/73495922/3873510

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: "optimized-out"

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

- name: "Add test summary"
run: |
echo "## Invariant tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

test-fork:
env:
FOUNDRY_FUZZ_RUNS: ${{ inputs.forkRuns || "1000" }}
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: "optimized-out"

- 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
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ jobs:
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

test-fuzz:
env:
FOUNDRY_FUZZ_RUNS: "50000"
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
Expand Down Expand Up @@ -184,8 +182,6 @@ jobs:
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

test-fork:
env:
FOUNDRY_FUZZ_RUNS: "800"
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-comptroller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
run: >-
forge script script/deploy/DeployComptroller.s.sol
--broadcast
--rpc-url "${{ github.event.inputs.chain }}"
--rpc-url "${{ inputs.chain }}"
--sig "run(address)"
-vvvv
"${{ github.event.inputs.admin }}"
"${{ inputs.admin }}"

- name: "Add summary"
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-lockup-dynamic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ jobs:
run: >-
forge script script/deploy/DeployLockupDynamic.s.sol
--broadcast
--rpc-url "${{ github.event.inputs.chain }}"
--rpc-url "${{ inputs.chain }}"
--sig "run(address,address,address,uint256)"
"${{ github.event.inputs.admin }}"
"${{ github.event.inputs.comptroller }}"
"${{ github.event.inputs.nft-descriptor }}"
"${{ github.event.inputs.max-segment-count }}"
"${{ inputs.admin }}"
"${{ inputs.comptroller }}"
"${{ inputs.nft-descriptor }}"
"${{ inputs.max-segment-count }}"
-vvvv

- name: "Add summary"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-lockup-linear.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
run: >-
forge script script/deploy/DeployLockupLinear.s.sol
--broadcast
--rpc-url ${{ github.event.inputs.chain }}
--rpc-url ${{ inputs.chain }}
--sig "run(address,address,address)"
"${{ github.event.inputs.admin }}"
"${{ github.event.inputs.comptroller }}"
"${{ github.event.inputs.nft-descriptor }}"
"${{ inputs.admin }}"
"${{ inputs.comptroller }}"
"${{ inputs.nft-descriptor }}"
-vvvv

- name: "Add summary"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-nft-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: >-
forge script script/deploy/DeployNFTDescriptor.s.sol
--broadcast
--rpc-url "${{ github.event.inputs.chain }}"
--rpc-url "${{ inputs.chain }}"
-vvvv

- name: "Add summary"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
run: >-
forge script script/deploy/DeployProtocol.s.sol
--broadcast
--rpc-url "${{ github.event.inputs.chain }}"
--rpc-url "${{ inputs.chain }}"
--sig "run(address,address,uint256)"
"${{ github.event.inputs.admin }}"
"${{ github.event.inputs.nft-descriptor }}"
"${{ github.event.inputs.max-segment-count }}"
"${{ inputs.admin }}"
"${{ inputs.nft-descriptor }}"
"${{ inputs.max-segment-count }}"
-vvvv

- name: "Add summary"
Expand Down