-
Notifications
You must be signed in to change notification settings - Fork 375
515 lines (435 loc) · 19.8 KB
/
ci.yml
File metadata and controls
515 lines (435 loc) · 19.8 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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
name: ci
on:
push:
branches: [main]
tags: ["**"]
pull_request:
branches: [main]
types: [labeled, opened, synchronize, reopened]
permissions: write-all
jobs:
build:
name: ${{ matrix.config.variant }} ${{ matrix.config.target }} ${{ matrix.config.v8_enable_pointer_compression && 'ptrcomp' || '' }}
runs-on: ${{ matrix.config.os }}
timeout-minutes: 180
strategy:
# Always run main branch builds to completion. This allows the cache to
# stay mostly up-to-date in situations where a single job fails due to
# e.g. a flaky test.
# Don't fast-fail on tag build because publishing binaries shouldn't be
# prevented if 'cargo publish' fails (which can be a false negative).
fail-fast:
${{ (github.event_name == 'pull_request' || (github.ref !=
'refs/heads/main' && !startsWith(github.ref, 'refs/tags/'))) &&
!contains(github.event.pull_request.labels.*.name, 'no-fail-fast') }}
matrix:
config:
- os: macos-15-large
target: x86_64-apple-darwin
variant: debug
v8_enable_pointer_compression: false
cargo: cargo
- os: macos-15-large
target: x86_64-apple-darwin
variant: release
v8_enable_pointer_compression: false
cargo: cargo
- os: macos-15-large
target: x86_64-apple-darwin
variant: debug
v8_enable_pointer_compression: true
cargo: cargo
- os: macos-15-large
target: x86_64-apple-darwin
variant: release
v8_enable_pointer_compression: true
cargo: cargo
- os: macos-15
target: aarch64-apple-darwin
variant: debug
v8_enable_pointer_compression: false
cargo: cargo
- os: macos-15
target: aarch64-apple-darwin
variant: release
v8_enable_pointer_compression: false
cargo: cargo
- os: macos-15
target: aarch64-apple-darwin
variant: debug
v8_enable_pointer_compression: true
cargo: cargo
- os: macos-15
target: aarch64-apple-darwin
variant: release
v8_enable_pointer_compression: true
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }}
target: x86_64-unknown-linux-gnu
variant: debug
v8_enable_pointer_compression: false
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }}
target: x86_64-unknown-linux-gnu
variant: release
v8_enable_pointer_compression: false
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }}
target: x86_64-unknown-linux-gnu
variant: debug
v8_enable_pointer_compression: true
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }}
target: x86_64-unknown-linux-gnu
variant: release
v8_enable_pointer_compression: true
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'windows-2022-xxl' || 'windows-2022' }}
target: x86_64-pc-windows-msvc
variant: release # Note: we do not support windows debug builds.
v8_enable_pointer_compression: false
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }}
target: aarch64-unknown-linux-gnu
variant: debug
v8_enable_pointer_compression: false
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }}
target: aarch64-unknown-linux-gnu
variant: release
v8_enable_pointer_compression: false
cargo: cargo
env:
V8_FROM_SOURCE: true
CARGO_VARIANT_FLAG: ${{ matrix.config.variant == 'release' && '--release' || '' }}
CARGO_FEATURE_FLAGS: ${{ matrix.config.v8_enable_pointer_compression && '--features v8_enable_pointer_compression' || '' }}
LIB_NAME: ${{ contains(matrix.config.target, 'windows') && 'rusty_v8' || 'librusty_v8' }}
LIB_EXT: ${{ contains(matrix.config.target, 'windows') && 'lib' || 'a' }}
FEATURES_SUFFIX: ${{ matrix.config.v8_enable_pointer_compression && '_ptrcomp' || '' }}
RUSTFLAGS: -D warnings
steps:
- name: Configure git
run: git config --global core.symlinks true
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 10
submodules: recursive
- name: Install rust
uses: dsherret/rust-toolchain-file@v1
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
- name: Install nextest
run: cargo binstall cargo-nextest --secure --locked --no-confirm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install python
uses: actions/setup-python@v5
with:
python-version: 3.11.x
architecture: x64
- name: Install cross compilation toolchain
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: |
rustup target add aarch64-unknown-linux-gnu
sudo apt update
sudo apt install -yq --no-install-suggests --no-install-recommends \
binfmt-support g++-10-aarch64-linux-gnu g++-10-multilib \
gcc-10-aarch64-linux-gnu libc6-arm64-cross qemu qemu-user \
qemu-user-binfmt
sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 \
/lib/ld-linux-aarch64.so.1
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc-10" >> ${GITHUB_ENV}
echo "QEMU_LD_PREFIX=/usr/aarch64-linux-gnu" >> ${GITHUB_ENV}
- name: Write git_submodule_status.txt
run: git submodule status --recursive > git_submodule_status.txt
- name: Cache
uses: actions/cache@v4
with:
# Note: rusty_v8 targets always get get rebuilt, and their outputs
# ('librusty_v8.rlib', the whole 'gn_out' directory, etc.) can be
# quite big, so we cache only those subdirectories of
# target/{debug|release} that contain the build output for crates that
# come from the registry. By additionally saving the sccache cache
# directory it's still possible to build v8 fast.
path: |-
target/sccache
target/*/.*
target/*/build
target/*/deps
key: cargo1-${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ matrix.config.v8_enable_pointer_compression }}-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }}
restore-keys: cargo1-${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ matrix.config.v8_enable_pointer_compression }}-
- name: Install and start sccache
shell: pwsh
env:
SCCACHE_DIR: ${{ github.workspace }}/target/sccache
SCCACHE_CACHE_SIZE: 256M
SCCACHE_IDLE_TIMEOUT: 0
run: |
$version = "v0.8.2"
$platform =
@{ "x86_64-apple-darwin" = "x86_64-apple-darwin"
"aarch64-apple-darwin" = "aarch64-apple-darwin"
"x86_64-unknown-linux-gnu" = "x86_64-unknown-linux-musl"
"aarch64-unknown-linux-gnu" = "aarch64-unknown-linux-musl"
"x86_64-pc-windows-msvc" = "x86_64-pc-windows-msvc"
}['${{ matrix.config.target }}']
$basename = "sccache-$version-$platform"
$url = "https://github.com/mozilla/sccache/releases/download/$version/$basename.tar.gz"
cd ~
curl -LO $url
tar -xzvf "$basename.tar.gz"
. $basename/sccache --start-server
echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Clang
if: startsWith(matrix.config.os, 'ubuntu')
run: |
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main" | sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-jammy-19.list
curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg
sudo apt-get update
sudo apt-get -qq remove 'clang-*'
sudo apt-get install lld-19 clang-19 clang-tools-19 clang-tidy-19 clang-format-19 libclang-19-dev -y
echo "LIBCLANG_PATH=/usr/lib/llvm-19/lib" >> $GITHUB_ENV
- name: check rust code formatting
run: cargo fmt --check
- name: check c++ code formatting
if: startsWith(matrix.config.os, 'ubuntu')
run: |
clang-format-19 --verbose --Werror --dry-run src/*.cc src/*.hpp src/*.h
- name: Test
env:
SCCACHE_IDLE_TIMEOUT: 0
if: matrix.config.variant == 'debug' || matrix.config.variant == 'release'
run: ${{ matrix.config.cargo }} nextest run -v --cargo-verbose --cargo-verbose --all-targets --locked --target ${{ matrix.config.target }} ${{ env.CARGO_VARIANT_FLAG }} ${{ env.CARGO_FEATURE_FLAGS }}
- name: Clippy
run: ${{ matrix.config.cargo }} clippy --all-targets --locked --target ${{ matrix.config.target }} ${{ env.CARGO_VARIANT_FLAG }} ${{ env.CARGO_FEATURE_FLAGS }} -- -D clippy::all
- name: Prepare binary publish
if: matrix.config.variant == 'debug' || matrix.config.variant == 'release'
run: |
gzip -9c target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }} > target/${{ env.LIB_NAME }}${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz
ls -l target/${{ env.LIB_NAME }}${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz
cp target/${{ matrix.config.target }}/${{ matrix.config.variant}}/gn_out/src_binding.rs target/src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
ls -l target/src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
- name: Binary publish
uses: softprops/action-gh-release@v0.1.15
if: >-
github.repository == 'denoland/rusty_v8' &&
startsWith(github.ref, 'refs/tags/') &&
(matrix.config.variant == 'debug' || matrix.config.variant == 'release')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/${{ env.LIB_NAME }}${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz
target/src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
- name: Upload CI artifacts
uses: actions/upload-artifact@v4
with:
name: src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
path: target/src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
build-asan:
name: asan aarch64-apple-darwin
runs-on: macos-15
timeout-minutes: 180
env:
V8_FROM_SOURCE: true
RUSTFLAGS: -D warnings
steps:
- name: Configure git
run: git config --global core.symlinks true
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 10
submodules: recursive
- name: Install rust
uses: dsherret/rust-toolchain-file@v1
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
- name: Install nextest
run: cargo binstall cargo-nextest --secure --locked
- name: Install python
uses: actions/setup-python@v5
with:
python-version: 3.11.x
architecture: x64
- name: Write git_submodule_status.txt
run: git submodule status --recursive > git_submodule_status.txt
- name: Cache
uses: actions/cache@v4
with:
path: |-
target/sccache
target/*/.*
target/*/build
target/*/deps
key: cargo1-aarch64-apple-darwin-asan-false-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }}
restore-keys: cargo1-aarch64-apple-darwin-asan-false-
- name: Install and start sccache
shell: pwsh
env:
SCCACHE_DIR: ${{ github.workspace }}/target/sccache
SCCACHE_CACHE_SIZE: 256M
SCCACHE_IDLE_TIMEOUT: 0
run: |
$version = "v0.8.2"
$platform = "aarch64-apple-darwin"
$basename = "sccache-$version-$platform"
$url = "https://github.com/mozilla/sccache/releases/download/$version/$basename.tar.gz"
cd ~
curl -LO $url
tar -xzvf "$basename.tar.gz"
. $basename/sccache --start-server
echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Rust (nightly)
uses: dtolnay/rust-toolchain@nightly
- name: Test (ASAN)
env:
SCCACHE_IDLE_TIMEOUT: 0
# https://github.com/rust-lang/rust/issues/87215
run: |
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
# Is there a better way to install this tool?
curl -O http://commondatastorage.googleapis.com/chromium-browser-clang-staging/Mac/dsymutil-llvmorg-17-init-19076-g5533fc10-1.tgz
tar -C tools/clang/dsymutil/ -xvzf dsymutil-llvmorg-17-init-19076-g5533fc10-1.tgz
V8_FROM_SOURCE=true RUSTFLAGS="-C opt-level=1 -Zsanitizer=address" cargo +nightly -Z build-std nextest run --lib --bins --tests -v --cargo-verbose --cargo-verbose --target aarch64-apple-darwin
build-windows-arm64:
name: release aarch64-pc-windows-msvc
runs-on: ${{ github.repository == 'denoland/rusty_v8' && 'windows-2022-xxl' || 'windows-2022' }}
timeout-minutes: 180
env:
CARGO_VARIANT_FLAG: --release
V8_FROM_SOURCE: true
CCACHE: ccache
LIB_NAME: rusty_v8
LIB_EXT: lib
FEATURES_SUFFIX: ''
steps:
- name: Configure git
run: git config --global core.symlinks true
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 10
submodules: recursive
- uses: dsherret/rust-toolchain-file@v1
- name: Install Windows ARM64 target
run: rustup target add aarch64-pc-windows-msvc
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Write git_submodule_status.txt
run: git submodule status --recursive > git_submodule_status.txt
- name: Cache
uses: actions/cache@v4
with:
path: |-
target/sccache
target/aarch64-pc-windows-msvc/release/gn_out
key: cargo1-aarch64-pc-windows-msvc-release-false-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }}
restore-keys: cargo1-aarch64-pc-windows-msvc-release-false-
- name: Install and start sccache
shell: pwsh
env:
SCCACHE_DIR: ${{ github.workspace }}/target/sccache
SCCACHE_CACHE_SIZE: 256M
SCCACHE_IDLE_TIMEOUT: 0
run: |
$version = "v0.8.2"
$platform = "x86_64-pc-windows-msvc"
$basename = "sccache-$version-$platform"
$url = "https://github.com/mozilla/sccache/releases/download/$version/$basename.tar.gz"
cd ~
curl -LO $url
tar -xzvf "$basename.tar.gz"
. $basename/sccache --start-server
echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Clang
run: python3 tools/clang/scripts/update.py
- name: Build (cross-compile, no tests)
env:
SCCACHE_IDLE_TIMEOUT: 0
run: cargo build --all-targets --locked --target aarch64-pc-windows-msvc --release
- name: Clippy
run: cargo clippy --all-targets --locked --target aarch64-pc-windows-msvc --release -- -D clippy::all
- name: Prepare binary publish
run: |
gzip -9c target/aarch64-pc-windows-msvc/release/gn_out/obj/rusty_v8.lib > target/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz
ls -l target/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz
cp target/aarch64-pc-windows-msvc/release/gn_out/src_binding.rs target/src_binding_release_aarch64-pc-windows-msvc.rs
ls -l target/src_binding_release_aarch64-pc-windows-msvc.rs
- name: Binary publish
uses: softprops/action-gh-release@v0.1.15
if: github.repository == 'denoland/rusty_v8' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz
target/src_binding_release_aarch64-pc-windows-msvc.rs
- name: Upload CI artifacts
uses: actions/upload-artifact@v4
with:
name: src_binding_release_aarch64-pc-windows-msvc.rs
path: target/src_binding_release_aarch64-pc-windows-msvc.rs
- name: Upload prebuilt library for testing
uses: actions/upload-artifact@v4
with:
name: windows-arm64-prebuilt-release
path: |
target/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz
target/src_binding_release_aarch64-pc-windows-msvc.rs
retention-days: 1
test-windows-arm64:
name: test aarch64-pc-windows-msvc
needs: build-windows-arm64
runs-on: ${{ github.repository == 'denoland/rusty_v8' && 'windows-11-arm-xl' || 'windows-11-arm' }}
timeout-minutes: 60
steps:
- name: Configure git
run: git config --global core.symlinks true
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 10
submodules: recursive
- uses: dsherret/rust-toolchain-file@v1
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Download prebuilt library
uses: actions/download-artifact@v4
with:
name: windows-arm64-prebuilt-release
- name: Run tests with prebuilt library
env:
RUSTY_V8_ARCHIVE: ${{ github.workspace }}/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz
RUSTY_V8_SRC_BINDING_PATH: ${{ github.workspace }}/src_binding_release_aarch64-pc-windows-msvc.rs
run: cargo nextest run -v --all-targets --locked --target aarch64-pc-windows-msvc --release --no-fail-fast
publish:
needs: [build, build-windows-arm64]
runs-on: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }}
if: github.repository == 'denoland/rusty_v8' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Configure git
run: git config --global core.symlinks true
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 10
submodules: recursive
- name: Install rust
uses: dsherret/rust-toolchain-file@v1
- name: Install python
uses: actions/setup-python@v5
with:
python-version: 3.11.x
architecture: x64
- name: Download CI artifacts
uses: actions/download-artifact@v4
with:
path: gen
pattern: src_binding_*.rs
merge-multiple: true
- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -vv --locked --allow-dirty