From c17d96fb10bb7cd37fc39d75ef5ad25fdfabd729 Mon Sep 17 00:00:00 2001 From: lempire123 Date: Wed, 6 Mar 2024 14:49:52 +0100 Subject: [PATCH 1/6] feat: add workflows for gas and coverage reports --- .github/workflows/foundry-reports.yml | 84 +++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/foundry-reports.yml diff --git a/.github/workflows/foundry-reports.yml b/.github/workflows/foundry-reports.yml new file mode 100644 index 00000000..aa955389 --- /dev/null +++ b/.github/workflows/foundry-reports.yml @@ -0,0 +1,84 @@ +name: Foundry Reports + +on: + workflow_dispatch: + +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 + 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 Gas Report + run: forge test --gas-report > 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: 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 + From d599722e9915497023f38215aaf2caaa51be69dd Mon Sep 17 00:00:00 2001 From: lempire123 Date: Fri, 8 Mar 2024 09:55:18 +0100 Subject: [PATCH 2/6] feat: cleanup generated reports --- .github/workflows/foundry-reports.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/foundry-reports.yml b/.github/workflows/foundry-reports.yml index aa955389..1ae03536 100644 --- a/.github/workflows/foundry-reports.yml +++ b/.github/workflows/foundry-reports.yml @@ -36,6 +36,9 @@ jobs: - 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: @@ -67,6 +70,9 @@ jobs: - 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: From 0e7887990e712885869b57a95a9bd505199d032a Mon Sep 17 00:00:00 2001 From: lempire123 Date: Fri, 8 Mar 2024 10:08:05 +0100 Subject: [PATCH 3/6] feat: change trigger to push --- .github/workflows/foundry-reports.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/foundry-reports.yml b/.github/workflows/foundry-reports.yml index 1ae03536..64b170a8 100644 --- a/.github/workflows/foundry-reports.yml +++ b/.github/workflows/foundry-reports.yml @@ -1,7 +1,6 @@ name: Foundry Reports -on: - workflow_dispatch: +on: [push] concurrency: group: ${{github.workflow}}-${{github.ref}} From 4e7fadc32abec2ce2c1eac5fc493be6d7e990b77 Mon Sep 17 00:00:00 2001 From: lempire123 Date: Fri, 8 Mar 2024 10:25:13 +0100 Subject: [PATCH 4/6] feat: change trigger to workflow_dispatch --- .github/workflows/foundry-reports.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/foundry-reports.yml b/.github/workflows/foundry-reports.yml index 64b170a8..2d9ae819 100644 --- a/.github/workflows/foundry-reports.yml +++ b/.github/workflows/foundry-reports.yml @@ -1,6 +1,6 @@ name: Foundry Reports -on: [push] +on: workflow_dispatch concurrency: group: ${{github.workflow}}-${{github.ref}} From 7ff8361cda503d6ca2b192c686b3f3e15c5dbc20 Mon Sep 17 00:00:00 2001 From: lempire123 Date: Fri, 8 Mar 2024 10:33:58 +0100 Subject: [PATCH 5/6] fix: cleanup code --- .github/workflows/foundry-reports.yml | 42 ++++++++++++++------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/foundry-reports.yml b/.github/workflows/foundry-reports.yml index 2d9ae819..67ccaeb1 100644 --- a/.github/workflows/foundry-reports.yml +++ b/.github/workflows/foundry-reports.yml @@ -1,6 +1,6 @@ name: Foundry Reports -on: workflow_dispatch +on: [push] concurrency: group: ${{github.workflow}}-${{github.ref}} @@ -12,23 +12,24 @@ env: jobs: generate-gas-report: - name: Generate Foundry Gas Reports + name: Gas 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' + uses: actions/checkout@v4 - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: version: nightly + - name: Install Node + uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + node-version: 18.x + cache: 'yarn' + - name: Install dependencies run: yarn --frozen-lockfile --network-concurrency 1 @@ -39,30 +40,31 @@ jobs: run: grep '^|' gas-report.txt > temp && mv temp gas-report.txt - name: Upload Gas Report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: gas-report path: gas-report.txt generate-coverage-report: - name: Generate Foundry Coverage Reports + name: 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' + uses: actions/checkout@v4 - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: version: nightly + - name: Install Node + uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + node-version: 18.x + cache: 'yarn' + - name: Install dependencies run: yarn --frozen-lockfile --network-concurrency 1 @@ -73,7 +75,7 @@ jobs: run: grep '^|' coverage-report.txt > temp && mv temp coverage-report.txt - name: Upload Test Coverage Table - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test-coverage-report path: coverage-report.txt @@ -82,7 +84,7 @@ jobs: run: forge coverage --report lcov - name: Upload LCOV Test Coverage Report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: lcov-coverage-report path: lcov.info From d09e0c41552527624635b3dbff908ea2cf466c51 Mon Sep 17 00:00:00 2001 From: lempire123 Date: Fri, 8 Mar 2024 10:37:07 +0100 Subject: [PATCH 6/6] feat: change trigger to workflow_dispatch --- .github/workflows/foundry-reports.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/foundry-reports.yml b/.github/workflows/foundry-reports.yml index 67ccaeb1..f86dce7d 100644 --- a/.github/workflows/foundry-reports.yml +++ b/.github/workflows/foundry-reports.yml @@ -1,6 +1,6 @@ name: Foundry Reports -on: [push] +on: workflow_dispatch concurrency: group: ${{github.workflow}}-${{github.ref}}