Circle CI: Cache Hermes dirs in iOS jobs (#33828)

Summary:
Avoid re-building Hermes if a cache hit is found for the required Hermes version.

Cache sdks/hermes and sdks/hermesc in Circle CI iOS jobs: `test_ios_rntester`, `build_ios`, and `test_ios`.

`test_ios_rntester` "Install CocoaPod Dependencies" step reduced from 37m40s to 3m35s.

`test_ios` "Generate RNTesterPods workspace" step reduced from 36m54s to 1m34s.

Pull Request resolved: https://github.com/facebook/react-native/pull/33828

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36365596

fbshipit-source-id: b5b6fe639f18b1724f80ab61c2262659c4987ff6
This commit is contained in:
Héctor Ramos 2022-05-13 12:51:09 -07:00 коммит произвёл Facebook GitHub Bot
Родитель e2dd2e2a6e
Коммит 12f6081865
1 изменённых файлов: 42 добавлений и 13 удалений

Просмотреть файл

@ -40,6 +40,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_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" }}
@ -251,6 +252,28 @@ commands:
name: Report size of RNTester.app (analysis-bot)
command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" scripts/circleci/report-bundle-size.sh << parameters.platform >> || true
with_hermes_sdk_cache_span:
parameters:
steps:
type: steps
steps:
- 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
fi
- restore_cache:
keys:
- *hermes_sdk_cache_key
- steps: << parameters.steps >>
- save_cache:
key: *hermes_sdk_cache_key
paths:
- sdks/hermesc
- sdks/hermes
# -------------------------
# JOBS
# -------------------------
@ -426,6 +449,8 @@ jobs:
name: Setup the CocoaPods environment
command: bundle exec pod setup
- with_hermes_sdk_cache_span:
steps:
- with_rntester_pods_cache_span:
steps:
- run:
@ -503,6 +528,8 @@ jobs:
name: Setup the CocoaPods environment
command: bundle exec pod setup
- with_hermes_sdk_cache_span:
steps:
- with_rntester_pods_cache_span:
steps:
- run:
@ -752,6 +779,8 @@ jobs:
- brew_install:
package: cmake
- with_hermes_sdk_cache_span:
steps:
- run:
name: Install CocoaPods dependencies
command: |