@@ -36,16 +36,16 @@ aliases:
3636
3737 - &restore-cache-gradle
3838 keys :
39- - v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
39+ - v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
4040 # Fallback in case checksum fails
41- - v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-
42- - v1-gradle-{{ arch }}-{{ .Branch }}-
41+ - v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-
42+ - v1-gradle-{{ .Branch }}-
4343 # Fallback in case this is a first-time run on a fork
44- - v1-gradle-{{ arch }}- master-
44+ - v1-gradle-master-
4545 - &save-cache-gradle
4646 paths :
4747 - ~/.gradle
48- key : v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
48+ key : v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
4949
5050 - &restore-cache-apt
5151 keys :
@@ -59,20 +59,21 @@ aliases:
5959
6060 - &restore-cache-ndk
6161 keys :
62- - v3-android-ndk-{{ arch }}- r10e-{{ checksum "scripts/android-setup.sh" }}
62+ - v3-android-ndk-r10e-{{ checksum "scripts/android-setup.sh" }}
6363 - &save-cache-ndk
6464 paths :
6565 - /opt/ndk
66- key : v3-android-ndk-{{ arch }}- r10e-{{ checksum "scripts/android-setup.sh" }}
66+ key : v3-android-ndk-r10e-{{ checksum "scripts/android-setup.sh" }}
6767
68- - &restore-cache-buck
68+ - &restore-cache-downloads- buck
6969 keys :
70- - v3-buck-{{ arch }}-v2018.06.25.01
71- - &save-cache-buck
70+ - v3-buck-v2018.06.25.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}}
71+ - v3-buck-v2018.06.25.01-
72+ - &save-cache-downloads-buck
7273 paths :
7374 - ~/buck
7475 - ~/okbuck
75- key : v3-buck-{{ arch }}- v2018.06.25.01
76+ key : v3-buck-v2018.06.25.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}
7677
7778 - &restore-cache-watchman
7879 keys :
@@ -82,16 +83,16 @@ aliases:
8283 - ~/watchman
8384 key : v1-watchman-{{ arch }}-v4.9.0
8485
85- - &restore-cache-gradle- downloads
86+ - &restore-cache-downloads-gradle
8687 keys :
87- - v1-gradle-{{ arch }}-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
88- - v1-gradle-{{ arch }}-
89- - &save-cache-gradle- downloads
88+ - v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
89+ - v1-gradle-
90+ - &save-cache-downloads-gradle
9091 paths :
9192 - ~/.gradle
9293 - ReactAndroid/build/downloads
9394 - ReactAndroid/build/third-party-ndk
94- key : v1-gradle-{{ arch }}-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
95+ key : v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
9596
9697 # Branch Filtering
9798 - &filter-only-master-stable
@@ -222,10 +223,14 @@ aliases:
222223 ./scripts/circleci/check_cache.sh
223224 when : always
224225
225- - &gradle- download-deps
226- name : Download C++ Dependencies
226+ - &download-dependencies-gradle
227+ name : Download Dependencies Using Gradle
227228 command : ./scripts/circleci/gradle_download_deps.sh
228229
230+ - &download-dependencies-buck
231+ name : Download Dependencies Using Buck
232+ command : ./scripts/circleci/buck_fetch.sh
233+
229234 - &build-android-app
230235 name : Build Android App
231236 command : |
@@ -266,6 +271,10 @@ aliases:
266271 fi
267272 source scripts/android-setup.sh && NO_BUCKD=1 retry3 timeout 300 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
268273
274+ - &build-android-rntester-app
275+ name : Build Android RNTester App
276+ command : ./gradlew RNTester:android:app:assembleRelease -Pjobs=$BUILD_THREADS
277+
269278 - &collect-android-test-results
270279 name : Collect Test Results
271280 command : |
@@ -472,59 +481,6 @@ jobs:
472481 - store_test_results :
473482 path : ~/react-native/reports/junit
474483
475- # Publishes new version onto npm
476- publish_npm_package :
477- << : *android_defaults
478- steps :
479- # Checkout code so that we can work with `git` in publish.js
480- - checkout
481-
482- # Configure Android SDK and related dependencies
483- - run : *configure-android-path
484- - run : *install-android-build-dependencies
485-
486- - restore-cache : *restore-cache-android-packages
487- - run : *install-android-packages
488- - save-cache : *save-cache-android-packages
489-
490- # Install Android NDK
491- - run : *create-ndk-directory
492- - restore-cache : *restore-cache-ndk
493- - run : *install-ndk
494- - save-cache : *save-cache-ndk
495-
496- # Fetch dependencies using BUCK
497- - restore-cache : *restore-cache-buck
498- - run : *install-buck
499- - save-cache : *save-cache-buck
500-
501- - run : buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
502- - run : buck fetch ReactAndroid/src/main/java/com/facebook/react
503- - run : buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
504- - run : buck fetch ReactAndroid/src/test/...
505- - run : buck fetch ReactAndroid/src/androidTest/...
506-
507- - restore-cache : *restore-cache-gradle-downloads
508- - run : *gradle-download-deps
509- - save-cache : *save-cache-gradle-downloads
510-
511- - restore-cache : *restore-yarn-cache
512- - run : *yarn
513- - save-cache : *save-yarn-cache
514-
515- - run :
516- name : Publish React Native Package
517- command : |
518- if [ -z "$CIRCLE_PULL_REQUEST" ]; then
519- echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
520- git config --global user.email "[email protected] " 521- git config --global user.name "npm Deployment Script"
522- echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
523- node ./scripts/publish-npm.js
524- else
525- echo "Skipping deploy."
526- fi
527-
528484 # Set up an Android environment for downstream jobs
529485 test_android :
530486 << : *android_defaults
@@ -542,6 +498,7 @@ jobs:
542498 - run : *install-android-packages
543499 - save-cache : *save-cache-android-packages
544500
501+ # Validate Android SDK installation and packages
545502 - run : *validate-android-sdk
546503
547504 # Starting emulator in advance as it takes some time to boot.
@@ -556,22 +513,21 @@ jobs:
556513 - run : *install-ndk
557514 - save-cache : *save-cache-ndk
558515
559- # Fetch dependencies using BUCK
560- - restore-cache : *restore-cache-buck
516+ # Install Buck
517+ - restore-cache : *restore-cache-downloads- buck
561518 - run : *install-buck
562- - save-cache : *save-cache-buck
519+ - save-cache : *save-cache-downloads- buck
563520
521+ # Validate Android test environment (including Buck)
564522 - run : *validate-android-test-env
565523
566- - run : buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
567- - run : buck fetch ReactAndroid/src/main/java/com/facebook/react
568- - run : buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
569- - run : buck fetch ReactAndroid/src/test/...
570- - run : buck fetch ReactAndroid/src/androidTest/...
524+ # Download dependencies using Buck
525+ - run : *download-dependencies-buck
571526
572- - restore-cache : *restore-cache-gradle-downloads
573- - run : *gradle-download-deps
574- - save-cache : *save-cache-gradle-downloads
527+ # Download dependencies using Gradle
528+ - restore-cache : *restore-cache-downloads-gradle
529+ - run : *download-dependencies-gradle
530+ - save-cache : *save-cache-downloads-gradle
575531
576532 # Build and compile
577533 - run : *build-android-app
@@ -586,12 +542,7 @@ jobs:
586542 # Test Suite
587543 - run : *run-android-unit-tests
588544 - run : *run-android-instrumentation-tests
589-
590- # Build Android RNTester
591- - run :
592- name : Build Android RNTester
593- command : |
594- ./gradlew RNTester:android:app:assembleRelease -Pjobs=$BUILD_THREADS
545+ - run : *build-android-rntester-app
595546
596547 # Run Android end-to-end tests
597548 # Disabled
@@ -646,6 +597,47 @@ jobs:
646597 fi
647598 when : always
648599
600+ # Publishes new version onto npm
601+ # Only works on stable branches when a properly tagged commit is pushed
602+ publish_npm_package :
603+ << : *android_defaults
604+ steps :
605+ - attach_workspace :
606+ at : ~/react-native
607+
608+ # Configure Android SDK and related dependencies
609+ - run : *configure-android-path
610+ - run : *install-android-build-dependencies
611+
612+ - restore-cache : *restore-cache-android-packages
613+ - run : *install-android-packages
614+
615+ # Install Android NDK
616+ - run : *create-ndk-directory
617+ - restore-cache : *restore-cache-ndk
618+ - run : *install-ndk
619+
620+ # Fetch dependencies using Buck
621+ - restore-cache : *restore-cache-downloads-buck
622+ - run : *install-buck
623+ - run : *download-dependencies-buck
624+
625+ # Fetch dependencies using Gradle
626+ - restore-cache : *restore-cache-downloads-gradle
627+ - run : *download-dependencies-gradle
628+
629+ - restore-cache : *restore-yarn-cache
630+ - run : *yarn
631+
632+ - run :
633+ name : Publish React Native Package
634+ command : |
635+ echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
636+ git config --global user.email "[email protected] " 637+ git config --global user.name "npm Deployment Script"
638+ echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
639+ node ./scripts/publish-npm.js
640+
649641# Workflows enables us to run multiple jobs in parallel
650642workflows :
651643 version : 2
0 commit comments