Skip to content

Commit

Permalink
Add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuxiang committed Apr 26, 2018
1 parent d5b2af4 commit d71ec15
Show file tree
Hide file tree
Showing 5 changed files with 727 additions and 777 deletions.
115 changes: 115 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
aliases:
- &android
components:
- build-tools-23.0.1
- android-23
- extra-android-m2repository
- extra-android-support

- &android-cache
directories:
- ~/.cache/yarn
- ~/.gradle/caches/modules-2
- ~/.gradle/wrapper

- &ios-cache
directories:
- ~/.rncache
- ~/Library/Caches/Yarn
- ~/Library/Caches/CocoaPods

- &init-new-project
|
nvm install node
yarn global add react-native-cli
react-native init App --version="0.53.3"
cd App
yarn add react-native-amap-geolocation

jobs:
include:
- stage: "test js"
language: node_js
node_js: node
cache: yarn
script:
- node node_modules/react-native/local-cli/cli.js bundle --entry-file index.js --bundle-output bundle.js
- ls -l bundle.*

- stage: "build test for example"
language: android
jdk: oraclejdk8
android: *android
before_cache:
- rm ~/.gradle/caches/modules-2/modules-2.lock
cache: *android-cache
script:
- nvm install node
- yarn
- cd android
- ./gradlew build
- ls -l app/build/outputs/apk

- stage: "build test for example"
language: objective-c
osx_image: xcode9.3
cache: *ios-cache
before_install:
script:
- nvm install node
- brew install yarn
- yarn
- cd ios
- pod install --repo-update
- xcodebuild -workspace RNAMapGeolocation.xcworkspace -scheme RNAMapGeolocation -sdk iphonesimulator -quiet

- stage: "build test for new project"
language: android
jdk: oraclejdk8
android: *android
before_cache:
- rm ~/.gradle/caches/modules-2/modules-2.lock
cache: *android-cache
script:
- *init-new-project
- react-native link
- cd android
- ./gradlew build
- ls -l app/build/outputs/apk

- stage: "build test for new project"
language: objective-c
osx_image: xcode9.3
cache: *ios-cache
script:
- brew install yarn
- *init-new-project
- cd ios
- |
cat << EOF > Podfile
platform :ios, '9.0'
target 'App' do
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'react-native-amap-geolocation', path: '../node_modules/react-native-amap-geolocation/lib/ios'
end
EOF
- pod install --repo-update
- xcodebuild -workspace App.xcworkspace -scheme App -sdk iphonesimulator -quiet

stages:
- "test js"
- name: "build test for example"
if: branch = master
- name: "build test for new project"
if: branch = release
43 changes: 21 additions & 22 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@ platform :ios, '8.0'
# The target name is most likely the name of your project.
target 'RNAMapGeolocation' do

# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # Needed for debugging
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

pod 'react-native-amap-geolocation', path: '../lib/ios'
end
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'GLog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

pod 'react-native-amap-geolocation', path: '../lib/ios'
end
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
},
"devDependencies": {
"babel-preset-react-native": "^4.0.0",
"react": "^16.3.1",
"react-native": "^0.55.3"
"react": "^16.2.0",
"react-native": "^0.53.3"
},
"presets": ["react-native"],
"rnpm": {
Expand Down
53 changes: 27 additions & 26 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@ platform :ios, '8.0'
# The target name is most likely the name of your project.
target 'Your Target' do

# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # Needed for debugging
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'react-native-amap-geolocation', path: '../node_modules/react-native-amap-geolocation/lib/ios'
end
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # Needed for debugging
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

pod 'react-native-amap-geolocation', path: '../node_modules/react-native-amap-geolocation/lib/ios'
end
```
See also: https://facebook.github.io/react-native/docs/0.53/integration-with-existing-apps.html

Then:
```shell
Expand All @@ -55,12 +56,12 @@ pod install
import { Geolocation } from "react-native-amap-geolocation"

await Geolocation.init({
ios: "9bd6c82e77583020a73ef1af59d0c759",
android: "043b24fe18785f33c491705ffe5b6935"
ios: "9bd6c82e77583020a73ef1af59d0c759",
android: "043b24fe18785f33c491705ffe5b6935"
})
Geolocation.setOptions({
interval: 8000,
distanceFilter: 20,
interval: 8000,
distanceFilter: 20,
})
Geolocation.addLocationListener(location => console.log(location))
Geolocation.start()
Expand Down
Loading

0 comments on commit d71ec15

Please sign in to comment.