From 8e80dc844cde76c91aac1af886cb0fb7c03ab704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Mon, 23 May 2022 12:14:29 -0700 Subject: [PATCH] Circle CI: Build Hermes apple runtime artifacts on CI (#33876) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/33876 WIP. Published so we can export and test on CI. These two jobs can likely be merged onto the existing build_hermesc_macos job. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D36538847 fbshipit-source-id: e52c39ccfe652e70c54fd4892513c0060c3f021d --- .circleci/config.yml | 67 +++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3c3c3fce637..aba87bae8d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,7 +41,7 @@ references: gems_cache_key: &gems_cache_key v1-gems-{{ checksum "Gemfile.lock" }} gradle_cache_key: &gradle_cache_key v1-gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "ReactAndroid/gradle.properties" }} hermes_cache_key: &hermes_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }} - hermes_sdk_cache_key: &hermes_sdk_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "sdks/.hermesversion" }} + hermes_sdk_cache_key: &hermes_sdk_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "sdks/.hermes-cache-key-file" }} hermes_windows_cache_key: &hermes_windows_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "tmp/hermes/hermesversion" }} pods_cache_key: &pods_cache_key v6-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }} windows_yarn_cache_key: &windows_yarn_cache_key v1-win-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }} @@ -278,9 +278,9 @@ commands: - run: name: Setup Hermes cache command: | - HERMES_VERSION_FILE="sdks/.hermesversion" - if [ ! -f "$HERMES_VERSION_FILE" ]; then - git ls-remote https://github.com/facebook/hermes main | cut -f 1 > $HERMES_VERSION_FILE + HERMES_CACHE_KEY_FILE="sdks/.hermes-cache-key-file" + if [ ! -f "$HERMES_CACHE_KEY_FILE" ]; then + git ls-remote https://github.com/facebook/hermes main | cut -f 1 > $HERMES_CACHE_KEY_FILE fi - restore_cache: keys: @@ -939,7 +939,7 @@ jobs: paths: - linux64-bin - build_hermesc_macos: + build_hermes_macos: executor: reactnativeios environment: - HERMES_WS_DIR: *hermes_workspace_root @@ -952,28 +952,46 @@ jobs: name: Set up workspace command: | mkdir -p /tmp/hermes/osx-bin - cp ~/react-native/sdks/hermes-engine/utils/* "$HERMES_WS_DIR/hermes/utils/." + mkdir -p ~/react-native/sdks/hermes + cp -r $HERMES_WS_DIR/hermes/* ~/react-native/sdks/hermes/. - run: name: Install dependencies command: | brew install cmake - run: - name: Build HermesC for macOS + name: Build the Hermes iOS frameworks command: | - if [ -f /tmp/hermes/osx-bin/hermesc ]; then - echo 'Skipping; Clean "/tmp/hermes/osx-bin" to rebuild.' - else - cd "$HERMES_WS_DIR/hermes" - ./utils/build-mac-framework.sh - cp build_macosx/bin/hermesc /tmp/hermes/osx-bin/. - fi + cd ~/react-native/sdks/hermes + ./utils/build-ios-framework.sh + - run: + name: Build the Hermes Mac frameworks + command: | + cd ~/react-native/sdks/hermes + ./utils/build-mac-framework.sh + cp build_macosx/bin/hermesc /tmp/hermes/osx-bin/. + - run: + name: Package the Hermes Apple frameworks + command: | + cd ~/react-native/sdks/hermes + . ./utils/build-apple-framework.sh + + mkdir -p /tmp/cocoapods-package-root/destroot + mkdir -p /tmp/hermes/output + 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 . - save_cache: key: *hermes_cache_key paths: - - /tmp/hermes/osx-bin/ - - /tmp/hermes/hermes/destroot/ - - /tmp/hermes/hermes/build_host_hermesc/ - - /tmp/hermes/hermes/build_macosx/ + - ~/react-native/hermes/build_host_hermesc + - ~/react-native/hermes/build_iphoneos + - ~/react-native/hermes/build_catalyst + - ~/react-native/hermes/build_iphonesimulator + - ~/react-native/hermes/build_macosx + - ~/react-native/hermes/destroot + - store_artifacts: + path: /tmp/hermes/output/ - store_artifacts: path: /tmp/hermes/osx-bin/ - persist_to_workspace: @@ -1225,7 +1243,7 @@ workflows: - build_hermesc_linux: requires: - prepare_hermes_workspace - - build_hermesc_macos: + - build_hermes_macos: requires: - prepare_hermes_workspace - build_hermesc_windows: @@ -1236,7 +1254,7 @@ workflows: publish_npm_args: --dry-run requires: - build_hermesc_linux - - build_hermesc_macos + - build_hermes_macos - build_hermesc_windows - test_js: run_disabled_tests: false @@ -1283,7 +1301,7 @@ workflows: filters: *only_release_tags requires: - prepare_hermes_workspace - - build_hermesc_macos: + - build_hermes_macos: filters: *only_release_tags requires: - prepare_hermes_workspace @@ -1299,7 +1317,7 @@ workflows: filters: *only_release_tags requires: - build_hermesc_linux - - build_hermesc_macos + - build_hermes_macos - build_hermesc_windows analysis: @@ -1330,16 +1348,15 @@ workflows: - build_hermesc_linux: requires: - prepare_hermes_workspace - - build_hermesc_macos: + - build_hermes_macos: requires: - prepare_hermes_workspace - build_hermesc_windows: requires: - prepare_hermes_workspace - - build_npm_package: publish_npm_args: --nightly requires: - build_hermesc_linux - - build_hermesc_macos + - build_hermes_macos - build_hermesc_windows