-
Notifications
You must be signed in to change notification settings - Fork 349
394 lines (353 loc) · 14.3 KB
/
Copy pathspecs.yml
File metadata and controls
394 lines (353 loc) · 14.3 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
name: Specs
permissions: {}
on:
push:
branches: [main]
paths:
- "Cargo.lock"
- "Cargo.toml"
- "crates/**/Cargo.toml"
- "tips/verify/**"
- "crates/contracts/**"
- "crates/precompiles/**"
- "scripts/foundry-patch.sh"
- ".github/workflows/specs.yml"
- ".github/workflows/update-reth.yml"
merge_group:
pull_request:
env:
CARGO_TERM_COLOR: always
RUSTC_WRAPPER: "sccache"
jobs:
check-specs-changes:
name: Check specs changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
should_run: ${{ steps.filter.outputs.specs }}
foundry_smoke: ${{ steps.filter.outputs.foundry_smoke }}
release_only_sdk_crates: ${{ steps.release-only.outputs.release_only_sdk_crates }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: |
specs:
- 'tips/verify/**'
- 'crates/contracts/**'
- '!crates/contracts/CHANGELOG.md'
- '!crates/contracts/Cargo.toml'
- 'crates/precompiles/**'
- '!crates/precompiles/CHANGELOG.md'
- '!crates/precompiles/Cargo.toml'
- '.github/workflows/specs.yml'
foundry_smoke:
- 'Cargo.lock'
- 'Cargo.toml'
- 'crates/**/Cargo.toml'
- 'scripts/foundry-patch.sh'
- '.github/workflows/specs.yml'
- '.github/workflows/update-reth.yml'
- name: Check release-only SDK crate changes
id: release-only
env:
EVENT_NAME: ${{ github.event_name }}
BASE_REF: ${{ github.base_ref || github.event.merge_group.base_ref || 'main' }}
run: |
if [[ "$EVENT_NAME" == "push" ]]; then
echo "release_only_sdk_crates=false" >> "$GITHUB_OUTPUT"
echo "Not skipping Foundry precompile tests on push events."
exit 0
fi
base_ref="${BASE_REF#refs/heads/}"
changed_files="$(git diff --name-only "origin/${base_ref}...HEAD")"
if [[ -z "$changed_files" ]]; then
echo "release_only_sdk_crates=false" >> "$GITHUB_OUTPUT"
echo "No changed files detected against origin/${base_ref}."
exit 0
fi
# Release PRs may also add/delete consumed changelog fragments.
allowed='^(Cargo\.lock|\.changelog/[^/]+\.md|crates/(alloy|chainspec|contracts|primitives|hardfork)/(Cargo\.toml|CHANGELOG\.md))$'
if printf '%s\n' "$changed_files" | grep -Ev "$allowed" >/dev/null; then
echo "release_only_sdk_crates=false" >> "$GITHUB_OUTPUT"
echo "Found non-release-only SDK crate changes."
else
echo "release_only_sdk_crates=true" >> "$GITHUB_OUTPUT"
echo "Skipping Foundry precompile tests: only SDK crate release metadata changed."
fi
foundry-resolver-smoke:
name: Foundry Resolver Smoke
needs: check-specs-changes
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Skip Foundry resolver smoke
if: needs.check-specs-changes.outputs.foundry_smoke != 'true'
run: |
echo "Skipping Foundry resolver smoke: no dependency-sensitive files changed."
- name: Checkout tempo
if: needs.check-specs-changes.outputs.foundry_smoke == 'true'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: tempo
persist-credentials: false
- name: Checkout foundry
if: needs.check-specs-changes.outputs.foundry_smoke == 'true'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: foundry-rs/foundry
ref: master
path: foundry
persist-credentials: false
- name: Setup Rust
if: needs.check-specs-changes.outputs.foundry_smoke == 'true'
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
- name: Patch foundry to use checked-out tempo crates
if: needs.check-specs-changes.outputs.foundry_smoke == 'true'
env:
RUSTC_WRAPPER: ""
run: tempo/scripts/foundry-patch.sh "$GITHUB_WORKSPACE/tempo" "$GITHUB_WORKSPACE/foundry"
check-precompiles:
name: Check precompiles changes
needs: check-specs-changes
if: needs.check-specs-changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
coverage: ${{ steps.check.outputs.coverage }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Check for precompiles changes
id: check
env:
EVENT_NAME: ${{ github.event_name }}
BASE_REF: ${{ github.base_ref }}
run: |
# Only run coverage on pull_request events when precompiles/contracts changed
if [[ "$EVENT_NAME" != "pull_request" ]]; then
echo "coverage=false" >> "$GITHUB_OUTPUT"
echo "Skipping coverage: not a pull_request event (event: $EVENT_NAME)"
elif git diff --name-only origin/"$BASE_REF"...HEAD \
| grep -qE '^(crates/(precompiles|contracts)/|tips/verify/)' \
&& ! git diff --name-only origin/"$BASE_REF"...HEAD \
| grep -vE '^(crates/(precompiles|contracts)/(Cargo\.toml|CHANGELOG\.md))$' \
| grep -qE '^(crates/(precompiles|contracts)/|tips/verify/)'; then
echo "coverage=false" >> "$GITHUB_OUTPUT"
echo "Skipping coverage: only precompiles/contracts release metadata changed"
elif git diff --name-only origin/"$BASE_REF"...HEAD | grep -qE '^(crates/(precompiles|contracts)/|tips/verify/)'; then
echo "coverage=true" >> "$GITHUB_OUTPUT"
echo "Running coverage: precompiles/contracts changed"
else
echo "coverage=false" >> "$GITHUB_OUTPUT"
echo "Skipping coverage: no precompiles/contracts changes"
fi
build:
name: Forge Build
needs: check-specs-changes
if: needs.check-specs-changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
persist-credentials: false
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1.9.1
with:
version: nightly
- name: Run Forge build
working-directory: tips/verify
run: forge build --sizes
abi-alignment-check:
name: ABI Alignment Check
needs: check-specs-changes
if: needs.check-specs-changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
persist-credentials: false
- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
- uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1.9.1
with:
version: nightly
- name: Build tempo-std interfaces
working-directory: tips/verify/lib/tempo-std
run: forge build --sizes
- name: Run ABI alignment check
run: cargo run -p tempo-xtask -- check-abi
lint:
name: Forge Fmt
needs: check-specs-changes
if: needs.check-specs-changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
persist-credentials: false
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1.9.1
with:
version: nightly
- name: Run Forge fmt check
working-directory: tips/verify
run: forge fmt --check
foundry-build:
name: Build patched Forge
needs: [check-specs-changes, check-precompiles]
if: github.repository == 'tempoxyz/tempo' && needs.check-specs-changes.outputs.should_run == 'true' && needs.check-specs-changes.outputs.release_only_sdk_crates != 'true'
runs-on: depot-ubuntu-latest-8
timeout-minutes: 60
permissions:
contents: read
steps:
- name: Checkout tempo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
path: tempo
persist-credentials: false
- name: Checkout foundry
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: foundry-rs/foundry
ref: master
path: foundry
persist-credentials: false
- name: Setup Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
- uses: rui314/setup-mold@7e4f20ad28a2e8ca6fd0892ccf72e2abb706b9c3 # v1
- uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
workspaces: foundry
- name: Install llvm-tools
if: needs.check-precompiles.outputs.coverage == 'true'
run: rustup component add llvm-tools-preview
- name: Patch foundry to use checked-out tempo crates
run: tempo/scripts/foundry-patch.sh "$GITHUB_WORKSPACE/tempo" "$GITHUB_WORKSPACE/foundry"
# Build and run WITH coverage (only on PR when precompiles changed)
- name: Build foundry forge with coverage instrumentation
if: needs.check-precompiles.outputs.coverage == 'true'
working-directory: foundry
run: RUSTFLAGS="-C instrument-coverage" cargo build --bin forge --profile release --no-default-features
# Build WITHOUT coverage on main/merge-group runs.
- name: Build foundry forge
if: needs.check-precompiles.outputs.coverage != 'true'
working-directory: foundry
run: cargo build --bin forge --profile release --no-default-features
- name: Upload patched Forge
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: patched-forge
path: foundry/target/release/forge
retention-days: 1
foundry-test:
name: Forge Test (Rust Precompiles, ${{ matrix.profile }})
needs: [check-specs-changes, check-precompiles, foundry-build]
if: needs.foundry-build.result == 'success'
strategy:
fail-fast: false
matrix:
profile: [default, next]
runs-on: depot-ubuntu-latest-8
timeout-minutes: 60
permissions:
contents: read
steps:
- name: Checkout tempo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
path: tempo
persist-credentials: false
- name: Setup Rust
if: needs.check-precompiles.outputs.coverage == 'true' && matrix.profile == 'default'
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
components: llvm-tools-preview
- name: Download patched Forge
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: patched-forge
path: foundry/target/release
- name: Run Forge tests with Rust precompiles
working-directory: tempo/tips/verify
env:
FOUNDRY_PROFILE: ${{ matrix.profile }}
LLVM_PROFILE_FILE: ${{ needs.check-precompiles.outputs.coverage == 'true' && format('{0}/forge-coverage-%p.profraw', github.workspace) || '' }}
run: |
chmod +x ../../../foundry/target/release/forge
echo "Running Forge tests with the ${{ matrix.profile }} profile"
../../../foundry/target/release/forge test -vvv
- name: Generate coverage profdata
if: needs.check-precompiles.outputs.coverage == 'true' && matrix.profile == 'default'
run: |
LLVM_BIN="$(rustc --print sysroot)/lib/rustlib/$(rustc -vV | grep host | cut -d' ' -f2)/bin"
mkdir -p coverage
"$LLVM_BIN/llvm-profdata" merge -sparse forge-coverage-*.profraw -o coverage/forge-test.profdata
- name: Upload forge coverage artifacts
if: needs.check-precompiles.outputs.coverage == 'true' && matrix.profile == 'default'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: forge-test-coverage
path: |
coverage/forge-test.profdata
foundry/target/release/forge
retention-days: 1
specs-success:
name: specs success
runs-on: ubuntu-latest
if: always()
permissions: {}
needs:
- check-specs-changes
- foundry-resolver-smoke
- check-precompiles
- build
- abi-alignment-check
- lint
- foundry-build
- foundry-test
timeout-minutes: 5
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
allowed-skips: check-precompiles,build,abi-alignment-check,lint,foundry-build,foundry-test
jobs: ${{ toJSON(needs) }}
precompiles-coverage:
name: Precompiles Coverage
needs: [check-precompiles, specs-success]
if: success() && needs.check-precompiles.outputs.coverage == 'true'
uses: ./.github/workflows/coverage.yml
with:
commit_sha: ${{ github.event.pull_request.head.sha || github.sha }}
pr_number: ${{ github.event.pull_request.number || 0 }}
permissions:
contents: read
pull-requests: write
actions: read