Skip to content

Commit

Permalink
Circle CI: Cache Hermes dirs in iOS jobs (#33828)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hramos authored and fortmarek committed May 20, 2022
1 parent 2eaf7de commit 3c634d8
Showing 1 changed file with 41 additions and 13 deletions.
54 changes: 41 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,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:
- v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "sdks/.hermesversion" }}
- steps: << parameters.steps >>
- save_cache:
key: v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "sdks/.hermesversion" }}
paths:
- sdks/hermesc
- sdks/hermes

# -------------------------
# JOBS
# -------------------------
Expand Down Expand Up @@ -423,11 +445,13 @@ jobs:
name: Setup the CocoaPods environment
command: bundle exec pod setup

- with_rntester_pods_cache_span:
- with_hermes_sdk_cache_span:
steps:
- run:
name: Generate RNTesterPods Workspace
command: cd packages/rn-tester && bundle exec pod install --verbose
- with_rntester_pods_cache_span:
steps:
- run:
name: Generate RNTesterPods Workspace
command: cd packages/rn-tester && bundle exec pod install --verbose

# -------------------------
# JOBS: iOS Unit Tests
Expand Down Expand Up @@ -500,11 +524,13 @@ jobs:
name: Setup the CocoaPods environment
command: bundle exec pod setup

- with_rntester_pods_cache_span:
- with_hermes_sdk_cache_span:
steps:
- run:
name: Generate RNTesterPods Workspace
command: cd packages/rn-tester && bundle exec pod install --verbose
- with_rntester_pods_cache_span:
steps:
- run:
name: Generate RNTesterPods Workspace
command: cd packages/rn-tester && bundle exec pod install --verbose

# -------------------------
# Runs iOS unit tests
Expand Down Expand Up @@ -743,11 +769,13 @@ jobs:
- brew_install:
package: cmake

- run:
name: Install CocoaPods dependencies
command: |
rm -rf packages/rn-tester/Pods
cd packages/rn-tester && bundle exec pod install
- with_hermes_sdk_cache_span:
steps:
- run:
name: Install CocoaPods dependencies
command: |
rm -rf packages/rn-tester/Pods
cd packages/rn-tester && bundle exec pod install
# The macOS machine can run out of storage if Hermes is enabled and built from source.
# Since this job does not use the iOS Simulator, deleting it provides a quick way to
Expand Down

0 comments on commit 3c634d8

Please sign in to comment.