Skip to content
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
265 changes: 235 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,261 @@
version: 2.1

orbs:
rn: react-native-community/[email protected]
rn: react-native-community/[email protected]


#######
commands:
setup_macos_executor:
description: >-
Installs the required packages to build and test Android and iOS applications
on the MacOS executor. You need to run this before running any other command
on those executors.
parameters:
node_version:
default: '10'
description: >-
The version of Node to use. This can be either a major version ("8"), a
major and minor ("8.4"), or a fully qualified version ("8.4.1").
type: string
steps:
- run:
command: >
echo 'export
PATH="$PATH:/usr/local/opt/node@<<parameters.node_version>>/bin:~/.yarn/bin:~/project/node_modules/.bin:~/project/example/node_modules/.bin"'
>> $BASH_ENV

echo 'export ANDROID_HOME="/usr/local/share/android-sdk"' >> $BASH_ENV

echo 'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"' >> $BASH_ENV

echo 'export
PATH="$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH"'
>> $BASH_ENV

echo 'export QEMU_AUDIO_DRV=none' >> $BASH_ENV

echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> $BASH_ENV

source $BASH_ENV
name: Configure Environment Variables
- restore_cache:
key: |
brew-cache-{{ arch }}-{{ .Environment.CACHE_VERSION }}
- run:
command: >
set +e

curl -o-
https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh |
bash

source ~/.bashrc

command -v nvm

nvm install <<parameters.node_version>>

nvm alias default <<parameters.node_version>>
name: Install node@<<parameters.node_version>>
- run:
command: node --version
name: Verify node version
- run:
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/cask >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew cask install android-sdk >/dev/null
touch .watchmanconfig
node -v
name: Configure Detox Environment
- save_cache:
key: |
brew-cache-{{ arch }}-{{ .Environment.CACHE_VERSION }}
paths:
- /usr/local/Homebrew
- ~/Library/Caches/Homebrew
android_emulator_start:
parameters:
build_tools_version:
default: 29.0.3
description: The version of the Android build tools to install.
type: string
device_name:
default: TestingAVD
description: >-
The name of the AVD. You use this name to tell which device to run tests
on.
type: string
logcat_grep:
default: com.reactnativecommunity
description: >-
ADB logs will be shown in the "Start Android Emulator" commands, but we
filter it using grep to avoid noise. You can specify additional strigns to
grep for. Make sure you escape special characters.
type: string
platform_version:
default: android-29
description: >-
The version of android to run on the emulator. Usually in the form of
"android-28".
type: string
steps:
- run:
command: >
yes | sdkmanager "platform-tools" "tools" >/dev/null

yes | sdkmanager "platforms;<<parameters.platform_version>>"
"system-images;<<parameters.platform_version>>;default;x86_64"
>/dev/null

yes | sdkmanager "emulator" --channel=3 >/dev/null

yes | sdkmanager "build-tools;<<parameters.build_tools_version>>"
>/dev/null

yes | sdkmanager --licenses >/dev/null

yes | sdkmanager --list
name: Install Android Emulator
shell: /bin/bash -e
- run:
command: |
adb start-server
adb devices
adb kill-server
ls -la ~/.android
name: ADB Start Stop
- run:
command: >-
avdmanager create avd --force --name <<parameters.device_name>> --package
"system-images;<<parameters.platform_version>>;default;x86_64" --tag
default --device pixel
name: Create Android Emulator
- run:
background: true
command: >
$ANDROID_HOME/emulator/emulator
@<<parameters.device_name>> -version

$ANDROID_HOME/emulator/emulator
@<<parameters.device_name>> -skin 1080x1920 -cores 1 -gpu auto -accel on
-memory 1024 -no-audio -no-snapshot -no-boot-anim -no-window -logcat *:W
| grep -i 'ReactNative\|<<parameters.logcat_grep>>'
name: Start Android Emulator (background)
- run:
command: >
export BOOT=""

echo "Waiting for AVD to finish booting"

export PATH=$(dirname $(dirname $(command -v
android)))/platform-tools:$PATH

