2017-09-21 20:34:02 +00:00
|
|
|
aliases:
|
2018-02-01 01:08:06 +00:00
|
|
|
# Cache Management
|
2018-03-27 21:31:42 +00:00
|
|
|
- &restore-cache-yarn
|
2017-09-21 20:34:02 +00:00
|
|
|
keys:
|
2018-03-27 21:31:42 +00:00
|
|
|
- v1-yarn-{{ arch }}-{{ checksum "package.json" }}
|
|
|
|
- v1-yarn-{{ arch }}-
|
|
|
|
- &save-cache-yarn
|
2017-09-21 20:34:02 +00:00
|
|
|
paths:
|
|
|
|
- node_modules
|
2018-01-30 21:49:01 +00:00
|
|
|
- ~/.cache/yarn
|
2018-03-27 21:31:42 +00:00
|
|
|
key: v1-yarn-{{ arch }}-{{ checksum "package.json" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
- &restore-cache-analysis
|
2017-09-21 20:34:02 +00:00
|
|
|
keys:
|
2018-03-27 21:31:42 +00:00
|
|
|
- v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
|
|
|
|
- v1-analysis-dependencies-{{ arch }}-
|
2017-10-16 18:52:48 +00:00
|
|
|
- &save-cache-analysis
|
2017-09-21 20:34:02 +00:00
|
|
|
paths:
|
2018-02-01 00:22:27 +00:00
|
|
|
- bots/node_modules
|
2017-10-16 18:52:48 +00:00
|
|
|
- node_modules
|
2018-03-27 21:31:42 +00:00
|
|
|
key: v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
|
|
|
|
- &restore-cache-android-packages
|
|
|
|
keys:
|
2018-03-27 21:31:42 +00:00
|
|
|
- v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-{{ checksum "scripts/circle-ci-android-setup.sh" }}
|
|
|
|
- v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-
|
2017-09-21 20:34:02 +00:00
|
|
|
- &save-cache-android-packages
|
|
|
|
paths:
|
2017-12-22 19:07:48 +00:00
|
|
|
- /opt/android/sdk
|
2018-03-27 21:31:42 +00:00
|
|
|
key: v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-{{ checksum "scripts/circle-ci-android-setup.sh" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2018-03-27 16:15:54 +00:00
|
|
|
- &restore-cache-gradle
|
|
|
|
keys:
|
|
|
|
- v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
|
|
|
# Fallback in case checksum fails
|
|
|
|
- v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-
|
|
|
|
- v1-gradle-{{ arch }}-{{ .Branch }}-
|
|
|
|
# Fallback in case this is a first-time run on a fork
|
|
|
|
- v1-gradle-{{ arch }}-master-
|
|
|
|
- &save-cache-gradle
|
|
|
|
paths:
|
|
|
|
- ~/.gradle
|
|
|
|
key: v1-gradle-{{ arch }}-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
|
|
|
|
|
|
|
|
- &restore-cache-apt
|
|
|
|
keys:
|
|
|
|
- v1-apt-{{ arch }}-{{ .Branch }}-{{ checksum "scripts/circleci/apt-get-android-deps.sh" }}
|
|
|
|
# Fallback in case checksum fails
|
|
|
|
- v1-apt-{{ arch }}-{{ .Branch }}-
|
|
|
|
# Fallback in case this is a first-time run on a fork
|
|
|
|
- v1-apt-{{ arch }}-master-
|
|
|
|
- &save-cache-apt
|
|
|
|
paths:
|
|
|
|
- ~/vendor/apt
|
|
|
|
key: v1-apt-{{ arch }}-{{ .Branch }}-{{ checksum "scripts/circleci/apt-get-android-deps.sh" }}
|
|
|
|
|
2017-09-21 20:34:02 +00:00
|
|
|
- &restore-cache-ndk
|
|
|
|
keys:
|
2018-03-28 19:53:08 +00:00
|
|
|
- v3-android-ndk-{{ arch }}-r10e-{{ checksum "scripts/circle-ci-android-setup.sh" }}
|
|
|
|
- v3-android-ndk-{{ arch }}-r10e-
|
2017-09-21 20:34:02 +00:00
|
|
|
- &save-cache-ndk
|
|
|
|
paths:
|
|
|
|
- /opt/ndk
|
2018-03-28 19:53:08 +00:00
|
|
|
key: v3-android-ndk-{{ arch }}-r10e-{{ checksum "scripts/circle-ci-android-setup.sh" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
|
|
|
|
- &restore-cache-buck
|
|
|
|
keys:
|
2018-03-28 19:53:08 +00:00
|
|
|
- v3-buck-{{ arch }}-v2018.02.16.01
|
2017-09-21 20:34:02 +00:00
|
|
|
- &save-cache-buck
|
|
|
|
paths:
|
|
|
|
- ~/buck
|
2018-03-28 19:53:08 +00:00
|
|
|
- ~/okbuck
|
|
|
|
key: v3-buck-{{ arch }}-v2018.02.16.01
|
2017-09-21 20:34:02 +00:00
|
|
|
|
|
|
|
- &restore-cache-watchman
|
|
|
|
keys:
|
2017-10-13 23:11:53 +00:00
|
|
|
- v1-watchman-{{ arch }}-v4.9.0
|
2017-09-21 20:34:02 +00:00
|
|
|
- &save-cache-watchman
|
|
|
|
paths:
|
|
|
|
- ~/watchman
|
2017-10-13 23:11:53 +00:00
|
|
|
key: v1-watchman-{{ arch }}-v4.9.0
|
|
|
|
|
2018-03-27 21:31:42 +00:00
|
|
|
- &restore-cache-gradle-downloads
|
|
|
|
keys:
|
|
|
|
- v1-gradle-{{ arch }}-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
|
|
|
- v1-gradle-{{ arch }}-
|
|
|
|
- &save-cache-gradle-downloads
|
|
|
|
paths:
|
|
|
|
- ~/.gradle
|
|
|
|
- ReactAndroid/build/downloads
|
|
|
|
- ReactAndroid/build/third-party-ndk
|
|
|
|
key: v1-gradle-{{ arch }}-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
|
|
|
|
2018-02-01 01:08:06 +00:00
|
|
|
# Branch Filtering
|
|
|
|
- &filter-only-master-stable
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /.*-stable/
|
|
|
|
- master
|
|
|
|
|
|
|
|
- &filter-only-stable
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /.*-stable/
|
|
|
|
|
|
|
|
- &filter-ignore-gh-pages
|
|
|
|
branches:
|
|
|
|
ignore: gh-pages
|
|
|
|
|
|
|
|
- &filter-ignore-master-stable
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- master
|
|
|
|
- /.*-stable/
|
|
|
|
- gh-pages
|
|
|
|
|
|
|
|
# Dependency Management
|
|
|
|
- &install-ndk
|
2018-03-10 01:06:51 +00:00
|
|
|
name: Install Android NDK
|
|
|
|
command: source scripts/circle-ci-android-setup.sh && getAndroidNDK
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-01-30 21:49:01 +00:00
|
|
|
- &yarn
|
|
|
|
|
|
|
|
|
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
|
|
|
|
|
|
|
- &install-yarn
|
2018-03-27 16:15:54 +00:00
|
|
|
name: Install Yarn
|
|
|
|
command: |
|
2018-01-30 21:49:01 +00:00
|
|
|
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
|
|
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
|
|
|
sudo apt-get update && sudo apt-get install yarn
|
|
|
|
|
2017-10-13 23:11:53 +00:00
|
|
|
- &install-node-dependencies
|
|
|
|
|
|
|
|
|
npm install --no-package-lock --no-spin --no-progress
|
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
- &install-buck
|
2018-03-27 16:15:54 +00:00
|
|
|
name: Install BUCK
|
|
|
|
command: |
|
2017-11-27 18:54:22 +00:00
|
|
|
if [[ ! -e ~/buck ]]; then
|
2018-02-16 21:35:43 +00:00
|
|
|
git clone https://github.com/facebook/buck.git ~/buck --branch v2018.02.16.01 --depth=1
|
2017-11-27 18:54:22 +00:00
|
|
|
fi
|
|
|
|
cd ~/buck && ant
|
|
|
|
buck --version
|
2018-03-28 19:53:08 +00:00
|
|
|
# Install related tooling
|
|
|
|
if [[ ! -e ~/okbuck ]]; then
|
|
|
|
git clone https://github.com/uber/okbuck.git ~/okbuck --depth=1
|
|
|
|
fi
|
|
|
|
mkdir -p ~/react-native/tooling/junit
|
2018-05-07 21:24:32 +00:00
|
|
|
cp -R ~/okbuck/tooling/junit/* ~/react-native/tooling/junit/.
|
2018-03-28 19:53:08 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
- &install-node
|
2018-03-27 16:15:54 +00:00
|
|
|
name: Install Node
|
|
|
|
command: |
|
2017-11-27 18:54:22 +00:00
|
|
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
|
|
|
sudo apt-get install -y nodejs
|
|
|
|
|
|
|
|
- &create-ndk-directory
|
2018-02-06 20:36:07 +00:00
|
|
|
name: Create Android NDK Directory
|
|
|
|
command: |
|
2017-11-27 18:54:22 +00:00
|
|
|
if [[ ! -e /opt/ndk ]]; then
|
|
|
|
sudo mkdir /opt/ndk
|
|
|
|
fi
|
|
|
|
sudo chown ${USER:=$(/usr/bin/id -run)}:$USER /opt/ndk
|
|
|
|
|
|
|
|
# CircleCI does not support interpolating env variables in the environment
|
|
|
|
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
|
|
|
|
- &configure-android-path
|
2018-02-06 20:36:07 +00:00
|
|
|
name: Configure Environment Variables
|
|
|
|
command: |
|
2017-11-27 18:54:22 +00:00
|
|
|
echo 'export PATH=${ANDROID_NDK}:~/react-native/gradle-2.9/bin:~/buck/bin:$PATH' >> $BASH_ENV
|
|
|
|
source $BASH_ENV
|
|
|
|
|
|
|
|
- &install-android-packages
|
2018-03-10 01:06:51 +00:00
|
|
|
name: Install Android SDK Packages
|
|
|
|
command: source scripts/circle-ci-android-setup.sh && getAndroidSDK
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
- &install-android-build-dependencies
|
|
|
|
name: Install Android Build Dependencies
|
2018-03-27 16:15:54 +00:00
|
|
|
command: ./scripts/circleci/apt-get-android-deps.sh
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-03-10 01:06:51 +00:00
|
|
|
- &validate-android-sdk
|
|
|
|
name: Validate Android SDK Install
|
|
|
|
command: ./scripts/validate-android-sdk.sh
|
|
|
|
|
|
|
|
- &validate-android-test-env
|
|
|
|
name: Validate Android Test Environment
|
|
|
|
command: ./scripts/validate-android-test-env.sh
|
|
|
|
|
2018-02-01 01:08:06 +00:00
|
|
|
# Test Definitions
|
|
|
|
- &run-js-tests
|
|
|
|
name: JavaScript Test Suite
|
|
|
|
command: yarn test-ci
|
2018-03-16 23:48:36 +00:00
|
|
|
|
|
|
|
# eslint sometimes runs into trouble generating the reports
|
2018-02-01 01:08:06 +00:00
|
|
|
- &run-lint-checks
|
|
|
|
name: Lint code
|
2018-03-16 23:48:36 +00:00
|
|
|
command: scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/js-lint-results.xml
|
2018-02-01 01:08:06 +00:00
|
|
|
when: always
|
|
|
|
|
|
|
|
- &run-flow-checks
|
|
|
|
name: Check for errors in code using Flow
|
|
|
|
command: yarn flow check
|
|
|
|
when: always
|
|
|
|
|
2018-03-09 22:42:13 +00:00
|
|
|
- &run-sanity-checks
|
|
|
|
name: Sanity checks
|
|
|
|
command: |
|
|
|
|
./scripts/circleci/check_license.sh
|
|
|
|
./scripts/circleci/check_cache.sh
|
2018-03-01 16:07:40 +00:00
|
|
|
when: always
|
2018-03-27 21:31:42 +00:00
|
|
|
|
|
|
|
- &gradle-download-deps
|
|
|
|
name: Download C++ Dependencies
|
|
|
|
command: ./scripts/circleci/gradle_download_deps.sh
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2017-12-22 19:07:48 +00:00
|
|
|
- &build-android-app
|
|
|
|
name: Build Android App
|
|
|
|
command: |
|
|
|
|
buck build ReactAndroid/src/main/java/com/facebook/react
|
|
|
|
buck build ReactAndroid/src/main/java/com/facebook/react/shell
|
|
|
|
|
2018-01-22 19:56:36 +00:00
|
|
|
- &create-avd
|
|
|
|
name: Create Android Virtual Device
|
|
|
|
command: source scripts/circle-ci-android-setup.sh && createAVD
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2018-01-22 19:56:36 +00:00
|
|
|
- &launch-avd
|
|
|
|
name: Launch Android Virtual Device in Background
|
|
|
|
command: source scripts/circle-ci-android-setup.sh && launchAVD
|
|
|
|
background: true
|
|
|
|
|
2017-12-22 19:07:48 +00:00
|
|
|
- &wait-for-avd
|
|
|
|
name: Wait for Android Virtual Device
|
|
|
|
command: source scripts/circle-ci-android-setup.sh && waitForAVD
|
|
|
|
|
2018-01-22 19:56:36 +00:00
|
|
|
- &build-js-bundle
|
|
|
|
name: Build JavaScript Bundle
|
|
|
|
command: node local-cli/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
|
2017-12-22 19:07:48 +00:00
|
|
|
|
|
|
|
- &compile-native-libs
|
|
|
|
name: Compile Native Libs for Unit and Integration Tests
|
|
|
|
command: ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=$BUILD_THREADS -Pcom.android.build.threadPoolSize=1
|
|
|
|
no_output_timeout: 6m
|
|
|
|
|
|
|
|
- &run-android-unit-tests
|
2018-01-22 19:56:36 +00:00
|
|
|
name: Run Unit Tests
|
2018-03-28 19:53:08 +00:00
|
|
|
command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS --xml ~/react-native/reports/buck/all-results-raw.xml
|
2017-12-22 19:07:48 +00:00
|
|
|
|
2018-01-22 19:56:36 +00:00
|
|
|
- &run-android-instrumentation-tests
|
|
|
|
name: Run Instrumentation Tests
|
2018-02-06 20:36:07 +00:00
|
|
|
command: |
|
2018-05-07 21:24:32 +00:00
|
|
|
if [[ ! -e ReactAndroid/src/androidTest/assets/AndroidTestBundle.js ]]; then
|
2018-02-06 20:36:07 +00:00
|
|
|
echo "JavaScript bundle missing, cannot run instrumentation tests. Verify build-js-bundle step completed successfully."; exit 1;
|
|
|
|
fi
|
2018-02-27 20:40:13 +00:00
|
|
|
source scripts/circle-ci-android-setup.sh && NO_BUCKD=1 retry3 timeout 300 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2017-12-22 19:07:48 +00:00
|
|
|
- &collect-android-test-results
|
|
|
|
name: Collect Test Results
|
|
|
|
command: |
|
2018-03-28 19:53:08 +00:00
|
|
|
find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} ~/react-native/reports/build/ \;
|
|
|
|
find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} ~/react-native/reports/outputs/ \;
|
|
|
|
find . -type f -regex ".*/buck-out/gen/ReactAndroid/src/test/.*/.*xml" -exec cp {} ~/react-native/reports/buck/ \;
|
|
|
|
./tooling/junit/buck_to_junit.sh ~/react-native/reports/buck/all-results-raw.xml ~/react-native/reports/junit/all-results-junit.xml
|
2017-12-22 19:07:48 +00:00
|
|
|
when: always
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-01-31 22:48:51 +00:00
|
|
|
- &setup-artifacts
|
|
|
|
name: Initial Setup
|
2018-05-07 21:24:32 +00:00
|
|
|
command: |
|
2018-03-28 19:53:08 +00:00
|
|
|
mkdir -p ~/react-native/reports/buck/
|
|
|
|
mkdir -p ~/react-native/reports/build/
|
2018-02-08 22:57:36 +00:00
|
|
|
mkdir -p ~/react-native/reports/junit/
|
2018-03-28 19:53:08 +00:00
|
|
|
mkdir -p ~/react-native/reports/outputs/
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2018-02-13 16:08:18 +00:00
|
|
|
- &run-objc-ios-tests
|
2018-03-05 02:10:29 +00:00
|
|
|
name: iOS Test Suite
|
2018-02-13 16:08:18 +00:00
|
|
|
command: ./scripts/objc-test-ios.sh test
|
|
|
|
|
2018-02-01 01:08:06 +00:00
|
|
|
- &run-objc-tvos-tests
|
2018-03-05 02:10:29 +00:00
|
|
|
name: tvOS Test Suite
|
2018-02-13 16:08:18 +00:00
|
|
|
command: ./scripts/objc-test-tvos.sh test
|
2018-02-01 01:08:06 +00:00
|
|
|
|
|
|
|
- &run-objc-ios-e2e-tests
|
2018-03-05 02:10:29 +00:00
|
|
|
name: iOS End-to-End Test Suite
|
2018-02-01 01:08:06 +00:00
|
|
|
command: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3;
|
|
|
|
|
|
|
|
- &run-objc-tvos-e2e-tests
|
2018-03-05 02:10:29 +00:00
|
|
|
name: tvOS End-to-End Test Suite
|
2018-02-01 01:08:06 +00:00
|
|
|
command: node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3;
|
|
|
|
|
2017-09-21 20:34:02 +00:00
|
|
|
defaults: &defaults
|
|
|
|
working_directory: ~/react-native
|
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
js_defaults: &js_defaults
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
2018-03-16 23:48:36 +00:00
|
|
|
environment:
|
|
|
|
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
android_defaults: &android_defaults
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2018-03-28 19:53:08 +00:00
|
|
|
- image: circleci/android:api-26-node8-alpha
|
2017-11-27 18:54:22 +00:00
|
|
|
resource_class: "large"
|
|
|
|
environment:
|
|
|
|
- TERM: "dumb"
|
|
|
|
- ADB_INSTALL_TIMEOUT: 10
|
|
|
|
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
|
|
|
|
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
|
|
|
|
- ANDROID_NDK: '/opt/ndk/android-ndk-r10e'
|
|
|
|
- BUILD_THREADS: 2
|
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
macos_defaults: &macos_defaults
|
|
|
|
<<: *defaults
|
|
|
|
macos:
|
2018-02-13 16:08:18 +00:00
|
|
|
xcode: "9.2.0"
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2017-09-21 20:34:02 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-02-08 22:57:36 +00:00
|
|
|
|
|
|
|
# Set up a Node environment for downstream jobs
|
|
|
|
checkout_code:
|
|
|
|
<<: *js_defaults
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2018-01-31 22:48:51 +00:00
|
|
|
- run: *setup-artifacts
|
|
|
|
|
2018-03-27 21:31:42 +00:00
|
|
|
- restore-cache: *restore-cache-yarn
|
2018-01-30 21:49:01 +00:00
|
|
|
- run: *yarn
|
2018-03-27 21:31:42 +00:00
|
|
|
- save-cache: *save-cache-yarn
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-03-09 22:42:13 +00:00
|
|
|
# Basic checks against the checkout, cache...
|
|
|
|
- run: *run-sanity-checks
|
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths: .
|
|
|
|
|
|
|
|
# Runs JavaScript lint and flow checks.
|
|
|
|
# Currently will fail a PR if lint/flow raises issues.
|
2018-03-01 16:07:40 +00:00
|
|
|
analyze:
|
2018-02-08 22:57:36 +00:00
|
|
|
<<: *js_defaults
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
|
|
|
|
2017-12-20 19:29:33 +00:00
|
|
|
- run: *run-lint-checks
|
|
|
|
- run: *run-flow-checks
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2018-02-01 01:08:06 +00:00
|
|
|
- store_test_results:
|
2018-02-08 22:57:36 +00:00
|
|
|
path: ~/react-native/reports/junit
|
2018-02-06 20:36:07 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: ~/react-native/yarn.lock
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2017-12-20 19:29:33 +00:00
|
|
|
# Runs JavaScript tests on Node 8
|
2018-02-08 22:57:36 +00:00
|
|
|
test_javascript:
|
|
|
|
<<: *js_defaults
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-01-30 21:49:01 +00:00
|
|
|
- run: *run-js-tests
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-01-31 22:48:51 +00:00
|
|
|
- store_test_results:
|
2018-02-08 22:57:36 +00:00
|
|
|
path: ~/react-native/reports/junit
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2017-10-13 23:11:53 +00:00
|
|
|
# Runs unit tests on iOS devices
|
2018-03-05 02:10:29 +00:00
|
|
|
test_ios:
|
2018-02-08 22:57:36 +00:00
|
|
|
<<: *macos_defaults
|
2017-10-13 23:11:53 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-05-07 21:24:32 +00:00
|
|
|
- run: xcrun instruments -w "iPhone 5s (11.2)" || true
|
|
|
|
# See https://github.com/Homebrew/homebrew-core/issues/26358.
|
|
|
|
- run: brew upgrade python > /dev/null
|
2018-03-05 02:10:29 +00:00
|
|
|
- run: brew install watchman
|
2018-02-13 16:08:18 +00:00
|
|
|
- run: *run-objc-ios-tests
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-01-31 22:48:51 +00:00
|
|
|
- store_test_results:
|
2018-02-08 22:57:36 +00:00
|
|
|
path: ~/react-native/reports/junit
|
2018-02-13 16:08:18 +00:00
|
|
|
|
2017-10-13 23:11:53 +00:00
|
|
|
# Runs unit tests on tvOS devices
|
2018-03-05 02:10:29 +00:00
|
|
|
test_tvos:
|
2018-02-08 22:57:36 +00:00
|
|
|
<<: *macos_defaults
|
2017-10-13 23:11:53 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-05-07 21:24:32 +00:00
|
|
|
- run: xcrun instruments -w "Apple TV 1080p (11.2)" || true
|
|
|
|
# See https://github.com/Homebrew/homebrew-core/issues/26358.
|
|
|
|
- run: brew upgrade python > /dev/null
|
2018-03-05 02:10:29 +00:00
|
|
|
- run: brew install watchman
|
2018-02-01 01:08:06 +00:00
|
|
|
- run: *run-objc-tvos-tests
|
|
|
|
|
2018-01-31 22:48:51 +00:00
|
|
|
- store_test_results:
|
2018-02-08 22:57:36 +00:00
|
|
|
path: ~/react-native/reports/junit
|
2017-10-13 23:11:53 +00:00
|
|
|
|
|
|
|
# Runs end to end tests
|
2018-03-05 02:10:29 +00:00
|
|
|
test_ios_e2e:
|
2018-02-08 22:57:36 +00:00
|
|
|
<<: *macos_defaults
|
2017-10-13 23:11:53 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-05-07 21:24:32 +00:00
|
|
|
- run: xcrun instruments -w "iPhone 5s (11.2)" || true
|
2018-02-01 01:08:06 +00:00
|
|
|
- run: *run-objc-ios-e2e-tests
|
|
|
|
|
|
|
|
- store_test_results:
|
2018-02-08 22:57:36 +00:00
|
|
|
path: ~/react-native/reports/junit
|
2017-10-13 23:11:53 +00:00
|
|
|
|
|
|
|
# Checks podspec
|
2018-02-08 22:57:36 +00:00
|
|
|
test_podspec:
|
2018-02-13 16:08:18 +00:00
|
|
|
<<: *macos_defaults
|
2017-10-13 23:11:53 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-01-31 22:48:51 +00:00
|
|
|
|
2017-10-13 23:11:53 +00:00
|
|
|
- run: ./scripts/process-podspecs.sh
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
# Publishes new version onto npm
|
2018-02-08 22:57:36 +00:00
|
|
|
publish_npm_package:
|
2017-11-27 18:54:22 +00:00
|
|
|
<<: *android_defaults
|
|
|
|
steps:
|
2018-02-12 20:24:37 +00:00
|
|
|
# Checkout code so that we can work with `git` in publish.js
|
|
|
|
- checkout
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
# Configure Android SDK and related dependencies
|
2017-11-27 18:54:22 +00:00
|
|
|
- run: *configure-android-path
|
2018-02-06 20:36:07 +00:00
|
|
|
- run: *install-android-build-dependencies
|
2018-03-27 16:15:54 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
- restore-cache: *restore-cache-android-packages
|
|
|
|
- run: *install-android-packages
|
|
|
|
- save-cache: *save-cache-android-packages
|
2018-02-08 22:57:36 +00:00
|
|
|
|
|
|
|
# Install Android NDK
|
2017-11-27 18:54:22 +00:00
|
|
|
- run: *create-ndk-directory
|
|
|
|
- restore-cache: *restore-cache-ndk
|
|
|
|
- run: *install-ndk
|
|
|
|
- save-cache: *save-cache-ndk
|
2018-02-08 22:57:36 +00:00
|
|
|
|
|
|
|
# Fetch dependencies using BUCK
|
2017-11-27 18:54:22 +00:00
|
|
|
- restore-cache: *restore-cache-buck
|
|
|
|
- run: *install-buck
|
|
|
|
- save-cache: *save-cache-buck
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2017-12-22 19:07:48 +00:00
|
|
|
- run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
|
|
|
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react
|
|
|
|
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
|
|
|
- run: buck fetch ReactAndroid/src/test/...
|
|
|
|
- run: buck fetch ReactAndroid/src/androidTest/...
|
2018-03-27 21:31:42 +00:00
|
|
|
|
|
|
|
- restore-cache: *restore-cache-gradle-downloads
|
|
|
|
- run: *gradle-download-deps
|
|
|
|
- save-cache: *save-cache-gradle-downloads
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-03-27 21:31:42 +00:00
|
|
|
- restore-cache: *restore-cache-yarn
|
2018-02-08 22:57:36 +00:00
|
|
|
- run: *yarn
|
2018-03-27 21:31:42 +00:00
|
|
|
- save-cache: *save-cache-yarn
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
- run:
|
|
|
|
name: Publish React Native Package
|
|
|
|
command: |
|
|
|
|
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
|
|
|
|
echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
|
|
|
git config --global user.email "reactjs-bot@users.noreply.github.com"
|
2017-12-01 23:38:05 +00:00
|
|
|
git config --global user.name "npm Deployment Script"
|
2017-11-27 18:54:22 +00:00
|
|
|
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
|
|
|
node ./scripts/publish-npm.js
|
|
|
|
else
|
2018-05-07 21:24:32 +00:00
|
|
|
echo "Skipping deploy."
|
2017-09-21 20:34:02 +00:00
|
|
|
fi
|
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
# Set up an Android environment for downstream jobs
|
|
|
|
test_android:
|
2017-11-27 18:54:22 +00:00
|
|
|
<<: *android_defaults
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-01-31 22:48:51 +00:00
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
# Configure Android SDK and related dependencies
|
2017-11-27 18:54:22 +00:00
|
|
|
- run: *configure-android-path
|
2018-03-27 16:15:54 +00:00
|
|
|
- restore-cache: *restore-cache-apt
|
2018-02-06 20:36:07 +00:00
|
|
|
- run: *install-android-build-dependencies
|
2018-03-27 16:15:54 +00:00
|
|
|
- save-cache: *save-cache-apt
|
|
|
|
|
2017-09-21 20:34:02 +00:00
|
|
|
- restore-cache: *restore-cache-android-packages
|
2017-11-27 18:54:22 +00:00
|
|
|
- run: *install-android-packages
|
2017-09-21 20:34:02 +00:00
|
|
|
- save-cache: *save-cache-android-packages
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-03-10 01:06:51 +00:00
|
|
|
- run: *validate-android-sdk
|
|
|
|
|
2018-05-07 21:24:32 +00:00
|
|
|
# Starting emulator in advance as it takes some time to boot.
|
2018-01-22 19:56:36 +00:00
|
|
|
- run: *create-avd
|
|
|
|
- run: *launch-avd
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
# Keep configuring Android dependencies while AVD boots up
|
2017-12-22 19:07:48 +00:00
|
|
|
|
2018-02-08 15:25:00 +00:00
|
|
|
# Install Android NDK
|
|
|
|
- run: *create-ndk-directory
|
|
|
|
- restore-cache: *restore-cache-ndk
|
|
|
|
- run: *install-ndk
|
|
|
|
- save-cache: *save-cache-ndk
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
# Fetch dependencies using BUCK
|
2017-09-21 20:34:02 +00:00
|
|
|
- restore-cache: *restore-cache-buck
|
2017-11-27 18:54:22 +00:00
|
|
|
- run: *install-buck
|
2017-09-21 20:34:02 +00:00
|
|
|
- save-cache: *save-cache-buck
|
2017-12-22 19:07:48 +00:00
|
|
|
|
2018-03-10 01:06:51 +00:00
|
|
|
- run: *validate-android-test-env
|
|
|
|
|
2017-12-22 19:07:48 +00:00
|
|
|
- run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
|
|
|
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react
|
|
|
|
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
|
|
|
- run: buck fetch ReactAndroid/src/test/...
|
|
|
|
- run: buck fetch ReactAndroid/src/androidTest/...
|
2018-03-27 16:15:54 +00:00
|
|
|
|
2018-03-27 21:31:42 +00:00
|
|
|
- restore-cache: *restore-cache-gradle-downloads
|
|
|
|
- run: *gradle-download-deps
|
|
|
|
- save-cache: *save-cache-gradle-downloads
|
2017-12-22 19:07:48 +00:00
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
# Build and compile
|
2017-12-22 19:07:48 +00:00
|
|
|
- run: *build-android-app
|
|
|
|
- run: *compile-native-libs
|
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
# Build JavaScript Bundle for instrumentation tests
|
2018-01-22 19:56:36 +00:00
|
|
|
- run: *build-js-bundle
|
2017-12-22 19:07:48 +00:00
|
|
|
|
|
|
|
# Wait for AVD to finish booting before running tests
|
|
|
|
- run: *wait-for-avd
|
2018-03-10 01:06:51 +00:00
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
# Test Suite
|
2017-12-22 19:07:48 +00:00
|
|
|
- run: *run-android-unit-tests
|
2018-01-22 19:56:36 +00:00
|
|
|
- run: *run-android-instrumentation-tests
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2018-03-28 19:53:08 +00:00
|
|
|
# Collect Results
|
2017-12-22 19:07:48 +00:00
|
|
|
- run: *collect-android-test-results
|
2017-09-21 20:34:02 +00:00
|
|
|
- store_test_results:
|
2018-02-08 22:57:36 +00:00
|
|
|
path: ~/react-native/reports/junit
|
|
|
|
|
2018-02-01 01:08:06 +00:00
|
|
|
# Analyze pull request and raise any lint/flow issues.
|
|
|
|
# Issues will be posted to the PR itself via GitHub bots.
|
|
|
|
# This workflow should only fail if the bots fail to run.
|
2018-02-08 22:57:36 +00:00
|
|
|
analyze_pr:
|
|
|
|
<<: *js_defaults
|
2017-10-16 18:52:48 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-01-31 22:48:51 +00:00
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
- restore-cache: *restore-cache-analysis
|
2018-01-30 21:49:01 +00:00
|
|
|
- run: *yarn
|
2017-10-16 18:52:48 +00:00
|
|
|
- run:
|
2018-01-30 21:49:01 +00:00
|
|
|
name: Install Additional Dependencies
|
2017-10-16 18:52:48 +00:00
|
|
|
command: |
|
2018-01-31 22:48:51 +00:00
|
|
|
if [ -n "$CIRCLE_PR_NUMBER" ]; then
|
2018-01-30 21:49:01 +00:00
|
|
|
yarn add github@0.2.4
|
2018-02-01 00:22:27 +00:00
|
|
|
cd bots
|
2018-01-30 21:49:01 +00:00
|
|
|
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
2017-10-16 18:52:48 +00:00
|
|
|
else
|
2018-05-07 21:24:32 +00:00
|
|
|
echo "Skipping dependency installation."
|
2017-10-16 18:52:48 +00:00
|
|
|
fi
|
|
|
|
- save-cache: *save-cache-analysis
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
- run:
|
|
|
|
name: Analyze Pull Request
|
|
|
|
command: |
|
2018-02-27 18:00:50 +00:00
|
|
|
# DANGER_GITHUB_API_TOKEN=Facebook-Open-Source-Bot public_repo access token
|
2018-01-31 22:48:51 +00:00
|
|
|
if [ -n "$CIRCLE_PR_NUMBER" ]; then
|
2018-02-27 18:00:50 +00:00
|
|
|
cd bots && DANGER_GITHUB_API_TOKEN="b186c9a82bab3b08ec80""c0818117619eec6f281a" yarn danger
|
2017-10-16 18:52:48 +00:00
|
|
|
else
|
2018-05-07 21:24:32 +00:00
|
|
|
echo "Skipping pull request analysis."
|
2017-10-16 18:52:48 +00:00
|
|
|
fi
|
|
|
|
when: always
|
|
|
|
- run:
|
|
|
|
name: Analyze Code
|
|
|
|
command: |
|
2018-02-27 18:00:50 +00:00
|
|
|
# GITHUB_TOKEN=eslint-bot public_repo access token
|
2018-01-30 21:49:01 +00:00
|
|
|
if [ -n "$CIRCLE_PR_NUMBER" ]; then
|
2018-03-16 23:48:36 +00:00
|
|
|
GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER scripts/circleci/analyze_code.sh
|
2017-10-16 18:52:48 +00:00
|
|
|
else
|
2018-05-07 21:24:32 +00:00
|
|
|
echo "Skipping code analysis."
|
2017-10-16 18:52:48 +00:00
|
|
|
fi
|
2017-12-22 19:07:48 +00:00
|
|
|
when: always
|
2018-01-31 22:48:51 +00:00
|
|
|
|
2017-09-21 20:34:02 +00:00
|
|
|
# Workflows enables us to run multiple jobs in parallel
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-02-13 16:08:18 +00:00
|
|
|
tests:
|
2017-09-21 20:34:02 +00:00
|
|
|
jobs:
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
# Checkout repo and run Yarn
|
|
|
|
- checkout_code:
|
|
|
|
filters: *filter-ignore-gh-pages
|
|
|
|
|
2018-03-01 16:07:40 +00:00
|
|
|
# Run lint, flow, and other checks
|
|
|
|
- analyze:
|
2017-12-20 19:29:33 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2018-02-08 22:57:36 +00:00
|
|
|
requires:
|
|
|
|
- checkout_code
|
2017-12-20 19:29:33 +00:00
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
# Test JavaScript
|
|
|
|
- test_javascript:
|
2017-10-16 18:52:48 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2018-02-08 22:57:36 +00:00
|
|
|
requires:
|
|
|
|
- checkout_code
|
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
# Test Android
|
2018-02-08 22:57:36 +00:00
|
|
|
- test_android:
|
2018-01-22 19:56:36 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2018-02-08 22:57:36 +00:00
|
|
|
requires:
|
|
|
|
- checkout_code
|
2017-10-13 23:11:53 +00:00
|
|
|
|
2018-03-05 02:10:29 +00:00
|
|
|
# Test iOS & tvOS
|
|
|
|
- test_ios:
|
2017-10-16 18:52:48 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2018-02-08 22:57:36 +00:00
|
|
|
requires:
|
|
|
|
- checkout_code
|
2018-03-05 02:10:29 +00:00
|
|
|
- test_tvos:
|
2017-10-16 18:52:48 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2018-02-08 22:57:36 +00:00
|
|
|
requires:
|
|
|
|
- checkout_code
|
2018-02-01 01:08:06 +00:00
|
|
|
|
|
|
|
# End-to-end tests
|
2018-03-05 02:10:29 +00:00
|
|
|
- test_ios_e2e:
|
2017-10-16 18:52:48 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2018-02-01 01:08:06 +00:00
|
|
|
requires:
|
2018-02-08 22:57:36 +00:00
|
|
|
- checkout_code
|
2018-02-08 23:50:25 +00:00
|
|
|
|
2018-02-09 00:53:51 +00:00
|
|
|
# Only runs on PRs
|
|
|
|
analyze:
|
|
|
|
jobs:
|
|
|
|
# Checkout repo and run Yarn
|
|
|
|
- checkout_code:
|
|
|
|
filters: *filter-ignore-master-stable
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2018-02-08 23:50:25 +00:00
|
|
|
# Run code checks
|
2018-05-07 21:24:32 +00:00
|
|
|
- analyze_pr:
|
2018-02-08 23:50:25 +00:00
|
|
|
filters: *filter-ignore-master-stable
|
2018-05-07 21:24:32 +00:00
|
|
|
requires:
|
2018-02-08 23:50:25 +00:00
|
|
|
- checkout_code
|
|
|
|
|
2018-02-09 00:53:51 +00:00
|
|
|
# Only runs on NN-stable branches
|
2018-02-08 23:50:25 +00:00
|
|
|
deploy:
|
2018-05-07 21:24:32 +00:00
|
|
|
jobs:
|
2018-02-08 23:50:25 +00:00
|
|
|
# If we are on a stable branch, wait for approval to deploy to npm
|
2018-02-08 22:57:36 +00:00
|
|
|
- approve_publish_npm_package:
|
2018-02-08 23:50:25 +00:00
|
|
|
filters: *filter-only-stable
|
2017-11-27 18:54:22 +00:00
|
|
|
type: approval
|
2018-02-12 20:24:37 +00:00
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
- publish_npm_package:
|
2017-11-27 18:54:22 +00:00
|
|
|
requires:
|
2018-02-08 22:57:36 +00:00
|
|
|
- approve_publish_npm_package
|
2018-02-13 16:08:18 +00:00
|
|
|
|
2018-05-07 21:24:32 +00:00
|
|
|
# These tests are flaky or are yet to be fixed. They are placed on their own
|
2018-02-13 16:08:18 +00:00
|
|
|
# workflow to avoid marking benign PRs as broken.
|
2018-05-07 21:24:32 +00:00
|
|
|
# To run them, uncomment the entire block and open a PR (do not merge).
|
2018-02-13 16:08:18 +00:00
|
|
|
# Once a test is fixed, move the test definition to the 'tests' workflow.
|
|
|
|
# disabled_tests:
|
|
|
|
# jobs:
|
|
|
|
# # Checkout repo and run Yarn (pre-req, should succeed)
|
|
|
|
# - checkout_code:
|
|
|
|
# filters: *filter-ignore-gh-pages
|
|
|
|
|
2018-05-07 21:24:32 +00:00
|
|
|
# # The following were DISABLED because they have not run since
|
2018-02-13 16:08:18 +00:00
|
|
|
# # the migration from Travis, and they have broken since then,
|
|
|
|
# # CocoaPods
|
|
|
|
# - test_podspec:
|
|
|
|
# filters: *filter-ignore-gh-pages
|
|
|
|
# requires:
|
|
|
|
# - checkout_code
|