-
Notifications
You must be signed in to change notification settings - Fork 54
181 lines (160 loc) · 5.79 KB
/
solidity-foundry.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Solidity Foundry
on: [pull_request]
env:
FOUNDRY_PROFILE: ci
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.changes.outputs.src }}
steps:
- name: Checkout the repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: changes
with:
# Foundry is only used for Solidity v0.8 contracts, therefore we can ignore
# changes to older contracts.
filters: |
src:
- 'contracts/src/v0.8/**/*'
- 'contracts/test/v0.8/foundry/**/*'
- '.github/workflows/solidity-foundry.yml'
- 'contracts/foundry.toml'
- 'contracts/gas-snapshots/*.gas-snapshot'
- '.gitmodules'
- 'contracts/foundry-lib'
solhint:
needs: [changes]
name: Solhint
runs-on: ubuntu-latest
steps:
- name: Collect Metrics
if: ${{ needs.changes.outputs.changes == 'true' }}
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: Solhint
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
- name: Setup NodeJS
if: ${{ needs.changes.outputs.changes == 'true' }}
uses: ./.github/actions/setup-nodejs
- name: Run Solhint
if: ${{ needs.changes.outputs.changes == 'true' }}
working-directory: contracts
run: pnpm lint:ccip
coverage:
needs: [changes]
name: Coverage
runs-on: ubuntu-latest
env:
FOUNDRY_PROFILE: ccip
steps:
- name: Collect Metrics
if: ${{ needs.changes.outputs.changes == 'true' }}
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: Coverage
continue-on-error: true
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
with:
submodules: recursive
# Only needed because we use the NPM versions of packages
# and not native Foundry. This is to make sure the dependencies
# stay in sync.
- name: Setup NodeJS
uses: ./.github/actions/setup-nodejs
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Forge build
if: ${{ needs.changes.outputs.changes == 'true' }}
working-directory: contracts
run: |
forge --version
forge build
id: build
- name: Run coverage
if: ${{ needs.changes.outputs.changes == 'true' }}
working-directory: contracts
run: forge coverage --report lcov
- name: Prune report
if: ${{ needs.changes.outputs.changes == 'true' }}
run: |
sudo apt-get install lcov
./tools/ci/ccip_lcov_prune ./contracts/lcov.info ./lcov.info.pruned
- name: Report code coverage
if: ${{ needs.changes.outputs.changes == 'true' }}
uses: zgosalvez/github-actions-report-lcov@v1
with:
update-comment: true
coverage-files: lcov.info.pruned
minimum-coverage: 98
artifact-name: code-coverage-report
working-directory: ./contracts
github-token: ${{ secrets.GITHUB_TOKEN }}
tests:
strategy:
matrix:
product: [vrf, automation, llo-feeds, functions, shared, ccip]
needs: [changes]
if: needs.changes.outputs.changes == 'true'
name: Tests
# See https://github.com/foundry-rs/foundry/issues/3827
runs-on: ubuntu-22.04
steps:
- name: Checkout the repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
submodules: recursive
# Only needed because we use the NPM versions of packages
# and not native Foundry. This is to make sure the dependencies
# stay in sync.
- name: Setup NodeJS
uses: ./.github/actions/setup-nodejs
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
# Has to match the `make foundry` version.
version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d
- name: Run Forge build
run: |
forge --version
forge build
id: build
working-directory: contracts
env:
FOUNDRY_PROFILE: ${{ matrix.product }}
- name: Run Forge tests
run: |
forge test -vvv
id: test
working-directory: contracts
env:
FOUNDRY_PROFILE: ${{ matrix.product }}
- name: Run Forge snapshot
if: ${{ !contains(fromJson('["vrf"]'), matrix.product) && !contains(fromJson('["automation"]'), matrix.product) }}
run: |
forge snapshot --nmt "testFuzz_\w{1,}?" --check gas-snapshots/${{ matrix.product }}.gas-snapshot
id: snapshot
working-directory: contracts
env:
FOUNDRY_PROFILE: ${{ matrix.product }}
- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d2c2b7bdc9012651230b2608a1bcb0c48538b6ec
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: Foundry Tests ${{ matrix.product }}
continue-on-error: true