2016-01-05 11:44:53 +00:00
|
|
|
general:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- gh-pages # list of branches to ignore
|
2015-12-04 15:28:09 +00:00
|
|
|
machine:
|
|
|
|
node:
|
2016-02-15 21:07:36 +00:00
|
|
|
version: 5.6.0
|
2015-12-24 18:39:19 +00:00
|
|
|
environment:
|
2016-03-18 15:09:20 +00:00
|
|
|
PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-2.9/bin:/home/ubuntu/buck/bin:$PATH"
|
2015-12-24 18:39:19 +00:00
|
|
|
TERM: "dumb"
|
2015-12-30 19:38:13 +00:00
|
|
|
ADB_INSTALL_TIMEOUT: 10
|
2015-12-24 18:39:19 +00:00
|
|
|
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx512m -XX:+HeapDumpOnOutOfMemoryError"'
|
2015-12-04 15:28:09 +00:00
|
|
|
|
|
|
|
dependencies:
|
2016-03-18 15:09:20 +00:00
|
|
|
override:
|
|
|
|
# BUCK and android
|
|
|
|
- if [[ ! -e /home/ubuntu/buck ]]; then git clone https://github.com/facebook/buck.git /home/ubuntu/buck; fi
|
|
|
|
- cd /home/ubuntu/buck && ant
|
|
|
|
- buck --version
|
|
|
|
- buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
|
|
|
- buck fetch ReactAndroid/src/main/java/com/facebook/react
|
|
|
|
- buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
|
|
|
- buck fetch ReactAndroid/src/test/...
|
|
|
|
- buck fetch ReactAndroid/src/androidTest/...
|
2016-02-10 21:51:33 +00:00
|
|
|
- source scripts/circle-ci-android-setup.sh && getAndroidSDK
|
|
|
|
- ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog
|
2016-03-15 16:21:50 +00:00
|
|
|
# CIRCLE_NPM_TOKEN is in React Native project settings in Circle CI.
|
|
|
|
# It was generated for bestander user, easy to replace with anyone's else
|
|
|
|
- echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
2016-03-02 23:24:44 +00:00
|
|
|
- npm config set spin=false
|
|
|
|
- npm config set progress=false
|
2016-02-10 21:51:33 +00:00
|
|
|
- npm install
|
2016-03-18 15:09:20 +00:00
|
|
|
# for eslint bot
|
|
|
|
- npm install github@0.2.4
|
|
|
|
# for deployment scripts
|
|
|
|
- npm install shelljs@0.6.0
|
2016-02-15 21:07:36 +00:00
|
|
|
- cd website && npm install
|
2016-03-18 15:09:20 +00:00
|
|
|
cache_directories:
|
|
|
|
- "ReactAndroid/build/downloads"
|
|
|
|
- "/home/ubuntu/buck"
|
|
|
|
- "website/node_modules"
|
|
|
|
- "node_modules"
|
2016-02-11 14:16:34 +00:00
|
|
|
|
2015-12-04 15:28:09 +00:00
|
|
|
test:
|
2015-12-24 18:39:19 +00:00
|
|
|
pre:
|
|
|
|
# starting emulator in advance because it takes very long to boot
|
2015-12-30 19:38:13 +00:00
|
|
|
- $ANDROID_HOME/tools/emulator -avd testAVD -no-skin -no-audio -no-window:
|
|
|
|
background: true
|
|
|
|
- source scripts/circle-ci-android-setup.sh && waitForAVD
|
2016-02-11 14:16:34 +00:00
|
|
|
|
2015-12-04 15:28:09 +00:00
|
|
|
override:
|
2016-03-18 15:09:20 +00:00
|
|
|
# eslint bot
|
|
|
|
- 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
|
|
|
|
# JS tests for dependencies installed with npm3
|
|
|
|
- npm run flow check
|
|
|
|
- npm test -- --maxWorkers=1
|
|
|
|
|
2016-03-02 14:55:09 +00:00
|
|
|
# build app
|
2016-03-18 15:09:20 +00:00
|
|
|
- buck build ReactAndroid/src/main/java/com/facebook/react
|
|
|
|
- buck build ReactAndroid/src/main/java/com/facebook/react/shell
|
2016-01-23 18:49:33 +00:00
|
|
|
|
2015-12-24 18:39:19 +00:00
|
|
|
# unit tests
|
2016-03-18 15:09:20 +00:00
|
|
|
- buck test ReactAndroid/src/test/... --config build.threads=1
|
2016-02-01 18:48:51 +00:00
|
|
|
|
2016-03-02 14:55:09 +00:00
|
|
|
# instrumentation tests
|
|
|
|
# compile native libs with Gradle script
|
2016-03-11 21:32:42 +00:00
|
|
|
- ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1:
|
2016-03-02 14:55:09 +00:00
|
|
|
timeout: 360
|
2015-12-24 18:39:19 +00:00
|
|
|
# build JS bundle for instrumentation tests
|
2015-12-21 17:37:27 +00:00
|
|
|
- node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/assets/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
2016-03-02 14:55:09 +00:00
|
|
|
# build test APK
|
2016-03-18 15:09:20 +00:00
|
|
|
- buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1
|
2016-03-02 14:55:09 +00:00
|
|
|
# run installed apk with tests
|
2016-03-11 21:32:42 +00:00
|
|
|
- source scripts/circle-ci-android-setup.sh && retry3 ./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests
|
2016-03-02 14:55:09 +00:00
|
|
|
|
|
|
|
# Deprecated: run tests with Gradle, we keep them for a while to compare performance
|
2016-03-11 21:32:42 +00:00
|
|
|
- ./gradlew :ReactAndroid:testDebugUnitTest
|
|
|
|
- ./gradlew :ReactAndroid:installDebugAndroidTest
|
|
|
|
- source scripts/circle-ci-android-setup.sh && retry3 ./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests.gradle
|
2016-02-11 14:16:34 +00:00
|
|
|
|
2016-03-04 17:22:53 +00:00
|
|
|
# Publish to Sinopia, create a new app using 'react-native init' and check the packager starts
|
|
|
|
- ./scripts/e2e-test.sh --packager
|
|
|
|
|
2016-02-11 14:16:34 +00:00
|
|
|
# testing docs generation is not broken
|
|
|
|
- cd website && node ./server/generate.js
|
2015-12-30 19:38:13 +00:00
|
|
|
post:
|
|
|
|
# copy test report for Circle CI to display
|
|
|
|
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
|
|
|
|
- find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
|
|
|
|
- find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
|
2016-03-02 14:55:09 +00:00
|
|
|
# TODO circle does not understand Buck's report, maybe need to transform xml slightly
|
|
|
|
#- find . -type f -regex ".*/buck-out/gen/ReactAndroid/src/test/.*/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
|
2015-12-30 19:38:13 +00:00
|
|
|
|
2016-02-11 14:16:34 +00:00
|
|
|
deployment:
|
2016-03-15 16:21:50 +00:00
|
|
|
stable:
|
2016-02-11 14:16:34 +00:00
|
|
|
branch: [/.*-stable/, /master/]
|
|
|
|
commands:
|
|
|
|
# generate docs website
|
|
|
|
- git config --global user.email "bestnader@fb.com"
|
|
|
|
- git config --global user.name "Website Deployment Script"
|
|
|
|
- echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
2016-02-11 16:08:52 +00:00
|
|
|
- cd website && GIT_USER=reactjs-bot npm run gh-pages
|
2016-03-15 16:21:50 +00:00
|
|
|
- node ./scripts/publish-npm.js
|