-
Notifications
You must be signed in to change notification settings - Fork 539
375 lines (315 loc) · 12.8 KB
/
nightly-ci.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
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
name: Nightly CI
run-name: Nightly CI tests triggered from @${{ github.actor }} of ${{ github.head_ref }}
on:
workflow_dispatch:
merge_group:
pull_request:
push:
branches:
- master
schedule:
# Run at 00:00 AM UTC
- cron: '0 0 * * *'
jobs:
# Only run on schedule AND main branch
tests-scheduled:
name: Scheduled tests
runs-on: ubuntu-8
services:
redis:
image: redis
ports:
- 6379:6379
strategy:
fail-fast: false
matrix:
test-mode: [race, legacychallenge, long, challenge]
if: github.event_name == 'schedule' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: sudo apt update && sudo apt install -y wabt gotestsum
- name: Setup nodejs
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Install go
uses: actions/setup-go@v4
with:
go-version: 1.23.x
- name: Install wasm-ld
run: |
sudo apt-get update && sudo apt-get install -y lld-14
sudo ln -s /usr/bin/wasm-ld-14 /usr/local/bin/wasm-ld
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
id: install-rust
with:
toolchain: '1.84.1'
targets: 'wasm32-wasip1, wasm32-unknown-unknown'
components: 'llvm-tools-preview, rustfmt, clippy'
- name: Install rust nightly
uses: dtolnay/rust-toolchain@nightly
id: install-rust-nightly
with:
toolchain: 'nightly-2025-02-14'
targets: 'wasm32-wasip1, wasm32-unknown-unknown'
components: 'rust-src, rustfmt, clippy'
- name: Set STYLUS_NIGHTLY_VER environment variable
run: echo "STYLUS_NIGHTLY_VER=+$(rustup toolchain list | grep '^nightly' | head -n1 | cut -d' ' -f1)" >> "$GITHUB_ENV"
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
cache: false
- name: Install cbindgen
run: cargo install --force cbindgen
- name: Cache Build Products
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.test-mode }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ matrix.test-mode }}-
- name: Cache Rust Build Products
uses: actions/cache@v3
with:
path: |
~/.cargo/
arbitrator/target/
arbitrator/wasm-libraries/target/
arbitrator/wasm-libraries/soft-float/
target/etc/initial-machine-cache/
/home/runner/.rustup/toolchains/
key: ${{ runner.os }}-cargo-${{ matrix.test-mode }}-${{ steps.install-rust.outputs.rustc_hash }}-min-${{ hashFiles('arbitrator/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ matrix.test-mode }}-${{ steps.install-rust.outputs.rustc_hash }}-
- name: Cache cbrotli
uses: actions/cache@v3
id: cache-cbrotli
with:
path: |
target/include/brotli/
target/lib-wasm/
target/lib/libbrotlicommon-static.a
target/lib/libbrotlienc-static.a
target/lib/libbrotlidec-static.a
key: ${{ runner.os }}-brotli-${{ matrix.test-mode }}-${{ hashFiles('scripts/build-brotli.sh') }}-${{ hashFiles('.github/workflows/arbitrator-ci.yaml') }}
- name: Build cbrotli-local
run: ./scripts/build-brotli.sh -l
- name: Build cbrotli-wasm in docker
run: ./scripts/build-brotli.sh -w -d
- name: Build
run: make build test-go-deps -j
- name: Build all lint dependencies
run: make -j build-node-deps
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-pkg-cache: true
- name: Custom Lint
run: |
go run ./linters ./...
- name: Set environment variables
run: |
mkdir -p target/tmp/deadbeefbee
echo "TMPDIR=$(pwd)/target/tmp/deadbeefbee" >> "$GITHUB_ENV"
echo "GOMEMLIMIT=6GiB" >> "$GITHUB_ENV"
echo "GOGC=80" >> "$GITHUB_ENV"
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV"
- name: run tests with race detection and hash state scheme
if: matrix.test-mode == 'race'
run: |
echo "Running tests with Hash Scheme" >> full.log
${{ github.workspace }}/.github/workflows/gotestsum.sh --race --timeout 30m --test_state_scheme hash
- name: run challenge tests
if: matrix.test-mode == 'challenge'
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags challengetest --run TestChallenge --timeout 120m --cover
- name: run legacy challenge tests
if: matrix.test-mode == 'legacychallenge'
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags legacychallengetest --run TestChallenge --timeout 60m --cover
- name: run long stylus tests
if: matrix.test-mode == 'long'
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags stylustest --run TestProgramLong --timeout 60m --cover
- name: Archive detailed run log
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.test-mode }}-full.log
path: full.log
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: false
files: ./coverage.txt,./coverage-redis.txt
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}
# Only run this job if files in bold/legacy/ are modified
tests-pr:
name: PR modified files tests
runs-on: ubuntu-8
if: github.event_name == 'pull_request'
permissions:
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Check changed files
id: changed-files
uses: tj-actions/changed-files@v46
with:
files: bold/legacy/**
# Add conditional execution for all subsequent steps
- name: Skip tests if no relevant files changed
id: check-skip
if: steps.changed-files.outputs.any_changed != 'true'
run: |
echo "No changes detected in bold/legacy/** - skipping challenge tests"
exit 0 # Success exit code to pass the job
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: sudo apt update && sudo apt install -y wabt gotestsum
- name: Setup nodejs
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Install go
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-go@v4
with:
go-version: 1.23.x
- name: Install wasm-ld
if: steps.changed-files.outputs.any_changed == 'true'
run: |
sudo apt-get update && sudo apt-get install -y lld-14
sudo ln -s /usr/bin/wasm-ld-14 /usr/local/bin/wasm-ld
- name: Install rust stable
if: steps.changed-files.outputs.any_changed == 'true'
uses: dtolnay/rust-toolchain@stable
id: install-rust
with:
toolchain: '1.84.1'
targets: 'wasm32-wasip1, wasm32-unknown-unknown'
components: 'llvm-tools-preview, rustfmt, clippy'
- name: Install rust nightly
if: steps.changed-files.outputs.any_changed == 'true'
uses: dtolnay/rust-toolchain@nightly
id: install-rust-nightly
with:
toolchain: 'nightly-2025-02-14'
targets: 'wasm32-wasip1, wasm32-unknown-unknown'
components: 'rust-src, rustfmt, clippy'
- name: Set STYLUS_NIGHTLY_VER environment variable
if: steps.changed-files.outputs.any_changed == 'true'
run: echo "STYLUS_NIGHTLY_VER=+$(rustup toolchain list | grep '^nightly' | head -n1 | cut -d' ' -f1)" >> "$GITHUB_ENV"
- name: Install Foundry
if: steps.changed-files.outputs.any_changed == 'true'
uses: foundry-rs/foundry-toolchain@v1
with:
cache: false
- name: Install cbindgen
if: steps.changed-files.outputs.any_changed == 'true'
run: cargo install --force cbindgen
- name: Cache Build Products
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.test-mode }}-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ matrix.test-mode }}-
- name: Cache Rust Build Products
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/cache@v3
with:
path: |
~/.cargo/
arbitrator/target/
arbitrator/wasm-libraries/target/
arbitrator/wasm-libraries/soft-float/
target/etc/initial-machine-cache/
/home/runner/.rustup/toolchains/
key: ${{ runner.os }}-cargo-${{ matrix.test-mode }}-${{ steps.install-rust.outputs.rustc_hash }}-min-${{ hashFiles('arbitrator/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ matrix.test-mode }}-${{ steps.install-rust.outputs.rustc_hash }}-
- name: Cache cbrotli
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/cache@v3
id: cache-cbrotli
with:
path: |
target/include/brotli/
target/lib-wasm/
target/lib/libbrotlicommon-static.a
target/lib/libbrotlienc-static.a
target/lib/libbrotlidec-static.a
key: ${{ runner.os }}-brotli-${{ matrix.test-mode }}-${{ hashFiles('scripts/build-brotli.sh') }}-${{ hashFiles('.github/workflows/arbitrator-ci.yaml') }}
- name: Build cbrotli-local
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-cbrotli.outputs.cache-hit != 'true'
run: ./scripts/build-brotli.sh -l
- name: Build cbrotli-wasm in docker
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-cbrotli.outputs.cache-hit != 'true'
run: ./scripts/build-brotli.sh -w -d
- name: Build
if: steps.changed-files.outputs.any_changed == 'true'
run: make build test-go-deps -j
- name: Build all lint dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: make -j build-node-deps
- name: Lint
if: steps.changed-files.outputs.any_changed == 'true'
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-pkg-cache: true
- name: Custom Lint
if: steps.changed-files.outputs.any_changed == 'true'
run: |
go run ./linters ./...
- name: Set environment variables
if: steps.changed-files.outputs.any_changed == 'true'
run: |
mkdir -p target/tmp/deadbeefbee
echo "TMPDIR=$(pwd)/target/tmp/deadbeefbee" >> "$GITHUB_ENV"
echo "GOMEMLIMIT=6GiB" >> "$GITHUB_ENV"
echo "GOGC=80" >> "$GITHUB_ENV"
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV"
- name: run challenge tests
if: steps.changed-files.outputs.any_changed == 'true'
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags legacychallengetest --run TestChallenge --timeout 60m --cover
- name: Archive detailed run log
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.test-mode }}-full.log
path: full.log
- name: Upload coverage to Codecov
if: steps.changed-files.outputs.any_changed == 'true' && matrix.test-mode == 'defaults'
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: false
files: ./coverage.txt,./coverage-redis.txt
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}
notify-on-failure:
name: Notify Slack on failure
needs: [tests-scheduled]
runs-on: ubuntu-latest
if: ${{ failure() }}
steps:
- name: Send Slack notification
uses: slackapi/[email protected]
with:
errors: true
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
"channel": "${{ secrets.SLACK_CHANNEL_ID }}",
"text": "⚠️ CI job failed! ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",