@@ -30,6 +30,53 @@ references:
30
30
attach_workspace :
31
31
at : *hermes_workspace_root
32
32
33
+ main_only : &main_only
34
+ filters :
35
+ branches :
36
+ only : main
37
+ main_or_stable_only : &main_or_stable_only
38
+ filters :
39
+ branches :
40
+ only :
41
+ - main
42
+ - /0\.[0-9]+[\.[0-9]+]?-stable/
43
+
44
+
45
+ # -------------------------
46
+ # Dependency Anchors
47
+ # -------------------------
48
+ dependency_versions :
49
+ xcode_version : &xcode_version "14.0.1"
50
+ nodelts_image : &nodelts_image "cimg/node:18.12.1"
51
+ nodeprevlts_image : &nodeprevlts_image "cimg/node:16.18.1"
52
+
53
+ # -------------------------
54
+ # Cache Key Anchors
55
+ # -------------------------
56
+ # Anchors for the cache keys
57
+
58
+ cache_keys :
59
+ checkout_cache_key : &checkout_cache_key v5-checkout
60
+ gems_cache_key : &gems_cache_key v1-gems-{{ checksum "Gemfile.lock" }}
61
+ gradle_cache_key : &gradle_cache_key v1-gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "ReactAndroid/gradle.properties" }}
62
+ hermes_workspace_cache_key : &hermes_workspace_cache_key v4-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
63
+ hermes_workspace_debug_cache_key : &hermes_workspace_debug_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
64
+ hermes_workspace_release_cache_key : &hermes_workspace_release_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
65
+ hermes_linux_cache_key : &hermes_linux_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-linux-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
66
+ hermes_windows_cache_key : &hermes_windows_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-windows-{{ checksum "/Users/circleci/project/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
67
+ hermes_tarball_debug_cache_key : &hermes_tarball_debug_cache_key v4-hermes-tarball-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
68
+ hermes_tarball_release_cache_key : &hermes_tarball_release_cache_key v3-hermes-tarball-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
69
+ pods_cache_key : &pods_cache_key v8-pods-{{ .Environment.CIRCLE_JOB }}-{{ checksum "packages/rn-tester/Podfile.lock.bak" }}-{{ checksum "packages/rn-tester/Podfile" }}
70
+ windows_yarn_cache_key : &windows_yarn_cache_key v1-win-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }}
71
+ yarn_cache_key : &yarn_cache_key v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}
72
+
73
+ cache_paths :
74
+ hermes_workspace_macos_cache_paths : &hermes_workspace_macos_cache_paths
75
+ - ~/react-native/sdks/hermes/build_macosx
76
+ - ~/react-native/sdks/hermes/destroot
77
+ hermes_tarball_cache_paths : &hermes_tarball_cache_paths
78
+ - *hermes_tarball_artifacts_dir
79
+
33
80
# -------------------------
34
81
# Filters
35
82
# -------------------------
@@ -246,7 +293,124 @@ commands:
246
293
name : Report size of RNTester.app (analysis-bot)
247
294
command : GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" scripts/circleci/report-bundle-size.sh << parameters.platform >> || true
248
295
249
- with_hermes_sdk_cache_span :
296
+ get_react_native_version :
297
+ steps :
298
+ - run :
299
+ name : Get React Native version
300
+ command : |
301
+ VERSION=$(cat package.json | jq -r '.version')
302
+ # Save the react native version we are building in a file so we can use that file as part of the cache key.
303
+ echo "$VERSION" > /tmp/react-native-version
304
+ echo "React Native Version is $(cat /tmp/react-native-version)"
305
+ HERMES_VERSION="$(cat /tmp/hermes/hermesversion)"
306
+ echo "Hermes commit is $HERMES_VERSION"
307
+
308
+ get_react_native_version_windows :
309
+ steps :
310
+ - run :
311
+ name : Get React Native version on Windows
312
+ command : |
313
+ $VERSION=cat packages/react-native/package.json | jq -r '.version'
314
+ # Save the react native version we are building in a file so we can use that file as part of the cache key.
315
+ echo "$VERSION" > /tmp/react-native-version
316
+ echo "React Native Version is $(cat /tmp/react-native-version)"
317
+ $HERMES_VERSION=cat C:\Users\circleci\project\tmp\hermes\hermesversion
318
+ echo "Hermes commit is $HERMES_VERSION"
319
+
320
+ with_hermes_tarball_cache_span :
321
+ parameters :
322
+ steps :
323
+ type : steps
324
+ set_tarball_path :
325
+ type : boolean
326
+ default : False
327
+ flavor :
328
+ default : " Debug"
329
+ description : The Hermes build type. Must be one of "Debug", "Release".
330
+ type : enum
331
+ enum : ["Debug", "Release"]
332
+ hermes_tarball_artifacts_dir :
333
+ type : string
334
+ default : *hermes_tarball_artifacts_dir
335
+ steps :
336
+ - get_react_native_version
337
+ - when :
338
+ condition :
339
+ equal : [ << parameters.flavor >>, "Debug"]
340
+ steps :
341
+ - restore_cache :
342
+ keys :
343
+ - *hermes_tarball_debug_cache_key
344
+ - when :
345
+ condition :
346
+ equal : [ << parameters.flavor >>, "Release"]
347
+ steps :
348
+ - restore_cache :
349
+ keys :
350
+ - *hermes_tarball_release_cache_key
351
+ - when :
352
+ condition : << parameters.set_tarball_path >>
353
+ steps :
354
+ - run :
355
+ name : Set HERMES_ENGINE_TARBALL_PATH envvar if Hermes tarball is present
356
+ command : |
357
+ HERMES_TARBALL_ARTIFACTS_DIR=<< parameters.hermes_tarball_artifacts_dir >>
358
+ if [ ! -d $HERMES_TARBALL_ARTIFACTS_DIR ]; then
359
+ echo "Hermes tarball artifacts dir not present ($HERMES_TARBALL_ARTIFACTS_DIR). Build Hermes from source."
360
+ exit 0
361
+ fi
362
+
363
+ if [ ! -d ~/react-native ]; then
364
+ echo "No React Native checkout found. Run `checkout` first."
365
+ exit 0
366
+ fi
367
+
368
+ TARBALL_FILENAME=$(node ~/react-native/scripts/hermes/get-tarball-name.js --buildType "<< parameters.flavor >>")
369
+ TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
370
+
371
+ echo "Looking for $TARBALL_FILENAME in $HERMES_TARBALL_ARTIFACTS_DIR"
372
+ echo "$TARBALL_PATH"
373
+
374
+ if [ ! -f $TARBALL_PATH ]; then
375
+ echo "Hermes tarball not present ($TARBALL_PATH). Build Hermes from source."
376
+ exit 0
377
+ fi
378
+
379
+ echo "Found Hermes tarball at $TARBALL_PATH"
380
+ echo "export HERMES_ENGINE_TARBALL_PATH=$TARBALL_PATH" >> $BASH_ENV
381
+ - run :
382
+ name : Print Hermes version
383
+ command : |
384
+ HERMES_TARBALL_ARTIFACTS_DIR=<< parameters.hermes_tarball_artifacts_dir >>
385
+ TARBALL_FILENAME=$(node ~/react-native/scripts/hermes/get-tarball-name.js --buildType "<< parameters.flavor >>")
386
+ TARBALL_PATH=$HERMES_TARBALL_ARTIFACTS_DIR/$TARBALL_FILENAME
387
+ if [[ -e $TARBALL_PATH ]]; then
388
+ tar -xf $TARBALL_PATH
389
+ echo 'print(HermesInternal?.getRuntimeProperties?.()["OSS Release Version"])' > test.js
390
+ ./destroot/bin/hermes test.js
391
+ rm test.js
392
+ rm -rf destroot
393
+ else
394
+ echo 'No Hermes tarball found.'
395
+ fi
396
+ - steps : << parameters.steps >>
397
+ - when :
398
+ condition :
399
+ equal : [ << parameters.flavor >>, "Debug"]
400
+ steps :
401
+ - save_cache :
402
+ key : *hermes_tarball_debug_cache_key
403
+ paths : *hermes_tarball_cache_paths
404
+ - when :
405
+ condition :
406
+ equal : [ << parameters.flavor >>, "Release"]
407
+ steps :
408
+ - save_cache :
409
+ key : *hermes_tarball_release_cache_key
410
+ paths : *hermes_tarball_cache_paths
411
+
412
+ with_hermesc_span :
413
+ description : " Makes hermesc available to the provided steps, if hermesc is present."
250
414
parameters :
251
415
steps :
252
416
type : steps
@@ -618,7 +782,12 @@ jobs:
618
782
command : ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=$BUILD_THREADS
619
783
no_output_timeout : 30m
620
784
621
- # Build JavaScript Bundle for instrumentation tests
785
+ - store_test_results :
786
+ path : ~/react-native/ReactAndroid/build/test-results
787
+
788
+ - store_test_results :
789
+ path : ~/react-native/packages/react-native-gradle-plugin/build/test-results
790
+
622
791
- run :
623
792
name : Build JavaScript Bundle
624
793
command : node cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
@@ -955,17 +1124,18 @@ jobs:
955
1124
docker :
956
1125
- image : debian:bullseye
957
1126
resource_class : " xlarge"
958
- working_directory : /root
959
1127
steps :
1128
+ - checkout_code_with_cache
960
1129
- run :
961
1130
name : Install dependencies
962
1131
command : |
963
1132
apt update
964
1133
apt install -y git openssh-client cmake build-essential \
965
- libreadline-dev libicu-dev zip python3
1134
+ libreadline-dev libicu-dev jq zip python3
966
1135
- *attach_hermes_workspace
1136
+ - get_react_native_version
967
1137
- restore_cache :
968
- key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
1138
+ key : *hermes_linux_cache_key
969
1139
- run :
970
1140
name : Set up workspace
971
1141
command : |
@@ -984,7 +1154,7 @@ jobs:
984
1154
cp /tmp/hermes/build/bin/hermesc /tmp/hermes/linux64-bin/.
985
1155
fi
986
1156
- save_cache :
987
- key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
1157
+ key : *hermes_linux_cache_key
988
1158
paths :
989
1159
- /tmp/hermes/linux64-bin/
990
1160
- /tmp/hermes/hermes/destroot/
@@ -1065,7 +1235,9 @@ jobs:
1065
1235
- MSBUILD_DIR : ' C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
1066
1236
- CMAKE_DIR : ' C:\Program Files\CMake\bin'
1067
1237
steps :
1238
+ - checkout_code_with_cache
1068
1239
- *attach_hermes_workspace
1240
+ - get_react_native_version_windows
1069
1241
- restore_cache :
1070
1242
key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "tmp/hermes/hermesversion" }}
1071
1243
- run :
0 commit comments