-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (57 loc) · 2.01 KB
/
foundry-report.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Foundry reports
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- main
jobs:
gas-report:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Cache Restore
id: cache
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # pin@v4
with:
path: cache
key: ${{ runner.os }}-bgd-foundry-${{ hashFiles('safe.csv') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-bgd-foundry-${{ hashFiles('safe.csv') }}-
${{ runner.os }}-bgd-foundry-
${{ runner.os }}-
- name: Create backup
if: steps.cache.outputs.cache-matched-key != ''
run: |
cd cache
ls -l
cd ..
cp cache/gas.json cache/gas.backup.json || :
cp cache/lcov.info cache/lcov.backup.info || :
# required
- name: Build
run: forge build
- name: Gas report
run: forge test --fuzz-runs 1 --gas-report --json > cache/gas.json
- name: Code coverage
run: forge coverage --fuzz-runs 1 --report lcov --no-match-coverage "(scripts|tests|deployments|mocks)"
# move file to cache folder
- name: Lcov transform
run: mv lcov.info cache/lcov.info
- uses: romeovs/[email protected]
with:
lcov-file: ./cache/lcov.info
lcov-base: ./cache/lcov.backup.info
- name: Cache Save
# if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # pin@v4
with:
path: cache
key: ${{ runner.os }}-bgd-foundry-${{ hashFiles('safe.csv') }}-${{ github.sha }}