Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flow] Ignore dangerfile #17880

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 44 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ aliases:
sudo apt-get install -y nodejs

- &create-ndk-directory
|
name: Create Android NDK Directory
command: |
if [[ ! -e /opt/ndk ]]; then
sudo mkdir /opt/ndk
fi
Expand All @@ -121,16 +122,18 @@ aliases:
# 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
|
name: Configure Environment Variables
command: |
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
|
- &install-android-build-dependencies
name: Install Android Build Dependencies
command: |
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

Expand Down Expand Up @@ -171,7 +174,6 @@ aliases:
- &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
when: always

- &compile-native-libs
name: Compile Native Libs for Unit and Integration Tests
Expand All @@ -184,7 +186,11 @@ aliases:

- &run-android-instrumentation-tests
name: Run Instrumentation Tests
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
command: |
if [[ ! -e ReactAndroid/src/androidTest/assets/AndroidTestBundle.js ]]; then
echo "JavaScript bundle missing, cannot run instrumentation tests. Verify build-js-bundle step completed successfully."; exit 1;
fi
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
Expand Down Expand Up @@ -235,7 +241,7 @@ version: 2
jobs:
# Runs JavaScript lint and flow checks.
# Currently will fail a PR if lint/flow raises issues.
run-js-checks:
js-checks:
<<: *defaults
docker:
- image: circleci/node:8
Expand All @@ -254,9 +260,11 @@ jobs:
path: ~/reports/junit
- store_artifacts:
path: ~/reports/junit
- store_artifacts:
path: ~/react-native/yarn.lock

# Runs JavaScript tests on Node 8
test-js-node-8:
js-node-8:
<<: *defaults
docker:
- image: circleci/node:8
Expand All @@ -276,7 +284,7 @@ jobs:
path: ~/reports/junit

# Runs JavaScript tests on Node 6
test-js-node-6:
js-node-6:
<<: *defaults
docker:
- image: circleci/node:6
Expand All @@ -296,7 +304,7 @@ jobs:
path: ~/reports/junit

# Runs unit tests on iOS devices
test-objc-ios:
objc-ios:
<<: *defaults
macos:
xcode: "9.0"
Expand All @@ -319,7 +327,7 @@ jobs:
path: ~/reports/junit

# Runs unit tests on tvOS devices
test-objc-tvos:
objc-tvos:
<<: *defaults
macos:
xcode: "9.0"
Expand All @@ -342,7 +350,7 @@ jobs:
path: ~/reports/junit

# Runs end to end tests
test-e2e-objc-ios:
objc-ios-e2e:
<<: *defaults
macos:
xcode: "9.0"
Expand Down Expand Up @@ -387,7 +395,7 @@ jobs:

# Configure Android dependencies
- run: *configure-android-path
- run: *install-build-dependencies
- run: *install-android-build-dependencies
- restore-cache: *restore-cache-android-packages
- run: *install-android-packages
- save-cache: *save-cache-android-packages
Expand Down Expand Up @@ -424,15 +432,15 @@ jobs:
fi

# Runs unit tests tests on Android
test-android:
android:
<<: *android_defaults
steps:
- checkout
- run: *setup-artifacts

# Configure Android dependencies
# Configure Android SDK and related dependencies
- run: *configure-android-path
- run: *install-build-dependencies
- run: *install-android-build-dependencies
- restore-cache: *restore-cache-android-packages
- run: *install-android-packages
- save-cache: *save-cache-android-packages
Expand All @@ -442,11 +450,8 @@ jobs:
- run: *launch-avd

# Keep configuring Android dependencies while AVD boots up
- run: *create-ndk-directory
- restore-cache: *restore-cache-ndk
- run: *install-ndk
- save-cache: *save-cache-ndk

# Fetch dependencies using BUCK
- restore-cache: *restore-cache-buck
- run: *install-buck
- save-cache: *save-cache-buck
Expand All @@ -458,10 +463,17 @@ jobs:
- run: buck fetch ReactAndroid/src/androidTest/...
- run: ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders

# Install Android NDK
- run: *create-ndk-directory
- restore-cache: *restore-cache-ndk
- run: *install-ndk
- save-cache: *save-cache-ndk

# Build and compile
- run: *build-android-app
- run: *compile-native-libs

# The JavaScript Bundle is required for instrumentation tests.
# Build JavaScript Bundle for instrumentation tests
- run: *install-node
- run: *install-yarn
- restore-cache: *restore-yarn-cache
Expand All @@ -472,7 +484,7 @@ jobs:
# Wait for AVD to finish booting before running tests
- run: *wait-for-avd

# Tests
# Test Suite
- run: *run-android-unit-tests
- run: *run-android-instrumentation-tests

Expand Down Expand Up @@ -533,31 +545,31 @@ workflows:
jobs:

# Run lint and flow checks
- run-js-checks:
- js-checks:
filters: *filter-ignore-gh-pages

