Bump Rubilmax/foundry-gas-diff from 3.18 to 3.20 #5
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: gas | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# Optionally configure to run only for changes in specific files. For example: | |
paths: | |
- src/** | |
- test/** | |
- foundry.toml | |
- remappings.txt | |
- .github/workflows/gas-report.yml | |
jobs: | |
check: | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: true | |
name: gas report | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Foundry | |
uses: onbjerg/foundry-toolchain@v1 | |
with: | |
version: nightly | |
# Add any step generating a gas report to a temporary file named gasreport.ansi. For example: | |
- name: Run tests | |
run: forge test --gas-report > gasreport.ansi # <- this file name should be unique in your repository! | |
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 }} | |
# https://github.com/Rubilmax/foundry-gas-diff | |
- name: Compare gas reports | |
uses: Rubilmax/foundry-gas-diff@v3.20 | |
with: | |
summaryQuantile: 0.8 # only display the 20% most significant gas diffs in the summary | |
sortCriteria: avg,max # sort diff rows by criteria | |
sortOrders: desc,asc # and directions | |
ignore: test-foundry/**/* # filter out gas reports from specific paths (test/ is included by default) | |
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: | |
# recreate the comment on push if changes impact gas costs | |
recreate: ${{ !!steps.gas_diff.outputs.markdown }} | |
# delete the comment in case changes no longer impact gas costs | |
delete: ${{ !steps.gas_diff.outputs.markdown }} | |
message: ${{ steps.gas_diff.outputs.markdown }} |