Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gas + coverage report workflows #63

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
89 changes: 89 additions & 0 deletions .github/workflows/foundry-reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Foundry Reports

on: [push]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

env:
MAINNET_RPC: ${{ secrets.MAINNET_RPC }}
SEPOLIA_RPC: ${{ secrets.SEPOLIA_RPC }}

jobs:
generate-gas-report:
name: Generate Foundry Gas Reports
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please shorten the names a bit to "Gas Reports" and "Test Coverage"

runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the same in the other action


- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1

- name: Generate Gas Report
run: forge test --gas-report > gas-report.txt

- name: Trim Gas Report
run: grep '^|' gas-report.txt > temp && mv temp gas-report.txt

- name: Upload Gas Report
uses: actions/upload-artifact@v3
with:
name: gas-report
path: gas-report.txt

generate-coverage-report:
name: Generate Foundry Coverage Reports
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1

- name: Generate Test Coverage Table
run: forge coverage > coverage-report.txt

- name: Trim Coverage Report
run: grep '^|' coverage-report.txt > temp && mv temp coverage-report.txt

- name: Upload Test Coverage Table
uses: actions/upload-artifact@v3
with:
name: test-coverage-report
path: coverage-report.txt

- name: Generate LCOV Test Coverage Report
run: forge coverage --report lcov

- name: Upload LCOV Test Coverage Report
uses: actions/upload-artifact@v3
with:
name: lcov-coverage-report
path: lcov.info

Loading