Skip to content

Commit 3c634d8

Browse files
hramosfortmarek
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 2eaf7de commit 3c634d8

1 file changed

Lines changed: 41 additions & 13 deletions

File tree

.circleci/config.yml

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,28 @@ commands:
246246
name: Report size of RNTester.app (analysis-bot)
247247
command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" scripts/circleci/report-bundle-size.sh << parameters.platform >> || true
248248

249+
with_hermes_sdk_cache_span:
250+
parameters:
251+
steps:
252+
type: steps
253+
steps:
254+
- run:
255+
name: Setup Hermes cache
256+
command: |
257+
HERMES_VERSION_FILE="sdks/.hermesversion"
258+
if [ ! -f "$HERMES_VERSION_FILE" ]; then
259+
git ls-remote https://github.com/facebook/hermes main | cut -f 1 > $HERMES_VERSION_FILE
260+
fi
261+
- restore_cache:
262+
keys:
263+
- v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "sdks/.hermesversion" }}
264+
- steps: << parameters.steps >>
265+
- save_cache:
266+
key: v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "sdks/.hermesversion" }}
267+
paths:
268+
- sdks/hermesc
269+
- sdks/hermes
270+
249271
# -------------------------
250272
# JOBS
251273
# -------------------------
@@ -423,11 +445,13 @@ jobs:
423445
name: Setup the CocoaPods environment
424446
command: bundle exec pod setup
425447

426-
- with_rntester_pods_cache_span:
448+
- with_hermes_sdk_cache_span:
427449
steps:
428-
- run:
429-
name: Generate RNTesterPods Workspace
430-
command: cd packages/rn-tester && bundle exec pod install --verbose
450+
- with_rntester_pods_cache_span:
451+
steps:
452+
- run:
453+
name: Generate RNTesterPods Workspace
454+
command: cd packages/rn-tester && bundle exec pod install --verbose
431455

432456
# -------------------------
433457
# JOBS: iOS Unit Tests
@@ -500,11 +524,13 @@ jobs:
500524
name: Setup the CocoaPods environment
501525
command: bundle exec pod setup
502526

503-
- with_rntester_pods_cache_span:
527+
- with_hermes_sdk_cache_span:
504528
steps:
505-
- run:
506-
name: Generate RNTesterPods Workspace
507-
command: cd packages/rn-tester && bundle exec pod install --verbose
529+
- with_rntester_pods_cache_span:
530+
steps:
531+
- run:
532+
name: Generate RNTesterPods Workspace
533+
command: cd packages/rn-tester && bundle exec pod install --verbose
508534

509535
# -------------------------
510536
# Runs iOS unit tests
@@ -743,11 +769,13 @@ jobs:
743769
- brew_install:
744770
package: cmake
745771

746-
- run:
747-
name: Install CocoaPods dependencies
748-
command: |
749-
rm -rf packages/rn-tester/Pods
750-
cd packages/rn-tester && bundle exec pod install
772+
- with_hermes_sdk_cache_span:
773+
steps:
774+
- run:
775+
name: Install CocoaPods dependencies
776+
command: |
777+
rm -rf packages/rn-tester/Pods
778+
cd packages/rn-tester && bundle exec pod install
751779
752780
# The macOS machine can run out of storage if Hermes is enabled and built from source.
753781
# Since this job does not use the iOS Simulator, deleting it provides a quick way to

0 commit comments

Comments
 (0)