until [[ "$BOOT" =~ "1" ]]; do
sleep 5
export BOOT=$(adb -e shell getprop sys.boot_completed 2>&1)
done

sleep 15

adb shell settings put global window_animation_scale 0

adb shell settings put global transition_animation_scale 0

adb shell settings put global animator_duration_scale 0

echo "Android Virtual Device is now ready."
name: Wait for AVD to be ready
no_output_timeout: 5m

jobs:
checkout_code:
executor: rn/linux_js
executor:
name: rn/linux_js
node_version: "12.10.0"
steps:
- checkout
- persist_to_workspace:
root: .
paths: .

analyse:
root: .
analyse_js:
executor: rn/linux_js
steps:
- attach_workspace:
at: .
- rn/yarn_install
- run:
name: Install
command: yarn install --frozen-lockfile
- run:
name: Lint JS Code (ESLint)
command: yarn run lint
command: yarn lint
name: Run ESLint
- run:
command: yarn flow
name: Flow
command: yarn run flow
- run:
command: yarn test
name: Jest
command: yarn run test
e2e_release_ios:
executor:
name: rn/macos
xcode_version: "11.4.0"
steps:
- attach_workspace:
at: .
- rn/setup_macos_executor:
node_version: "12.10.0"
- rn/ios_simulator_start:
device: "iPhone 11"
- rn/yarn_install
- rn/pod_install:
pod_install_directory: "example/ios"
- run:
command: yarn detox:ios:build:release
name: build for detox
- run:
command: yarn detox:ios:test:release
name: test detox
e2e_release_android:
# we need to use mac to run emulator with acceleration
# see https://support.circleci.com/hc/en-us/articles/360000028928-Testing-with-Android-emulator-on-CircleCI-2-0
executor:
name: rn/macos
xcode_version: "11.4.0"
steps:
- attach_workspace:
at: .
- setup_macos_executor:
node_version: "12.10.0"
- rn/yarn_install
- android_emulator_start:
logcat_grep: "com.reactcommunity.rndatetimepicker"
- run:
command: yarn detox:android:build:release
name: build for detox
- run:
command: yarn detox:android:test:release
name: test detox

workflows:
test:
jobs:
- checkout_code
- analyse:
- analyse_js:
requires:
- checkout_code
# - rn/android_build:
# name: build_android_release
# project_path: "example/android"
# requires:
# - analyse
# - rn/android_test:
# detox_configuration: "android.emu.release"
# requires:
# - build_android_release
# - rn/ios_build_and_test:
# project_path: "example/ios/example.xcodeproj"
# device: "iPhone X"
# build_configuration: "Release"
# scheme: "example"
# detox_configuration: "ios.sim.release"
# requires:
# - analyse
# - rn/android_build:
# build_type: release
# name: build_android_release
# project_path: example/android
# requires:
# - analyse_js
# - rn/android_test:
# detox_configuration: android.emu.release
# requires:
# - build_android_release
- e2e_release_ios:
requires:
- analyse_js
# - e2e_release_android:
# requires:
# - analyse_js
35 changes: 5 additions & 30 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
node_modules/react-native/Libraries/react-native/React.js

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

Expand All @@ -21,15 +13,15 @@ node_modules/react-native/Libraries/polyfills/.*
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js
.*/Libraries/Utilities/LoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/interface.js
node_modules/react-native/flow/

[options]
Expand All @@ -42,27 +34,10 @@ module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
Expand Down Expand Up @@ -96,4 +71,4 @@ untyped-import
untyped-type-import

[version]
^0.98.0
^0.113.0
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ local.properties
# BUCK
buck-out/
\.buckd/
*.keystore

# Editor config
.vscode
Expand Down
1 change: 0 additions & 1 deletion example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore

# fastlane
#
Expand Down
2 changes: 1 addition & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const App = () => {
</View>
<View style={styles.button}>
<Button
testID="datePickerButton"
testID="datePickerButtonSpinner"
onPress={showDatepickerSpinner}
title="Show date picker spinner!"
/>
Expand Down
Loading