From 97870e56d0c9e6b207e3da68f3cf8413b4f61815 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Tue, 9 May 2023 14:11:27 +0300 Subject: [PATCH 1/2] ci: use "inputs" instead of "github.event.inputs" --- .github/workflows/deploy-comptroller.yml | 4 ++-- .github/workflows/deploy-lockup-dynamic.yml | 10 +++++----- .github/workflows/deploy-lockup-linear.yml | 8 ++++---- .github/workflows/deploy-nft-descriptor.yml | 2 +- .github/workflows/deploy-protocol.yml | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/deploy-comptroller.yml b/.github/workflows/deploy-comptroller.yml index 847daced6..13c9901c6 100644 --- a/.github/workflows/deploy-comptroller.yml +++ b/.github/workflows/deploy-comptroller.yml @@ -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: | diff --git a/.github/workflows/deploy-lockup-dynamic.yml b/.github/workflows/deploy-lockup-dynamic.yml index 9b88c5e70..b94d54639 100644 --- a/.github/workflows/deploy-lockup-dynamic.yml +++ b/.github/workflows/deploy-lockup-dynamic.yml @@ -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" diff --git a/.github/workflows/deploy-lockup-linear.yml b/.github/workflows/deploy-lockup-linear.yml index ba0ea3f52..ccd40509a 100644 --- a/.github/workflows/deploy-lockup-linear.yml +++ b/.github/workflows/deploy-lockup-linear.yml @@ -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" diff --git a/.github/workflows/deploy-nft-descriptor.yml b/.github/workflows/deploy-nft-descriptor.yml index 9e88e4b24..abec0d269 100644 --- a/.github/workflows/deploy-nft-descriptor.yml +++ b/.github/workflows/deploy-nft-descriptor.yml @@ -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" diff --git a/.github/workflows/deploy-protocol.yml b/.github/workflows/deploy-protocol.yml index f61b65580..ba6a12d1a 100644 --- a/.github/workflows/deploy-protocol.yml +++ b/.github/workflows/deploy-protocol.yml @@ -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" From 4a37f5b942f21bc344a9755124e9a4b5d5836b79 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Tue, 9 May 2023 14:39:30 +0300 Subject: [PATCH 2/2] ci: add separate workflow for deep fuzzing ci: tone down the main CI workflow Closes https://github.com/sablierhq/v2-core/issues/437 --- .github/workflows/ci-deep.yml | 176 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 4 - 2 files changed, 176 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci-deep.yml diff --git a/.github/workflows/ci-deep.yml b/.github/workflows/ci-deep.yml new file mode 100644 index 000000000..1d2f6223d --- /dev/null +++ b/.github/workflows/ci-deep.yml @@ -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" }} + 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d432abc19..5cb31e07c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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: