Skip to content

Commit 12f6081

Browse files
hramosfacebook-github-bot
authored andcommitted
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: #33828 Changelog: [Internal] Reviewed By: cortinico Differential Revision: D36365596 fbshipit-source-id: b5b6fe639f18b1724f80ab61c2262659c4987ff6
1 parent e2dd2e2 commit 12f6081

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

.circleci/config.yml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ references:
4040
gems_cache_key: &gems_cache_key v1-gems-{{ checksum "Gemfile.lock" }}
4141
gradle_cache_key: &gradle_cache_key v1-gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "ReactAndroid/gradle.properties" }}
4242
hermes_cache_key: &hermes_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
43+
hermes_sdk_cache_key: &hermes_sdk_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "sdks/.hermesversion" }}
4344
hermes_windows_cache_key: &hermes_windows_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "tmp/hermes/hermesversion" }}
4445
pods_cache_key: &pods_cache_key v6-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }}
4546
windows_yarn_cache_key: &windows_yarn_cache_key v1-win-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
@@ -251,6 +252,28 @@ commands:
251252
name: Report size of RNTester.app (analysis-bot)
252253
command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" scripts/circleci/report-bundle-size.sh << parameters.platform >> || true
253254

255+
with_hermes_sdk_cache_span:
256+
parameters:
257+
steps:
258+
type: steps
259+
steps:
260+
- run:
261+
name: Setup Hermes cache
262+
command: |
263+
HERMES_VERSION_FILE="sdks/.hermesversion"
264+
if [ ! -f "$HERMES_VERSION_FILE" ]; then
265+
git ls-remote https://github.com/facebook/hermes main | cut -f 1 > $HERMES_VERSION_FILE
266+
fi
267+
- restore_cache:
268+
keys:
269+
- *hermes_sdk_cache_key
270+
- steps: << parameters.steps >>
271+
- save_cache:
272+
key: *hermes_sdk_cache_key
273+
paths:
274+
- sdks/hermesc
275+
- sdks/hermes
276+
254277
# -------------------------
255278
# JOBS
256279
# -------------------------
@@ -426,11 +449,13 @@ jobs:
426449
name: Setup the CocoaPods environment
427450
command: bundle exec pod setup
428451

429-
- with_rntester_pods_cache_span:
452+
- with_hermes_sdk_cache_span:
430453
steps:
431-
- run:
432-
name: Generate RNTesterPods Workspace
433-
command: cd packages/rn-tester && bundle exec pod install --verbose
454+
- with_rntester_pods_cache_span:
455+
steps:
456+
- run:
457+
name: Generate RNTesterPods Workspace
458+
command: cd packages/rn-tester && bundle exec pod install --verbose
434459

435460
# -------------------------
436461
# JOBS: iOS Unit Tests
@@ -503,11 +528,13 @@ jobs:
503528
name: Setup the CocoaPods environment
504529
command: bundle exec pod setup
505530

506-
- with_rntester_pods_cache_span:
531+
- with_hermes_sdk_cache_span:
507532
steps:
508-
- run:
509-
name: Generate RNTesterPods Workspace
510-
command: cd packages/rn-tester && bundle exec pod install --verbose
533+
- with_rntester_pods_cache_span:
534+
steps:
535+
- run:
536+
name: Generate RNTesterPods Workspace
537+
command: cd packages/rn-tester && bundle exec pod install --verbose
511538

512539
# -------------------------
513540
# Runs iOS unit tests
@@ -752,11 +779,13 @@ jobs:
752779
- brew_install:
753780
package: cmake
754781

755-
- run:
756-
name: Install CocoaPods dependencies
757-
command: |
758-
rm -rf packages/rn-tester/Pods
759-
cd packages/rn-tester && bundle exec pod install
782+
- with_hermes_sdk_cache_span:
783+
steps:
784+
- run:
785+
name: Install CocoaPods dependencies
786+
command: |
787+
rm -rf packages/rn-tester/Pods
788+
cd packages/rn-tester && bundle exec pod install
760789
761790
- run:
762791
name: Build RNTester

0 commit comments

Comments
 (0)