Merge pull request #25 from frak-id/feature/transfer-all-assets #125
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 |