forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify CircleCI Android build (facebook#731)
Summary: Simplify the Android CircleCI build by, including switching to a recent machine executor. By using a machine executor, we also no longer need the workaround to limit the number of cores `ninja` uses. Pull Request resolved: facebook#731 Reviewed By: mattbfb Differential Revision: D42627991 Pulled By: neildhar fbshipit-source-id: 7fabb4f0125f16f464e86793182f0bc065f3a124
- Loading branch information
1 parent
03f2dff
commit 5a917ca
Showing
1 changed file
with
19 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,8 @@ | ||
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] | ||
android: circleci/android@1.0.3 | ||
android: circleci/android@2.0.3 | ||
node: circleci/[email protected] | ||
|
||
workflows: | ||
|
@@ -61,59 +51,48 @@ apple_defaults: &apple_defaults | |
jobs: | ||
android: | ||
executor: | ||
name: android/android | ||
sdk-version: '28' | ||
variant: ndk | ||
name: android/android-machine | ||
tag: 2022.04.1 | ||
working_directory: /home/circleci | ||
environment: | ||
- HERMES_WS_DIR: /tmp/hermes | ||
- TERM: dumb | ||
- DEBIAN_FRONTEND: noninteractive | ||
HERMES_WS_DIR: /home/circleci | ||
steps: | ||
- checkout | ||
- run: | ||
name: Set up workspace and install dependencies | ||
command: | | ||
yes | sdkmanager "cmake;3.18.1" & | ||
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.18.1/bin/ninja | ||
sudo apt update && sudo apt install -y libicu-dev | ||
- checkout: | ||
path: hermes | ||
- run: | ||
name: Build Hermes Compiler | ||
command: | | ||
cd "$HERMES_WS_DIR" | ||
cmake -S hermes -B build -G Ninja -DCMAKE_BUILD_TYPE=Release | ||
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 | ||
cmake --build ./build --target hermesc -j 4 | ||
- 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 | ||
cd hermes/android | ||
./gradlew githubRelease | ||
- run: | ||
name: Copy artifacts | ||
command: | | ||
cd "$HERMES_WS_DIR" | ||
cp "build_android/distributions"/hermes-runtime-android-*.tar.gz "output" | ||
mkdir output | ||
cp build_android/distributions/hermes-runtime-android-*.tar.gz output | ||
- run: | ||
name: Checksum artifacts | ||
command: | | ||
cd "$HERMES_WS_DIR/output" | ||
cd output | ||
for file in * | ||
do | ||
sha256sum "$file" > "$file.sha256" | ||
done | ||
- store_artifacts: | ||
path: /tmp/hermes/output/ | ||
path: output | ||
- persist_to_workspace: | ||
root: /tmp/hermes/output/ | ||
root: output | ||
paths: | ||
- . | ||
|
||
|
@@ -552,6 +531,7 @@ jobs: | |
test-e2e: | ||
executor: | ||
name: android/android-machine | ||
tag: 2022.04.1 | ||
working_directory: /home/circleci | ||
environment: | ||
REACT_NATIVE_OVERRIDE_HERMES_DIR: /home/circleci/hermes | ||
|
@@ -584,6 +564,7 @@ jobs: | |
test-e2e-intl: | ||
executor: | ||
name: android/android-machine | ||
tag: 2022.04.1 | ||
working_directory: /home/circleci | ||
environment: | ||
HERMES_WS_DIR: /home/circleci | ||
|