hermes-windows/.circleci/config.yml

702 строки
24 KiB
YAML

version: 2.1
orbs:
win: circleci/windows@2.4.0
android: circleci/android@2.0.3
node: circleci/node@4.7.0
workflows:
version: 2
build:
jobs:
- android
- linux
- macos
- build-apple-runtime
- test-macos
- test-apple-runtime:
requires:
- build-apple-runtime
- package-apple-runtime:
requires:
- test-macos
- test-apple-runtime
- windows
- npm:
requires:
- android
- linux
- package-apple-runtime
- windows
- macos
- emscripten
- sandbox
- test-linux
- test-windows
- test-e2e
- test-e2e-intl
- test-macos-test262
# Default settings for Apple jobs (apple-runtime, test-apple-runtime)
apple_defaults: &apple_defaults
macos:
xcode: 13.4.1
resource_class: macos.m1.medium.gen1
working_directory: ~/hermes
environment:
- TERM: dumb
- HERMES_WS_DIR: /tmp/hermes
# Homebrew currently breaks while updating:
# https://discuss.circleci.com/t/brew-install-fails-while-updating/32992
- HOMEBREW_NO_AUTO_UPDATE: 1
jobs:
android:
executor:
name: android/android-machine
tag: 2022.04.1
working_directory: /home/circleci
environment:
HERMES_WS_DIR: /home/circleci
steps:
- run:
name: Set up workspace and install dependencies
command: |
yes | sdkmanager "cmake;3.22.1" &
sudo apt update && sudo apt install -y libicu-dev
- checkout:
path: hermes
- run:
name: Build Hermes Compiler
command: |
cmake -S hermes -B build
# Build the Hermes compiler so that the cross compiler build can
# access it to build the VM
cmake --build ./build --target hermesc -j 4
- run:
name: Build Hermes for Android
command: |
cd hermes/android
./gradlew githubRelease
- run:
name: Copy artifacts
command: |
mkdir output
cp build_android/distributions/hermes-runtime-android-*.tar.gz output
- run:
name: Checksum artifacts
command: |
cd output
for file in *
do
sha256sum "$file" > "$file.sha256"
done
- store_artifacts:
path: output
- persist_to_workspace:
root: output
paths:
- .
linux:
docker:
- image: debian:bullseye
working_directory: /root
steps:
- run:
name: Install dependencies
command: |
apt update
apt install -y git openssh-client cmake build-essential \
libreadline-dev libicu-dev zip python3
- checkout:
path: hermes
- run:
name: Build linux CLI
command: |
cmake -S hermes -B build_hdb -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS=-s -DCMAKE_C_FLAGS=-s \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--whole-archive -lpthread -Wl,--no-whole-archive"
cmake -S hermes -B build -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS=-s -DCMAKE_C_FLAGS=-s \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--whole-archive -lpthread -Wl,--no-whole-archive" \
-DHERMES_ENABLE_DEBUGGER=False
cmake --build build_hdb --target hdb
cmake --build build --target check-hermes hermes hvm hbcdump hermesc
- run:
name: Create CLI tarball
environment:
TAR_NAME: hermes-cli-linux.tar.gz
command: |
mkdir output staging
cp build/bin/hermes build/bin/hvm build/bin/hbcdump \
build/bin/hermesc build_hdb/bin/hdb staging
tar -C staging -czvf output/${TAR_NAME} .
shasum -a 256 output/${TAR_NAME} > output/${TAR_NAME}.sha256
- store_artifacts:
path: output
- persist_to_workspace:
root: output
paths:
- .
test-linux:
docker:
- image: debian:bullseye
working_directory: /root
steps:
- run:
name: Install dependencies
command: |
apt update
apt install -y git openssh-client cmake build-essential \
libicu-dev zip python3
- checkout:
path: hermes
- run:
name: Run Hermes regression tests
command: |
cmake -S hermes -B build
cmake --build build --target check-hermes all -j 4
test-apple-runtime:
<<: *apple_defaults
steps:
- checkout
- restore_cache:
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Install dependencies
command: |
brew install cmake ninja
- run:
name: Build the test application
command: |
pod install
working_directory: test/ApplePlatformsIntegrationTestApp
- run:
name: Test MacOS application
command: |
xcodebuild test \
-workspace ApplePlatformsIntegrationTests.xcworkspace \
-configuration Debug \
-destination 'platform=macOS' \
-scheme ApplePlatformsIntegrationMacTests
working_directory: test/ApplePlatformsIntegrationTestApp
- run:
name: Test iPhone application
command: |
xcodebuild test \
-workspace ApplePlatformsIntegrationTests.xcworkspace \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 11' \
-scheme ApplePlatformsIntegrationMobileTests
working_directory: test/ApplePlatformsIntegrationTestApp
build-apple-runtime:
<<: *apple_defaults
steps:
- checkout
# TODO: Use a better cache key to avoid rebuilding whole framework
# when it is not necessary
- restore_cache:
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Set up workspace
command: mkdir -p /tmp/hermes/output
- run:
name: Install dependencies
command: |
brew install cmake ninja
sudo gem install cocoapods
- run:
name: Build the iOS frameworks
command: ./utils/build-ios-framework.sh
- run:
name: Build the Mac frameworks
command: ./utils/build-mac-framework.sh
- save_cache:
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/hermes/build_iphoneos
- ~/hermes/build_catalyst
- ~/hermes/build_iphonesimulator
- ~/hermes/build_macosx
- ~/hermes/destroot
package-apple-runtime:
<<: *apple_defaults
steps:
- checkout
- restore_cache:
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Set up workspace
command: mkdir -p /tmp/hermes/output
- run:
name: Install dependencies
command: |
brew install cmake ninja
sudo gem install cocoapods
- run:
name: Package the framework
command: |
. ./utils/build-apple-framework.sh
mkdir -p /tmp/cocoapods-package-root/destroot
cp -R ./destroot /tmp/cocoapods-package-root
cp hermes-engine.podspec LICENSE /tmp/cocoapods-package-root
tar -C /tmp/cocoapods-package-root/ -czvf /tmp/hermes/output/hermes-runtime-darwin-v$(get_release_version).tar.gz .
- run:
name: Checksum artifacts
command: |
cd /tmp/hermes/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:
- .
macos:
macos:
xcode: 13.4.1
steps:
- checkout:
path: hermes
- run:
name: Install dependencies
command: |
brew install cmake ninja
- run:
name: Build macOS CLI
environment:
RELEASE_FLAGS: >-
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DCMAKE_OSX_ARCHITECTURES=x86_64;arm64 \
-DBUILD_SHARED_LIBS=OFF -DHERMES_BUILD_SHARED_JSI=OFF
command: |
cmake -S hermes -B build -G Ninja ${RELEASE_FLAGS} -DHERMES_ENABLE_DEBUGGER=False
cmake --build ./build --target hermes hvm hbcdump hermesc check-hermes
cmake -S hermes -B build_hdb -G Ninja ${RELEASE_FLAGS}
cmake --build ./build_hdb --target hdb check-hermes
- run:
name: Create CLI tarball
environment:
TAR_NAME: hermes-cli-darwin.tar.gz
command: |
mkdir output staging
cp build/bin/hermes build/bin/hvm build/bin/hbcdump \
build/bin/hermesc build_hdb/bin/hdb staging
tar -C staging -czvf output/${TAR_NAME} .
shasum -a 256 output/${TAR_NAME} > output/${TAR_NAME}.sha256
- store_artifacts:
path: output
- persist_to_workspace:
root: output
paths:
- .
test-macos:
macos:
xcode: 13.4.1
steps:
- checkout:
path: hermes
- run:
name: Install dependencies
command: |
brew install cmake
- run:
name: Run MacOS regression tests in debug mode
command: |
cmake -S hermes -B build -GXcode
cmake --build ./build
cmake --build ./build --target check-hermes
test-windows:
executor:
name: win/default
version: 2023.10.1
environment:
- CMAKE_DIR: 'C:\Program Files\CMake\bin'
steps:
- checkout:
path: hermes
- run:
name: Set up dependencies
command: |
choco install -y --no-progress cmake --version 3.14.7 --installargs 'ADD_CMAKE_TO_PATH=System'
if (-not $?) { throw "Failed to install CMake" }
ln -s (get-command python.exe).Path (get-command python.exe).Path.replace("python.exe", "python3.exe")
- run:
name: Run Hermes regression tests
command: |
$Env:PATH += ";$Env:CMAKE_DIR"
cmake -S hermes -B build -G 'Visual Studio 16 2019'
cmake --build build --target check-hermes -- -m /p:UseMultiToolTask=true -m /p:EnforceProcessCountAcrossBuilds=true
windows:
executor:
name: win/default
version: 2023.10.1
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'
- RELEASE_FLAGS: -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
- TAR_NAME: 'hermes-cli-windows.tar.gz'
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\staging
New-Item -ItemType Directory $Env:HERMES_WS_DIR\output
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 -y --no-progress cmake --version 3.14.7 --installargs 'ADD_CMAKE_TO_PATH=System'
if (-not $?) { throw "Failed to install CMake" }
ln -s (get-command python.exe).Path (get-command python.exe).Path.replace("python.exe", "python3.exe")
- run:
name: Assemble Windows runtime dependencies
command: |
cd $Env:HERMES_WS_DIR
Copy-Item -Path "icu\bin64\icu*.dll" -Destination "staging"
# Include MSVC++ 2015 redistributables
Copy-Item -Path "c:\windows\system32\msvcp140.dll" -Destination "staging"
Copy-Item -Path "c:\windows\system32\vcruntime140.dll" -Destination "staging"
Copy-Item -Path "c:\windows\system32\vcruntime140_1.dll" -Destination "staging"
- run:
name: Build Windows CLI
command: |
$Env:PATH += ";$Env:MSBUILD_DIR;$Env:CMAKE_DIR"
$Env:ICU_ROOT = "$Env:HERMES_WS_DIR\icu"
cd $Env:HERMES_WS_DIR
cmake -S hermes -B build -G 'Visual Studio 16 2019' -Ax64 -DHERMES_ENABLE_DEBUGGER=False $Env:RELEASE_FLAGS
if (-not $?) { throw "Failed to configure Hermes" }
cmake -S hermes -B build_hdb -G 'Visual Studio 16 2019' -Ax64 $Env:RELEASE_FLAGS
if (-not $?) { throw "Failed to configure Hermes" }
cmake --build ./build --config Release -- -m /p:UseMultiToolTask=true -m /p:EnforceProcessCountAcrossBuilds=true
if (-not $?) { throw "Failed to build Hermes" }
cmake --build ./build_hdb --config Release --target hdb -- -m /p:UseMultiToolTask=true -m /p:EnforceProcessCountAcrossBuilds=true
if (-not $?) { throw "Failed to build Hermes" }
- run:
name: Create CLI tarball
command: |
$Env:PATH += ";$Env:CMAKE_DIR"
cd $Env:HERMES_WS_DIR
Copy-Item -Path "build\bin\Release\hermes.exe" -Destination "staging"
Copy-Item -Path "build\bin\Release\hvm.exe" -Destination "staging"
Copy-Item -Path "build\bin\Release\hbcdump.exe" -Destination "staging"
Copy-Item -Path "build\bin\Release\hermesc.exe" -Destination "staging"
Copy-Item -Path "build_hdb\bin\Release\hdb.exe" -Destination "staging"
cd staging
cmake -E tar zcf ..\output\$Env:TAR_NAME .
- run:
name: Checksum artifacts
command: |
cd $Env:HERMES_WS_DIR\output
$hash = Get-FileHash -Path $Env:TAR_NAME -Algorithm SHA256
Write-Output ($hash.Hash + " " + $Env:TAR_NAME) |
Out-File -Encoding ASCII -FilePath ($Env:TAR_NAME +".sha256")
- store_artifacts:
path: c:\tmp\hermes\output
- persist_to_workspace:
root: c:\tmp\hermes\output
paths:
- .
npm:
docker:
- image: cimg/node:lts
environment:
- YARN: yarnpkg
- TERM: dumb
- DEBIAN_FRONTEND: noninteractive
steps:
- run:
name: Print versions
command: |
node --version
yarn --version
- run:
name: Install certificates required to attach workspace
command: |
sudo apt-get update
sudo apt-get install -y ca-certificates
- attach_workspace:
at: /tmp/hermes/input
- run:
name: Install dependencies and set up
command: |
mkdir -p /tmp/hermes/output
- checkout
- run:
name: Build NPM
command: |
cd npm
cp /tmp/hermes/input/* .
$YARN install
$YARN unpack-builds
$YARN create-npms
- run:
name: Copy artifacts
command: |
cd npm
cp *.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:
- .
emscripten:
docker:
- image: emscripten/emsdk:2.0.9
working_directory: /root
steps:
- run:
name: Install dependencies
command: |
apt update
apt install -y libicu-dev
- checkout:
path: hermes
- run:
name: Build Hermes Compiler
command: |
cmake -S hermes -B build_host_hermesc
cmake --build ./build_host_hermesc --target hermesc -j 4
- run:
name: Build Hermes with Emscripten for Website Playground
environment:
LINKER_FLAGS: -s WASM=1 \
-s ALLOW_MEMORY_GROWTH=0 \
-s TOTAL_MEMORY=33554432 \
-s MODULARIZE=1 \
-s EXPORT_NAME=createHermes \
-s INVOKE_RUN=0 \
-s EXIT_RUNTIME=1 \
-s NODERAWFS=0 \
-s EXTRA_EXPORTED_RUNTIME_METHODS=[callMain,FS]
command: |
echo LINKER_FLAGS: $LINKER_FLAGS
cmake -S hermes -B playground \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXE_LINKER_FLAGS="$LINKER_FLAGS" \
-DCMAKE_TOOLCHAIN_FILE="$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
-DIMPORT_HERMESC="$PWD/build_host_hermesc/ImportHermesc.cmake"
cmake --build ./playground --target hermes -j 4
cmake --build ./playground --target hermesc -j 4
cmake --build ./playground --target emhermesc -j 4
EMHERMESC="$PWD/playground/bin/emhermesc.js" node ./hermes/tools/emhermesc/test.js
- run:
name: Create Playground tarball
environment:
TAR_NAME: hermes-cli-emscripten.tar.gz
command: |
mkdir output staging
cp ./playground/bin/hermes.js ./playground/bin/hermes.wasm staging
tar -C staging -czvf output/${TAR_NAME} .
shasum -a 256 output/${TAR_NAME} > output/${TAR_NAME}.sha256
- store_artifacts:
path: output
- persist_to_workspace:
root: output
paths:
- .
sandbox:
docker:
- image: emscripten/emsdk:3.1.39
environment:
- DEBIAN_FRONTEND: noninteractive
working_directory: /root
steps:
- run:
name: Install dependencies
command: |
apt update
apt install -y libicu-dev tzdata
wget https://github.com/WebAssembly/wabt/releases/download/1.0.33/wabt-1.0.33-ubuntu.tar.gz
tar -xvf ./wabt-1.0.33-ubuntu.tar.gz
- checkout:
path: hermes
- run:
name: Build Hermes with Emscripten
command: |
# Generate the host compiler.
cmake -S hermes -B build_host
cmake --build ./build_host --target hermesc -j 4
# Generate and build the debug artefact.
cmake -S hermes -B build_wasm_dbg \
-DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-DIMPORT_HERMESC=build_host/ImportHermesc.cmake \
-DCMAKE_BUILD_TYPE=Debug -DHERMES_UNICODE_LITE=ON \
-DCMAKE_CXX_FLAGS=-O2 -DCMAKE_C_FLAGS=-O2 \
-DCMAKE_EXE_LINKER_FLAGS="-sALLOW_MEMORY_GROWTH=1 -sSTACK_SIZE=256KB" \
-DHERMES_ENABLE_DEBUGGER=OFF -DHERMES_SLOW_DEBUG=OFF \
-DHERMES_IS_MOBILE_BUILD=ON
cmake --build build_wasm_dbg --target hermesSandboxImpl -j 4
./wabt-1.0.33/bin/wasm2c build_wasm_dbg/API/hermes_sandbox/hermesSandboxImpl.wasm -n hermes \
-o hermes/API/hermes_sandbox/external/hermes_sandbox_impl_dbg_compiled.c --num-outputs 8
# Generate and build the release artefact.
cmake -S hermes -B build_wasm_opt \
-DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-DIMPORT_HERMESC=build_host/ImportHermesc.cmake \
-DCMAKE_BUILD_TYPE=Release -DHERMES_UNICODE_LITE=ON \
-DCMAKE_EXE_LINKER_FLAGS="-sALLOW_MEMORY_GROWTH=1 -sSTACK_SIZE=256KB -g2" \
-DHERMES_ENABLE_DEBUGGER=OFF -DHERMES_IS_MOBILE_BUILD=ON
cmake --build build_wasm_opt --target hermesSandboxImpl -j 4
./wabt-1.0.33/bin/wasm2c build_wasm_opt/API/hermes_sandbox/hermesSandboxImpl.wasm -n hermes \
-o hermes/API/hermes_sandbox/external/hermes_sandbox_impl_opt_compiled.c --num-outputs 8
- run:
name: Build and test with the newly generated sandbox
command: |
cmake -S hermes -B build_dbg -DCMAKE_BUILD_TYPE=Debug
cmake --build build_dbg -j 4
cmake --build build_dbg --target check-hermes -j 4
cmake -S hermes -B build_opt -DCMAKE_BUILD_TYPE=Release
cmake --build build_opt -j 4
cmake --build build_opt --target check-hermes -j 4
test-e2e:
executor:
name: android/android-machine
tag: 2023.06.1
working_directory: /home/circleci
environment:
REACT_NATIVE_OVERRIDE_HERMES_DIR: /home/circleci/hermes
steps:
- node/install:
install-yarn: true
lts: true
- run:
name: Setup dependencies
command: |
(yes | sdkmanager "cmake;3.22.1" --verbose) || true
sudo apt update && sudo apt install -y openjdk-11-jdk
- checkout:
path: hermes
- run:
name: Prepare RNTester
command: |
git clone --depth=1 https://github.com/facebook/react-native
cd react-native
yarn install
echo "console.log('Using Hermes: ' + (global.HermesInternal != null));" >> packages/rn-tester/js/RNTesterApp.android.js
- android/start-emulator-and-run-tests:
post-emulator-launch-assemble-command: ''
run-tests-working-directory: react-native
run-logcat: true
test-command: >-
./gradlew -PreactNativeArchitectures=x86 :packages:rn-tester:android:app:installHermesRelease
&& adb shell am start com.facebook.react.uiapp/.RNTesterActivity
&& timeout 30s adb logcat -e "Using Hermes: true" -m 1
test-e2e-intl:
executor:
name: android/android-machine
tag: 2022.04.1
working_directory: /home/circleci
environment:
HERMES_WS_DIR: /home/circleci
steps:
- checkout:
path: hermes
- run:
name: Setup dependencies
command: |
(yes | sdkmanager "cmake;3.22.1" --verbose) || true
# Check out test262 at a pinned revision to reduce flakiness
git clone https://github.com/tc39/test262
cd test262
git checkout 19da3ca0757248f7595ee09d532bb83dd438f2b5
- run:
name: Build Hermes Compiler
command: |
cmake -S hermes -B ./build -DCMAKE_BUILD_TYPE=Release
cmake --build ./build -j 4 --target hermesc
- android/start-emulator-and-run-tests:
post-emulator-launch-assemble-command: ''
run-tests-working-directory: hermes/android
run-logcat: true
additional-emulator-args: -timezone Europe/Paris -partition-size 2048
additional-avd-args: "-c 2048M"
test-command: ./gradlew :intltest:prepareTests && ./gradlew -Pabis=x86 :intltest:connectedAndroidTest
test-macos-test262:
macos:
xcode: 13.4.1
steps:
- checkout:
path: hermes
- run:
name: Setup dependencies
command: |
brew install cmake ninja
# Check out test262 at a pinned revision to reduce flakiness
git clone https://github.com/tc39/test262
cd test262
git checkout 19da3ca0757248f7595ee09d532bb83dd438f2b5
- run:
name: Run Hermes tests and test262 with Intl
command: |
cmake -S hermes -B build -GNinja -DHERMES_ENABLE_INTL=ON
cmake --build ./build
cmake --build ./build --target check-hermes
python3 hermes/utils/testsuite/run_testsuite.py --test-intl test262/test -b build/bin