-
Notifications
You must be signed in to change notification settings - Fork 14
199 lines (176 loc) · 8.1 KB
/
Copy pathmain.yml
File metadata and controls
199 lines (176 loc) · 8.1 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: ARM
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- main
schedule:
# Daily at 6:00 AM UTC
- cron: '0 6 * * *'
workflow_dispatch:
# Manual trigger from GitHub UI
# security/LOW: scope GITHUB_TOKEN to read-only and remove the
# workflow-wide env export. Steps that genuinely need the token can
# pass it explicitly via `env:` on that step. Smallest viable scope
# for a read-mostly CI workflow.
permissions:
contents: read
env:
# Increase available memory for node to reduce ganache crashes
# https://nodejs.org/api/cli.html#cli_max_old_space_size_size_in_megabytes
NODE_OPTIONS: --max_old_space_size=4096
jobs:
# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ LINTER ║
# ╚══════════════════════════════════════════════════════════════════════════════╝
lint:
name: Contracts Linter
runs-on: ubuntu-latest
# Skip on scheduled runs (only need to lint on actual code changes)
if: github.event_name != 'schedule'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup environment
uses: ./.github/actions/setup
- name: Run Linter
run: forge fmt --check
# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ BUILD ║
# ╚══════════════════════════════════════════════════════════════════════════════╝
build:
name: Contracts Build
runs-on: ubuntu-latest
# Skip on scheduled runs
if: github.event_name != 'schedule'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup environment
uses: ./.github/actions/setup
with:
install-pnpm: 'true'
ssh-key: ${{ secrets.TALOS_DEPLOY_KEY }}
- name: Compile all contracts
run: forge build
- name: Ensure contract sizes are within limits
# LidoARM/EtherFiARM/OriginARM are skipped: they sit at/over the EIP-170 runtime limit and are
# being superseded by MultiAssetARM, so they should not gate CI.
run: forge build --sizes --skip "test/**" --skip "script/**" --skip "*/forge-std/*" --skip "**/LidoARM.sol" --skip "**/EtherFiARM.sol" --skip "**/OriginARM.sol"
# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ CONCRETE TESTS ║
# ╚══════════════════════════════════════════════════════════════════════════════╝
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
# Skip on scheduled runs
if: github.event_name != 'schedule'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup environment
uses: ./.github/actions/setup
with:
install-pnpm: 'true'
ssh-key: ${{ secrets.TALOS_DEPLOY_KEY }}
- name: Run unit tests
run: forge test --summary --fail-fast --show-progress --mp 'test/unit/**'
fork-tests:
name: Fork Tests
runs-on: ubuntu-latest
env:
MAINNET_URL: ${{ secrets.MAINNET_URL }}
FLY_API_KEY: ${{ secrets.FLY_API_KEY }}
SONIC_URL: ${{ secrets.SONIC_URL }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup environment
uses: ./.github/actions/setup
with:
install-pnpm: 'true'
ssh-key: ${{ secrets.TALOS_DEPLOY_KEY }}
- name: Run fork tests
run: forge test --summary --fail-fast --show-progress --mp 'test/fork/**'
smoke-tests:
name: Smoke Tests
runs-on: ubuntu-latest
env:
MAINNET_URL: ${{ secrets.MAINNET_URL }}
FLY_API_KEY: ${{ secrets.FLY_API_KEY }}
SONIC_URL: ${{ secrets.SONIC_URL }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup environment
uses: ./.github/actions/setup
with:
install-pnpm: 'true'
ssh-key: ${{ secrets.TALOS_DEPLOY_KEY }}
- name: Run smoke tests
run: forge build && forge test --summary --fail-fast --show-progress --mp 'test/smoke/**'
# ╔══════════════════════════════════════════════════════════════════════════════╗
# ║ INVARIANT TESTS ║
# ╚══════════════════════════════════════════════════════════════════════════════╝
# Profile selection:
# - ci: schedule, workflow_dispatch, push to main
# - lite: pull_request, push to feature branches
invariant-tests-LidoARM:
name: Invariant Tests - LidoARM
runs-on: ubuntu-latest
env:
FOUNDRY_PROFILE: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'ci' || 'lite' }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup environment
uses: ./.github/actions/setup
- name: Run invariant tests (LidoARM) [${{ env.FOUNDRY_PROFILE }}]
run: |
FOUNDRY_INVARIANT_FAIL_ON_REVERT=true \
FOUNDRY_MATCH_CONTRACT=FuzzerFoundry_LidoARM \
forge test --summary --fail-fast --show-progress
invariant-tests-EthenaARM:
name: Invariant Tests - EthenaARM
runs-on: ubuntu-latest
env:
FOUNDRY_PROFILE: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) && 'ci' || 'lite' }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup environment
uses: ./.github/actions/setup
- name: Run invariant tests (EthenaARM) [${{ env.FOUNDRY_PROFILE }}]
run: |
FOUNDRY_INVARIANT_FAIL_ON_REVERT=true \
FOUNDRY_MATCH_CONTRACT=FuzzerFoundry_EthenaARM \
forge test --summary --fail-fast --show-progress
# Medusa fuzzing (only on full runs)
- name: Setup Go
if: env.FOUNDRY_PROFILE == 'ci'
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Set up Python
if: env.FOUNDRY_PROFILE == 'ci'
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Crytic Compile
if: env.FOUNDRY_PROFILE == 'ci'
run: pip install crytic-compile
- name: Install Medusa from Source
if: env.FOUNDRY_PROFILE == 'ci'
run: go install github.com/crytic/medusa@latest
- name: Run Medusa
if: env.FOUNDRY_PROFILE == 'ci'
working-directory: test/invariants/EthenaARM/
run: medusa fuzz --timeout 1800 --seq-len 500 --fail-fast