forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
522 lines (491 loc) · 18.2 KB
/
config.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
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
516
517
518
519
520
521
522
version: 2.1
# The Linux jobs include hacks and flags that restricts parallelism, and re-try
# with less parallelism on failure.
#
# This is because CircleCI Linux jobs have 2 CPUs and 4GB RAM allocated via
# cgroups, but run on machines that advertise 36 CPUs and 68GB RAM. This means
# that most build tools will spawn 36 jobs and quickly choke to death. Even
# with just 4 jobs, 4GB may be too little, so we retry serially on failure.
#
# Comments saying "see top comment" refer to this.
orbs:
win: circleci/[email protected]
workflows:
version: 2
build:
jobs:
- android
- linux
- macos
- windows
- npm:
requires:
- android
- linux
- macos
- windows
- test-linux
- test-macos
- test-e2e:
requires:
- npm
jobs:
android:
docker:
- image: circleci/android:api-28-ndk
environment:
- HERMES_WS_DIR: /tmp/hermes
- TERM: dumb
steps:
- checkout
- run:
name: Set up workspace and install dependencies
command: |
yes | sdkmanager "ndk-bundle" &
yes | sdkmanager "cmake;3.6.4111459" &
mkdir -p "$HERMES_WS_DIR" "$HERMES_WS_DIR/output"
ln -sf "$PWD" "$HERMES_WS_DIR/hermes"
sudo apt-get update
sudo apt-get install -y cmake ninja-build libicu-dev
wait
sudo cp /usr/bin/ninja /usr/bin/ninja.real
# See top comment
printf '%s\n' '#!/bin/sh' 'ninja.real -j4 "$@" || ninja.real -j1 "$@"' | sudo tee /usr/bin/ninja
ln -sf /usr/bin/ninja /opt/android/sdk/cmake/3.6.4111459/bin/ninja
- run:
name: Build LLVM
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/build_llvm.py llvm llvm_build
- run:
name: Crosscompile LLVM
command: |
export ANDROID_SDK="$ANDROID_HOME"
export ANDROID_NDK="$ANDROID_HOME/ndk-bundle"
cd "$HERMES_WS_DIR" && hermes/utils/crosscompile_llvm.sh
- run:
name: Build Hermes Compiler
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/configure.py ./build ./llvm_build ./llvm
# Build the Hermes compiler so that the cross compiler build can
# access it to build the VM
cmake --build ./build --target hermesc
- run:
name: Build Hermes for Android
command: |
export ANDROID_SDK="$ANDROID_HOME"
export ANDROID_NDK="$ANDROID_HOME/ndk-bundle"
cd "$HERMES_WS_DIR/hermes/android" && ./gradlew githubRelease
- run:
name: Copy artifacts
command: |
cd "$HERMES_WS_DIR"
cp "build_android/distributions"/hermes-runtime-android-*.tar.gz "output"
- run:
name: Checksum artifacts
command: |
cd "$HERMES_WS_DIR/output"
for file in *
do
sha256sum "$file" > "$file.sha256"
done
- store_artifacts:
path: /tmp/hermes/output/
- persist_to_workspace:
root: /tmp/hermes/output/
paths:
- .
linux:
docker:
- image: debian:stretch
environment:
- HERMES_WS_DIR: /tmp/hermes
- TERM: dumb
steps:
- run:
name: Install dependencies
command: |
apt-get update
apt-get install -y \
sudo git openssh-client cmake ninja-build python \
build-essential libreadline-dev libicu-dev
- checkout
- run:
name: Set up workspace
command: |
mkdir -p "$HERMES_WS_DIR" "$HERMES_WS_DIR/output"
ln -sf "$PWD" "$HERMES_WS_DIR/hermes"
sudo cp /usr/bin/ninja /usr/bin/ninja.real
# See top comment
printf '%s\n' '#!/bin/sh' 'ninja.real -j4 "$@" || ninja.real -j1 "$@"' | sudo tee /usr/bin/ninja
- run:
name: Build LLVM
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/build_llvm.py --distribute llvm llvm_build
- run:
name: Build Hermes for Linux
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/configure.py --static-link --distribute
cd build_release
ninja github-cli-release
- run:
name: Copy artifacts
command: |
cd "$HERMES_WS_DIR"
cp "build_release/github"/hermes-cli-*.tar.gz "output"
- run:
name: Checksum artifacts
command: |
cd "$HERMES_WS_DIR/output"
for file in *
do
sha256sum "$file" > "$file.sha256"
done
- store_artifacts:
path: /tmp/hermes/output/
- persist_to_workspace:
root: /tmp/hermes/output/
paths:
- .
test-linux:
# execution-time-limit.js and sampling-profiler.js segfault in statically
# linked release mode, so this job is just a duplicate of the Linux job
# that builds in dynamically linked debug mode
docker:
- image: debian:stretch
environment:
- HERMES_WS_DIR: /tmp/hermes
- TERM: dumb
steps:
- run:
name: Install dependencies
command: |
apt-get update
apt-get install -y \
sudo git openssh-client cmake ninja-build python \
build-essential libreadline-dev libicu-dev zip python3
- checkout
- run:
name: Set up workspace
command: |
mkdir -p "$HERMES_WS_DIR"
ln -sf "$PWD" "$HERMES_WS_DIR/hermes"
sudo cp /usr/bin/ninja /usr/bin/ninja.real
# See top comment
printf '%s\n' '#!/bin/sh' 'ninja.real -j4 "$@" || ninja.real -j1 "$@"' | sudo tee /usr/bin/ninja
- run:
name: Build LLVM in debug mode
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/build_llvm.py llvm llvm_build
- run:
name: Run Hermes regression tests
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/configure.py
cd build
ninja check-hermes
macos:
macos:
xcode: "10.0.0"
environment:
- HERMES_WS_DIR: /tmp/hermes
- TERM: dumb
# Homebrew currently breaks while updating:
# https://discuss.circleci.com/t/brew-install-fails-while-updating/32992
- HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- checkout
- run:
name: Install dependencies
command: |
brew install cmake ninja
- run:
name: Set up workspace
command: |
mkdir -p "$HERMES_WS_DIR" "$HERMES_WS_DIR/output"
ln -sf "$PWD" "$HERMES_WS_DIR/hermes"
- run:
name: Build LLVM
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/build_llvm.py --distribute llvm llvm_build
- run:
name: Build Hermes for macOS
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/configure.py --distribute
cmake --build ./build_release --target github-cli-release
- run:
name: Copy artifacts
command: |
cd "$HERMES_WS_DIR"
cp "build_release/github"/hermes-cli-*.tar.gz "output"
- run:
name: Checksum artifacts
command: |
cd "$HERMES_WS_DIR/output"
for file in *
do
shasum -a 256 "$file" > "$file.sha256"
done
- store_artifacts:
path: /tmp/hermes/output/
- persist_to_workspace:
root: /tmp/hermes/output/
paths:
- .
test-macos:
# CheckedMalloc.Death fails in release mode, so build a debug version
macos:
xcode: "10.0.0"
environment:
- HERMES_WS_DIR: /tmp/hermes
- TERM: dumb
# Homebrew currently breaks while updating:
# https://discuss.circleci.com/t/brew-install-fails-while-updating/32992
- HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- checkout
- run:
name: Install dependencies
command: |
brew install cmake ninja
- run:
name: Set up workspace
command: |
mkdir -p "$HERMES_WS_DIR"
ln -sf "$PWD" "$HERMES_WS_DIR/hermes"
- run:
name: Build LLVM in debug mode
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/build_llvm.py llvm llvm_build
- run:
name: Run MacOS regression tests in debug mode
command: |
cd "$HERMES_WS_DIR"
hermes/utils/build/configure.py
cmake --build ./build --target check-hermes
windows:
executor:
name: win/preview-default
shell: powershell.exe
environment:
- HERMES_WS_DIR: 'C:\tmp\hermes'
- ICU_URL: 'https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip'
- MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
- CMAKE_DIR: 'C:\Program Files\CMake\bin'
steps:
- checkout
- run:
name: Set up workspace
command: |
New-Item -ItemType Directory $Env:HERMES_WS_DIR
New-Item -ItemType Directory $Env:HERMES_WS_DIR\icu
New-Item -ItemType Directory $Env:HERMES_WS_DIR\output
New-Item -ItemType Directory $Env:HERMES_WS_DIR\deps
New-Item -ItemType SymbolicLink -Target . -Path $Env:HERMES_WS_DIR -Name hermes
- run:
name: Download ICU
command: |
cd $Env:HERMES_WS_DIR\icu
# If Invoke-WebRequest shows a progress bar, it will fail with
# Win32 internal error "Access is denied" 0x5 occurred [...]
$progressPreference = 'silentlyContinue'
Invoke-WebRequest -Uri "$Env:ICU_URL" -OutFile "icu.zip"
Expand-Archive -Path "icu.zip" -DestinationPath "."
- run:
name: Install dependencies
command: |
choco install --no-progress cmake
if (-not $?) { throw "Failed to install CMake" }
choco install --no-progress python3
if (-not $?) { throw "Failed to install Python" }
# dotnetfx-4.8.0 requires a reboot, so pin an earlier version
choco install --no-progress dotnetfx --version 4.7.2.20180712
if (-not $?) { throw "Failed to install dotnetfx" }
# Choco installs of VS2019 are so slow that CircleCI times it out
# after 10 minutes of perceived inactivity. There's no verbose flag,
# so we'll just print something occasionally to bump the timer.
$install = Start-Job {
choco install visualstudio2019buildtools --package-parameters "--allWorkloads --includeRecommended --passive --locale en-US"
}
$eta = 15
while ($install.State -eq "Running") {
Write-Host "Waiting for visualstudio2019buildtools. ETA $eta minutes..."
$install | Wait-Job -timeout 60
$eta -= 1
}
$install | Receive-Job
if (-not $?) { throw "Failed to install visualstudio2019buildtools" }
choco install visualstudio2019-workload-vctools
if (-not $?) { throw "Failed to install visualstudio2019-workload-vctools" }
- run:
name: Build LLVM
command: |
$Env:PATH += ";$Env:CMAKE_DIR;$Env:MSBUILD_DIR"
cd $Env:HERMES_WS_DIR
hermes\utils\build\build_llvm.py --build-system='Visual Studio 16 2019' --distribute llvm llvm_build
if (-not $?) { throw "Failed to build LLVM" }
- run:
name: Assemble Windows runtime dependencies
command: |
cd $Env:HERMES_WS_DIR
Copy-Item -Path "icu\bin64\icu*.dll" -Destination "deps"
# Include MSVC++ 2015 redistributables
Copy-Item -Path "c:\windows\system32\msvcp140.dll" -Destination "deps"
Copy-Item -Path "c:\windows\system32\vcruntime140.dll" -Destination "deps"
- run:
name: Build Hermes for Windows
command: |
$Env:PATH += ";$Env:CMAKE_DIR;$Env:MSBUILD_DIR"
$Env:ICU_ROOT = "$Env:HERMES_WS_DIR\icu"
cd $Env:HERMES_WS_DIR
hermes\utils\build\configure.py --build-system='Visual Studio 16 2019' --cmake-flags="-DLLVM_ENABLE_LTO=OFF -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF -DHERMES_GITHUB_RESOURCE_DIR=$Env:HERMES_WS_DIR\deps" --distribute
if (-not $?) { throw "Failed to configure Hermes" }
cd build_release
cmake --build . --target github-cli-release --config Release
if (-not $?) { throw "Failed to build Hermes" }
- run:
name: Copy artifacts
command: |
cd $Env:HERMES_WS_DIR
Copy-Item -Path "build_release\github\hermes-cli-*.tar.gz" -Destination "output"
- run:
name: Checksum artifacts
command: |
cd $Env:HERMES_WS_DIR\output
foreach($file in Get-ChildItem) {
$hash = Get-FileHash -Path $file -Algorithm SHA256
Write-Output ($hash.Hash + " " + $file.Name) |
Out-File -Encoding ASCII -FilePath ($file.Name +".sha256")
}
- store_artifacts:
path: c:\tmp\hermes\output
- persist_to_workspace:
root: c:\tmp\hermes\output
paths:
- .
npm:
docker:
- image: ubuntu:19.04
environment:
- yarn: yarnpkg
- TERM: dumb
steps:
- run:
name: Install certificates required to attach workspace
command: |
apt-get update
apt-get install -y ca-certificates
- run:
name: Temporarily work around CircleCI workspace attachment bug
command: |
# As of 2019-09-10, CircleCI fails to attach Windows workspaces without this hack
cp /usr/bin/tar /usr/bin/tar.real
printf '%s\n' '#!/bin/sh' 'exec tar.real --no-same-owner "$@"' > /usr/bin/tar
- attach_workspace:
at: /tmp/hermes/input
- run:
name: Install dependencies and set up
command: |
mkdir -p /tmp/hermes/output
apt-get install -y git npm yarnpkg
- checkout
- run:
name: Build NPM
command: |
cd npm
cp /tmp/hermes/input/* .
$yarn install
$yarn pack
- run:
name: Copy artifacts
command: |
cd npm
cp hermes-engine-*.tgz /tmp/hermes/output
# Also copy the other packages for the sole purpose of not having
# to visit multiple jobs pages to download all release artifacts
cp /tmp/hermes/input/*.tar.gz /tmp/hermes/output
- run:
name: Checksum artifacts
command: |
cd /tmp/hermes/output
for file in *
do
sha256sum "$file" > "$file.sha256"
done
- store_artifacts:
path: /tmp/hermes/output
- persist_to_workspace:
root: /tmp/hermes/output
paths:
- .
test-e2e:
# For now we run E2E tests on MacOS as running an Android emulator on Linux is
# not supported with Circle CI:
# https://support.circleci.com/hc/en-us/articles/360000028928-Testing-with-Android-emulator-on-CircleCI-2-0
# Windows is another option, but I came across a convenient Mac OS example first:
# https://gist.github.com/DoguD/58b4b86a5d892130af84074078581b87
macos:
xcode: "10.0.0"
environment:
- TERM: dumb
# Homebrew currently breaks while updating:
# https://discuss.circleci.com/t/brew-install-fails-while-updating/32992
- HOMEBREW_NO_AUTO_UPDATE: 1
- JVM_OPTS: -Xmx3200m
- ANDROID_HOME: /usr/local/share/android-sdk
- ANDROID_SDK_HOME: /usr/local/share/android-sdk
- ANDROID_SDK_ROOT: /usr/local/share/android-sdk
- QEMU_AUDIO_DRV: none
- JAVA_HOME: /Library/Java/Home
steps:
- run:
name: Setup dependencies
command: |
# Node some version greater than 11 is needed by one of the app dependencies
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh"
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
nvm install 12
nvm use 12
brew install gnu-sed
brew install md5sha1sum
brew tap homebrew/cask
brew cask install android-sdk
echo 'export PATH="/usr/local/share/android-sdk/platform-tools:/usr/local/share/android-sdk/tools/bin:$PATH"' >> $BASH_ENV
- run:
name: Install emulator dependencies
command: (yes | sdkmanager "platform-tools" "platforms;android-26" "extras;intel;Hardware_Accelerated_Execution_Manager" "build-tools;26.0.0" "system-images;android-26;google_apis;x86" "emulator" --verbose) || true
- run:
name: Create emulator definition
command: |
avdmanager create avd -n Pixel_2_API_26 -k "system-images;android-26;google_apis;x86" -g google_apis -d "Nexus 5"
- run:
name: Run emulator in background
command: /usr/local/share/android-sdk/emulator/emulator @Pixel_2_API_26 -memory 2048 -noaudio
background: true
- checkout
- attach_workspace:
at: /tmp/hermes/input
- run:
# For now we're not testing with RN from master because it's broken.
# If RN master + Hermes becoms stable we can pass --react-native-master to
# run.sh, or run it again as another step/job.
name: Run E2E test with master Hermes and Release React Native
command: |
cd test/circleci-e2e
./run.sh --hermes-npm-package /tmp/hermes/input/hermes-engine-*.tgz
# The react-native setup tool takes AGES "Installing CocoaPods dependencies"
no_output_timeout: 45m
- store_artifacts:
path: /tmp/screencap.mp4
- store_artifacts:
path: /tmp/app-release.apk