2017-09-21 20:34:02 +00:00
|
|
|
aliases:
|
2017-10-13 23:11:53 +00:00
|
|
|
- &restore-node-cache
|
2017-09-21 20:34:02 +00:00
|
|
|
keys:
|
2018-01-22 19:24:46 +00:00
|
|
|
- v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
# Fallback in case checksum fails
|
2018-01-22 19:24:46 +00:00
|
|
|
- v2-dependencies-{{ arch }}-
|
2017-10-13 23:11:53 +00:00
|
|
|
|
|
|
|
- &save-node-cache
|
2017-09-21 20:34:02 +00:00
|
|
|
paths:
|
|
|
|
- node_modules
|
2018-01-22 19:24:46 +00:00
|
|
|
key: v2-dependencies-{{ 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:
|
2017-12-22 19:07:48 +00:00
|
|
|
- v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "danger/package.json" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
# Fallback in case checksum fails
|
2017-12-22 19:07:48 +00:00
|
|
|
- v1-analysis-dependencies-{{ arch }}-
|
2017-10-16 18:52:48 +00:00
|
|
|
- &save-cache-analysis
|
2017-09-21 20:34:02 +00:00
|
|
|
paths:
|
|
|
|
- danger/node_modules
|
2017-10-16 18:52:48 +00:00
|
|
|
- node_modules
|
2017-12-22 19:07:48 +00:00
|
|
|
key: v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "danger/package.json" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
|
|
|
|
- &restore-cache-android-packages
|
|
|
|
keys:
|
2017-12-22 19:07:48 +00:00
|
|
|
- v2-android-sdkmanager-packages-{{ arch }}-{{ checksum "scripts/circle-ci-android-setup.sh" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
# Fallback in case checksum fails
|
2017-12-22 19:07:48 +00:00
|
|
|
- v2-android-sdkmanager-packages-{{ arch }}-
|
2017-09-21 20:34:02 +00:00
|
|
|
- &save-cache-android-packages
|
|
|
|
paths:
|
2017-12-22 19:07:48 +00:00
|
|
|
- /opt/android/sdk
|
|
|
|
key: v2-android-sdkmanager-packages-{{ arch }}-{{ checksum "scripts/circle-ci-android-setup.sh" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
|
|
|
|
- &restore-cache-ndk
|
|
|
|
keys:
|
2017-10-13 23:11:53 +00:00
|
|
|
- v1-android-ndk-{{ arch }}-r10e-32-64
|
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
- &install-ndk
|
|
|
|
|
|
|
|
|
source scripts/circle-ci-android-setup.sh && getAndroidNDK
|
|
|
|
|
2017-09-21 20:34:02 +00:00
|
|
|
- &save-cache-ndk
|
|
|
|
paths:
|
|
|
|
- /opt/ndk
|
2017-10-13 23:11:53 +00:00
|
|
|
key: v1-android-ndk-{{ arch }}-r10e-32-64
|
2017-09-21 20:34:02 +00:00
|
|
|
|
|
|
|
- &restore-cache-buck
|
|
|
|
keys:
|
2017-12-22 19:07:48 +00:00
|
|
|
- v2-buck-{{ arch }}-v2017.11.16.01
|
2017-09-21 20:34:02 +00:00
|
|
|
- &save-cache-buck
|
|
|
|
paths:
|
|
|
|
- ~/buck
|
2017-12-22 19:07:48 +00:00
|
|
|
key: v2-buck-{{ arch }}-v2017.11.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
|
|
|
|
|
|
|
|
- &install-node-dependencies
|
|
|
|
|
|
|
|
|
npm install --no-package-lock --no-spin --no-progress
|
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
- &install-buck
|
|
|
|
|
|
|
|
|
if [[ ! -e ~/buck ]]; then
|
2017-12-22 19:07:48 +00:00
|
|
|
git clone https://github.com/facebook/buck.git ~/buck --branch v2017.11.16.01 --depth=1
|
2017-11-27 18:54:22 +00:00
|
|
|
fi
|
|
|
|
cd ~/buck && ant
|
|
|
|
buck --version
|
|
|
|
|
|
|
|
- &install-node
|
|
|
|
|
|
|
|
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
|
|
|
sudo apt-get install -y nodejs
|
|
|
|
|
2017-10-13 23:11:53 +00:00
|
|
|
- &run-node-tests
|
|
|
|
|
|
|
|
|
npm test -- --maxWorkers=2
|
2017-12-20 19:29:33 +00:00
|
|
|
|
|
|
|
- &run-lint-checks
|
|
|
|
|
|
2017-10-13 23:11:53 +00:00
|
|
|
npm run lint
|
2017-12-20 19:29:33 +00:00
|
|
|
|
|
|
|
- &run-flow-checks
|
|
|
|
|
|
2017-10-13 23:11:53 +00:00
|
|
|
npm run flow -- check
|
2018-01-22 19:56:36 +00:00
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
- &filter-only-master-stable
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /.*-stable/
|
|
|
|
- master
|
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
- &filter-only-stable
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /.*-stable/
|
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
- &filter-ignore-gh-pages
|
|
|
|
branches:
|
|
|
|
ignore: gh-pages
|
|
|
|
|
|
|
|
- &filter-ignore-master-stable
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- master
|
|
|
|
- /.*-stable/
|
|
|
|
- gh-pages
|
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
- &create-ndk-directory
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
echo 'export PATH=${ANDROID_NDK}:~/react-native/gradle-2.9/bin:~/buck/bin:$PATH' >> $BASH_ENV
|
|
|
|
source $BASH_ENV
|
|
|
|
|
|
|
|
- &install-android-packages
|
|
|
|
|
|
|
|
|
source scripts/circle-ci-android-setup.sh && getAndroidSDK
|
|
|
|
|
|
|
|
- &install-build-dependencies
|
|
|
|
|
|
|
|
|
sudo apt-get update -y
|
|
|
|
sudo apt-get install ant autoconf automake g++ gcc libqt5widgets5 lib32z1 lib32stdc++6 make maven python-dev python3-dev qml-module-qtquick-controls qtdeclarative5-dev file -y
|
|
|
|
|
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
|
|
|
|
|
|
|
|
- &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
|
2017-12-22 19:07:48 +00:00
|
|
|
command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS
|
|
|
|
|
2018-01-22 19:56:36 +00:00
|
|
|
- &run-android-instrumentation-tests
|
|
|
|
name: Run Instrumentation Tests
|
2017-12-22 19:07:48 +00:00
|
|
|
command: source scripts/circle-ci-android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
|
|
|
|
|
|
|
|
- &collect-android-test-results
|
|
|
|
name: Collect Test Results
|
|
|
|
command: |
|
|
|
|
mkdir -p ~/junit/
|
|
|
|
find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} ~/junit/ \;
|
|
|
|
find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} ~/junit/ \;
|
|
|
|
when: always
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2017-09-21 20:34:02 +00:00
|
|
|
defaults: &defaults
|
|
|
|
working_directory: ~/react-native
|
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
android_defaults: &android_defaults
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: circleci/android:api-26-alpha
|
|
|
|
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
|
|
|
|
|
2017-09-21 20:34:02 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2017-12-20 19:29:33 +00:00
|
|
|
# Runs JavaScript lint and flow checks
|
|
|
|
run-js-checks:
|
2017-09-21 20:34:02 +00:00
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
|
|
|
steps:
|
|
|
|
- checkout
|
2017-10-13 23:11:53 +00:00
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
2017-12-20 19:29:33 +00:00
|
|
|
- run: *run-lint-checks
|
|
|
|
- run: *run-flow-checks
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2017-12-20 19:29:33 +00:00
|
|
|
# Runs JavaScript tests on Node 8
|
|
|
|
test-js-node-8:
|
2017-09-21 20:34:02 +00:00
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2017-12-20 19:29:33 +00:00
|
|
|
- image: circleci/node:8
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2017-10-13 23:11:53 +00:00
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
|
|
|
- run: *run-node-tests
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2017-12-20 19:29:33 +00:00
|
|
|
# Runs JavaScript tests on Node 6
|
|
|
|
test-js-node-6:
|
2017-09-21 20:34:02 +00:00
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2017-12-20 19:29:33 +00:00
|
|
|
- image: circleci/node:6
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2017-10-13 23:11:53 +00:00
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
|
|
|
- run: *run-node-tests
|
|
|
|
|
|
|
|
# Runs unit tests on iOS devices
|
|
|
|
test-objc-ios:
|
|
|
|
<<: *defaults
|
|
|
|
macos:
|
|
|
|
xcode: "9.0"
|
|
|
|
dependencies:
|
|
|
|
pre:
|
|
|
|
- xcrun instruments -w "iPhone 5s (10.3.1)" || true
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
|
|
|
- run: ./scripts/objc-test-ios.sh
|
|
|
|
|
|
|
|
# Runs unit tests on tvOS devices
|
|
|
|
test-objc-tvos:
|
|
|
|
<<: *defaults
|
|
|
|
macos:
|
|
|
|
xcode: "9.0"
|
|
|
|
dependencies:
|
|
|
|
pre:
|
|
|
|
- xcrun instruments -w "Apple TV 1080p (10.0)" || true
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
|
|
|
- run: ./scripts/objc-test-tvos.sh
|
|
|
|
|
|
|
|
# Runs end to end tests
|
|
|
|
test-objc-e2e:
|
|
|
|
<<: *defaults
|
|
|
|
macos:
|
|
|
|
xcode: "9.0"
|
|
|
|
dependencies:
|
|
|
|
pre:
|
|
|
|
- xcrun instruments -w "iPhone 5s (10.3.1)" || true
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
|
|
|
- run: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3;
|
|
|
|
|
|
|
|
# Checks podspec
|
|
|
|
test-podspec:
|
|
|
|
<<: *defaults
|
|
|
|
macos:
|
|
|
|
xcode: "9.0"
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
|
|
|
- run: ./scripts/process-podspecs.sh
|
2017-10-16 18:52:48 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
# Publishes new version onto npm
|
|
|
|
deploy:
|
|
|
|
<<: *android_defaults
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
# Configure Android dependencies
|
|
|
|
- run: *configure-android-path
|
|
|
|
- run: *install-build-dependencies
|
|
|
|
- restore-cache: *restore-cache-android-packages
|
|
|
|
- run: *install-android-packages
|
|
|
|
- save-cache: *save-cache-android-packages
|
|
|
|
- run: *create-ndk-directory
|
|
|
|
- restore-cache: *restore-cache-ndk
|
|
|
|
- run: *install-ndk
|
|
|
|
- save-cache: *save-cache-ndk
|
|
|
|
- restore-cache: *restore-cache-buck
|
|
|
|
- run: *install-buck
|
|
|
|
- save-cache: *save-cache-buck
|
|
|
|
- run: *install-node
|
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
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/...
|
|
|
|
- run: ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders
|
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
|
|
|
|
echo "Skipping deploy."
|
2017-09-21 20:34:02 +00:00
|
|
|
fi
|
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
# Runs unit tests tests on Android
|
2017-09-21 20:34:02 +00:00
|
|
|
test-android:
|
2017-11-27 18:54:22 +00:00
|
|
|
<<: *android_defaults
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2017-11-27 18:54:22 +00:00
|
|
|
|
|
|
|
# Configure Android dependencies
|
|
|
|
- run: *configure-android-path
|
|
|
|
- run: *install-build-dependencies
|
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
|
|
|
|
|
|
|
# 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
|
2017-11-27 18:54:22 +00:00
|
|
|
|
|
|
|
# Keep configuring Android dependencies while AVD boots up
|
|
|
|
- run: *create-ndk-directory
|
2017-09-21 20:34:02 +00:00
|
|
|
- restore-cache: *restore-cache-ndk
|
2017-11-27 18:54:22 +00:00
|
|
|
- run: *install-ndk
|
2017-09-21 20:34:02 +00:00
|
|
|
- save-cache: *save-cache-ndk
|
2017-12-22 19:07:48 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
- 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/...
|
|
|
|
- run: ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders
|
|
|
|
|
|
|
|
- run: *build-android-app
|
|
|
|
- run: *compile-native-libs
|
|
|
|
|
2018-01-22 19:56:36 +00:00
|
|
|
# The JavaScript Bundle is required for instrumentation tests.
|
|
|
|
- run: *install-node
|
|
|
|
- restore-cache: *restore-node-cache
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- save-cache: *save-node-cache
|
|
|
|
- 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
|
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
# Tests
|
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
|
2017-11-27 18:54:22 +00:00
|
|
|
|
|
|
|
# post (always runs)
|
2017-12-22 19:07:48 +00:00
|
|
|
- run: *collect-android-test-results
|
2017-09-21 20:34:02 +00:00
|
|
|
- store_test_results:
|
|
|
|
path: ~/junit
|
|
|
|
- store_artifacts:
|
|
|
|
path: ~/junit
|
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
analyze-pull-request:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-cache-analysis
|
|
|
|
- run: *install-node-dependencies
|
|
|
|
- run:
|
|
|
|
name: Install Dependencies
|
|
|
|
command: |
|
2017-11-27 18:54:22 +00:00
|
|
|
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
|
2017-10-16 18:52:48 +00:00
|
|
|
npm install github@0.2.4
|
|
|
|
cd danger
|
|
|
|
npm install --no-package-lock --no-spin --no-progress
|
|
|
|
else
|
|
|
|
echo "Skipping dependency installation."
|
|
|
|
fi
|
|
|
|
- save-cache: *save-cache-analysis
|
|
|
|
- run:
|
|
|
|
name: Analyze Pull Request
|
|
|
|
command: |
|
2017-11-27 18:54:22 +00:00
|
|
|
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
|
2017-10-16 18:52:48 +00:00
|
|
|
cd danger && DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger
|
|
|
|
else
|
|
|
|
echo "Skipping pull request analysis."
|
|
|
|
fi
|
|
|
|
when: always
|
|
|
|
- run:
|
|
|
|
name: Analyze Code
|
|
|
|
command: |
|
2017-11-27 18:54:22 +00:00
|
|
|
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
|
2017-10-16 18:52:48 +00:00
|
|
|
cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow --silent -- check --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER node bots/code-analysis-bot.js
|
|
|
|
else
|
|
|
|
echo "Skipping code analysis."
|
|
|
|
fi
|
2017-12-22 19:07:48 +00:00
|
|
|
when: always
|
|
|
|
|
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
|
|
|
|
|
|
|
build:
|
2017-09-21 20:34:02 +00:00
|
|
|
jobs:
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2017-12-20 19:29:33 +00:00
|
|
|
# Run lint and flow checks
|
|
|
|
- run-js-checks:
|
|
|
|
filters: *filter-ignore-gh-pages
|
|
|
|
|
|
|
|
# Test JavaScript on Node 8 and 6
|
2017-10-16 18:52:48 +00:00
|
|
|
- test-js-node-8:
|
|
|
|
filters: *filter-ignore-gh-pages
|
|
|
|
- test-js-node-6:
|
|
|
|
filters: *filter-ignore-gh-pages
|
2017-10-13 23:11:53 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
# Test Android
|
2017-09-21 20:34:02 +00:00
|
|
|
- test-android:
|
2018-01-22 19:56:36 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2017-10-13 23:11:53 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
# Test iOS & tvOS
|
2017-10-16 18:52:48 +00:00
|
|
|
- test-objc-ios:
|
|
|
|
filters: *filter-ignore-gh-pages
|
|
|
|
- test-objc-tvos:
|
|
|
|
filters: *filter-ignore-gh-pages
|
|
|
|
- test-objc-e2e:
|
|
|
|
filters: *filter-ignore-gh-pages
|
2017-11-27 18:54:22 +00:00
|
|
|
|
|
|
|
# If we are on a stable branch, deploy to `npm`
|
|
|
|
- hold:
|
|
|
|
type: approval
|
|
|
|
- deploy:
|
|
|
|
filters: *filter-only-stable
|
|
|
|
requires:
|
|
|
|
- hold
|
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
- analyze-pull-request:
|
|
|
|
filters: *filter-ignore-master-stable
|