-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
188 changed files
with
13,799 additions
and
5,999 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,6 @@ jobs: | |
env: | ||
VERCEL_PROJECT_ID: ${{ steps.project_id.outputs.VERCEL_PROJECT_ID}} | ||
|
||
|
||
cancel-outdated: | ||
name: Cancel Outdated Jobs | ||
runs-on: ubuntu-latest | ||
|
@@ -130,6 +129,9 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
package: ${{ fromJson(needs.changes.outputs.packages) }} | ||
# Slither is irrelevant for solidity-devops, as it only contains devops scripts rather than deployed contracts | ||
exclude: | ||
- package: solidity-devops | ||
permissions: | ||
# always required | ||
security-events: write | ||
|
@@ -138,40 +140,34 @@ jobs: | |
contents: read | ||
steps: | ||
- name: Checkout repository | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
submodules: 'recursive' | ||
|
||
- name: Setup NodeJS | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: ./.github/actions/setup-nodejs | ||
|
||
- name: Install Foundry | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
# TODO: find a flag for this | ||
- name: Delete Untested Files | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
working-directory: './packages/${{matrix.package}}' | ||
run: | | ||
rm -rf test/ || true | ||
rm -rf script/ || true | ||
- name: Build Contracts | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
# TODO: unforunately, as of now concurrency needs to be 1 since if multiple instances of forge try to install the same version | ||
# of solc at the same time, we get "text file busy" errors. See https://github.com/synapsecns/sanguine/actions/runs/8457116792/job/23168392860?pr=2234 | ||
# for an example. | ||
run: | | ||
npx lerna exec npm run build:slither --concurrency=1 | ||
- name: Run Slither | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: crytic/[email protected] | ||
continue-on-error: true | ||
id: slither | ||
|
@@ -183,7 +179,7 @@ jobs: | |
solc-version: 0.8.17 | ||
|
||
- name: Upload SARIF file | ||
if: ${{!github.event.repository.private && matrix.package != 'solidity-devops'}} | ||
if: ${{!github.event.repository.private}} | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: ./results.sarif | ||
|
@@ -199,28 +195,32 @@ jobs: | |
package: ${{ fromJson(needs.changes.outputs.packages) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Node JS | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: ./.github/actions/setup-nodejs | ||
|
||
- name: Installing dependencies | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
run: yarn install --immutable | ||
|
||
- name: Install Foundry | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Run Foundry Tests | ||
working-directory: './packages/${{matrix.package}}' | ||
run: forge test -vvv | ||
|
||
# We skip only the coverage steps for solidity-devops before we establish a good coverage there | ||
- name: Run Foundry Coverage | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
working-directory: './packages/${{matrix.package}}' | ||
run: forge coverage -vvv --report lcov --report summary >> $GITHUB_STEP_SUMMARY | ||
run: forge coverage --report lcov --report summary >> $GITHUB_STEP_SUMMARY | ||
# Limit the number of fuzz runs to speed up the coverage | ||
env: | ||
FOUNDRY_FUZZ_RUNS: 10 | ||
|
||
- name: Send Coverage (Codecov) | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
|
@@ -236,39 +236,59 @@ jobs: | |
attempt_limit: 5 | ||
attempt_delay: 30000 | ||
|
||
|
||
snapshot: | ||
gas-diff: | ||
runs-on: ubuntu-latest | ||
name: Foundry Gas Snapshot | ||
name: Foundry Gas Diff | ||
if: ${{ needs.changes.outputs.package_count > 0 }} | ||
needs: changes | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
package: ${{ fromJson(needs.changes.outputs.packages) }} | ||
# Gas diff is irrelevant for solidity-devops, as it only contains devops scripts rather than deployed contracts | ||
exclude: | ||
- package: solidity-devops | ||
steps: | ||
- uses: actions/checkout@v4 | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Node JS | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: ./.github/actions/setup-nodejs | ||
|
||
- name: Installing dependencies | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
run: yarn install --immutable | ||
|
||
- name: Install Foundry | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
- name: Run snapshot | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
|
||
# TODO: consider defining a package-specific script for this | ||
- name: Run tests and generate gas report | ||
working-directory: './packages/${{matrix.package}}' | ||
run: forge snapshot >> $GITHUB_STEP_SUMMARY | ||
# Excluding tests with reverts to get accurate average gas cost estimates | ||
run: forge test --nmt "(fail|revert)" --gas-report > "../../gas-report-${{ matrix.package }}.ansi" | ||
env: | ||
# make fuzzing semi-deterministic to avoid noisy gas cost estimation | ||
# due to non-deterministic fuzzing (but still use pseudo-random fuzzing seeds) | ||
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }} | ||
|
||
- name: Compare gas reports | ||
uses: Rubilmax/[email protected] | ||
# TODO: define some options? | ||
with: | ||
report: 'gas-report-${{ matrix.package }}.ansi' | ||
id: gas_diff | ||
|
||
- name: Add gas diff to sticky comment | ||
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
# delete the comment in case changes no longer impact gas costs | ||
delete: ${{ !steps.gas_diff.outputs.markdown }} | ||
message: ${{ steps.gas_diff.outputs.markdown }} | ||
|
||
size-check: | ||
name: Foundry Size Check | ||
runs-on: ubuntu-latest | ||
|
@@ -278,25 +298,24 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
package: ${{ fromJson(needs.changes.outputs.packages) }} | ||
# Size check is irrelevant for solidity-devops, as it only contains devops scripts rather than deployed contracts | ||
exclude: | ||
- package: solidity-devops | ||
steps: | ||
- uses: actions/checkout@v4 | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Node JS | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: ./.github/actions/setup-nodejs | ||
|
||
- name: Install Foundry | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
# This will run https://book.getfoundry.sh/reference/forge/forge-build#build-options | ||
- name: Run forge build --sizes | ||
if: ${{ matrix.package != 'solidity-devops' }} | ||
run: | | ||
forge build --sizes | ||
working-directory: './packages/${{matrix.package}}' |
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"[solidity]": { | ||
"editor.defaultFormatter": "JuanBlanco.solidity" | ||
}, | ||
"solidity.formatter": "forge", | ||
"solidity.monoRepoSupport": false | ||
} |
Oops, something went wrong.