# Test JavaScript on Node 8 and 6
- test-js-node-8:
- js-node-8:
filters: *filter-ignore-gh-pages
- test-js-node-6:
- js-node-6:
filters: *filter-ignore-gh-pages

# Test Android
- test-android:
- android:
filters: *filter-ignore-gh-pages

# Test iOS & tvOS
- test-objc-ios:
- objc-ios:
filters: *filter-ignore-gh-pages
- test-objc-tvos:
- objc-tvos:
filters: *filter-ignore-gh-pages

# End-to-end tests
- test-e2e-objc-ios:
- objc-ios-e2e:
filters: *filter-ignore-gh-pages
requires:
- test-objc-ios
- test-js-node-8
- objc-ios
- js-node-8

# If we are on a stable branch, deploy to `npm`
- hold:
Expand All @@ -568,4 +580,4 @@ workflows:
- hold

- analyze-pull-request:
filters: *filter-ignore-master-stable
filters: *filter-ignore-master-stable
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.*/local-cli/templates/.*

; Ignore the Dangerfile
<PROJECT_ROOT>/danger/dangerfile.js
<PROJECT_ROOT>/bots/dangerfile.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ node_modules
*.log
.nvm
/bots/node_modules/

# TODO: Check in yarn.lock in open source. Right now we need to keep it out
# from the GitHub repo as importing it might conflict with internal workspaces
*/**/yarn.lock

# OS X
Expand Down
18 changes: 9 additions & 9 deletions scripts/run-ci-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* --android - 'react-native init' and check Android app doesn't redbox
* --js - 'react-native init' and only check the packager returns a bundle
* --skip-cli-install - to skip react-native-cli global installation (for local debugging)
* --retries [num] - how many times to retry possible flaky commands: npm install and running tests, default 1
* --retries [num] - how many times to retry possible flaky commands: yarn add and running tests, default 1
*/
/*eslint-disable no-undef */
require('shelljs/global');
Expand All @@ -44,12 +44,12 @@ let exitCode;
try {
// install CLI
cd('react-native-cli');
exec('npm pack');
exec('yarn pack');
const CLI_PACKAGE = path.join(ROOT, 'react-native-cli', 'react-native-cli-*.tgz');
cd('..');

if (!argv['skip-cli-install']) {
if (exec(`sudo npm install -g ${CLI_PACKAGE}`).code) {
if (exec(`sudo yarn global add ${CLI_PACKAGE}`).code) {
echo('Could not install react-native-cli globally.');
echo('Run with --skip-cli-install to skip this step');
exitCode = 1;
Expand All @@ -65,7 +65,7 @@ try {
}
}

if (exec('npm pack').code) {
if (exec('yarn pack').code) {
echo('Failed to pack react-native');
exitCode = 1;
throw Error(exitCode);
Expand All @@ -76,7 +76,7 @@ try {
if (tryExecNTimes(
() => {
exec('sleep 10s');
return exec(`react-native init EndToEndTest --version ${PACKAGE} --npm`).code;
return exec(`react-native init EndToEndTest --version ${PACKAGE}`).code;
},
numberOfRetries,
() => rm('-rf', 'EndToEndTest'))) {
Expand All @@ -92,7 +92,7 @@ try {
echo('Running an Android e2e test');
echo('Installing e2e framework');
if (tryExecNTimes(
() => exec('npm install --save-dev appium@1.5.1 mocha@2.4.5 wd@0.3.11 colors@1.0.3 pretty-data2@0.40.1', { silent: true }).code,
() => exec('yarn add --dev appium@1.5.1 mocha@2.4.5 wd@0.3.11 colors@1.0.3 pretty-data2@0.40.1', { silent: true }).code,
numberOfRetries)) {
echo('Failed to install appium');
echo('Most common reason is npm registry connectivity, try again');
Expand Down Expand Up @@ -125,7 +125,7 @@ try {

echo(`Starting packager server, ${SERVER_PID}`);
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn
const packagerProcess = spawn('npm', ['start', '--', '--max-workers 1'], {
const packagerProcess = spawn('yarn', ['start', '--max-workers 1'], {
env: process.env
});
SERVER_PID = packagerProcess.pid;
Expand Down Expand Up @@ -158,7 +158,7 @@ try {
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn
const packagerEnv = Object.create(process.env);
packagerEnv.REACT_NATIVE_MAX_WORKERS = 1;
const packagerProcess = spawn('npm', ['start', '--', '--nonPersistent'],
const packagerProcess = spawn('yarn', ['start', '--nonPersistent'],
{
stdio: 'inherit',
env: packagerEnv
Expand Down Expand Up @@ -204,7 +204,7 @@ try {
exitCode = 1;
throw Error(exitCode);
}
if (exec('npm test').code) {
if (exec('yarn test').code) {
echo('Jest test failure');
exitCode = 1;
throw Error(exitCode);
Expand Down