✏️ Fix typos #61
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: 🧪 Smart contract tests | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: ["main"] | |
# cancel previous runs on the same PR | |
concurrency: | |
group: ${{ github.ref }}-tests | |
cancel-in-progress: true | |
# All the env required | |
env: | |
FOUNDRY_PROFILE: "ci" | |
API_KEY_ALCHEMY_MAINNET: ${{ secrets.API_KEY_ALCHEMY_MAINNET }} | |
API_KEY_ALCHEMY_GOERLI: ${{ secrets.API_KEY_ALCHEMY_GOERLI }} | |
API_KEY_ALCHEMY_POLYGON: ${{ secrets.API_KEY_ALCHEMY_POLYGON }} | |
API_KEY_ALCHEMY_MUMBAI: ${{ secrets.API_KEY_ALCHEMY_MUMBAI }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: '🔨 Install Foundry' | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: '💾 Foundry fork cache' | |
uses: actions/cache@v3 | |
with: | |
path: "~/.foundry/cache" | |
key: foundry-${{ hashFiles('foundry.toml') }} | |
- name: '💾 Foundry compilation cache' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
cache | |
out | |
key: foundry-${{ github.repository_id }}-${{ hashFiles('foundry.toml') }} | |
- name: '🎨 Run lint tests' | |
run: forge fmt --check | |
- name: '📦️ Build contracts' | |
run: forge clean && forge build | |
- name: '🧪 Run forge tests' | |
run: forge test --gas-report > gasreport.ansi | |
- name: '📈 Compare gas reports' | |
uses: Rubilmax/[email protected] | |
with: | |
summaryQuantile: 0.9 # only display the 10% most significant gas diffs in the summary (defaults to 20%) | |
ignore: test/**/* | |
header: | | |
# Frak gas diffs | |
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 }} | |
- name: '📈 Run snapshot' | |
run: forge snapshot |