⬆️ Upgrade to solidity 0.8.23 #130
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: 🧪 Foundry tests | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
pull_request: | |
# Cancel previous runs on the same PR | |
concurrency: | |
group: ${{ github.ref }}-tests | |
cancel-in-progress: true | |
# All the env required for foundry | |
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: '🔨 Setup pnpm' | |
uses: pnpm/action-setup@v2 | |
- name: '🔨 Setup Node.js' | |
id: setup-node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'pnpm' | |
- name: '🔨 Install dependencies' | |
run: pnpm install --frozen-lockfile | |
- 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') }} # where fork block numbers & RPC are stored | |
- 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 storage tests' | |
run: pnpm run test:storage | |
- 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 |