-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.travis.yml
More file actions
259 lines (244 loc) · 10.2 KB
/
.travis.yml
File metadata and controls
259 lines (244 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
addons:
artifacts: true
# Run in VM on Google Compute Engine, slower startup but runs faster (ignored on osx)
sudo: required
aliases:
- &android
components:
- tools
- platform-tools
- build-tools-28.0.3
- android-26
- android-28
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- sys-img-x86_64-android-26
- &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 12
nvm use 12
nvm alias default 12
yarn global add react-native-cli
react-native init App --version="0.59.9"
cd App
yarn add react-native-svg
jobs:
include:
- name: "test building js bundle"
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 -lh bundle.*
- name: "android e2e"
language: android
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
jdk: oraclejdk8
android: *android
before_cache:
- rm ~/.gradle/caches/modules-2/modules-2.lock
cache: *android-cache
before_install:
# Install SDK license so Android Gradle plugin can install deps.
- mkdir "$ANDROID_HOME/licenses" || true
- echo "d56f5187479451eabf01fb78af6dfcb131a6481e" >> "$ANDROID_HOME/licenses/android-sdk-license"
- echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" >> "$ANDROID_HOME/licenses/android-sdk-license"
# Install the rest of tools (e.g., avdmanager)
- echo 'count=0' > /home/travis/.android/repositories.cfg # Avoid harmless sdkmanager warning
- echo y | sdkmanager "platform-tools" >/dev/null
- echo y | sdkmanager "tools" >/dev/null # A second time per Travis docs, gets latest versions
- echo y | sdkmanager "build-tools;28.0.3" >/dev/null # Implicit gradle dependency - gradle drives changes
- echo y | sdkmanager "platforms;android-26" >/dev/null # We need the API of the emulator we will run
- echo y | sdkmanager "platforms;android-28" >/dev/null # We need the API of the current compileSdkVersion from gradle.properties
- echo y | sdkmanager "emulator" >/dev/null
- echo y | sdkmanager "extras;android;m2repository" >/dev/null
# Install the system image
- sdkmanager "system-images;android-26;google_apis;x86_64"
# This is cause of react-native: react native's Gradle tasks partially run even without running Detox'
# compile-from-source flavour :-/
# TODO find a way to get rid of this step
- echo y | sdkmanager ndk-bundle >/dev/null
- export ANDROID_NDK="$ANDROID_HOME/ndk-bundle"
# Need to update the tools so we'd have a decent 'emulator' bin and the newer 'avdmanager' (instead of the 'android' bin)
- echo yes | sdkmanager --update
- sdkmanager --list
# Install specific version of emulator
# https://aur.archlinux.org/packages/android-emulator/
# https://aur.archlinux.org/packages/android-emulator-canary/
- rm -rf $ANDROID_HOME/emulator
- cd $ANDROID_HOME
- sudo apt-get install -y libunwind8 libc++1
- wget -q https://dl.google.com/android/repository/emulator-linux-5889189.zip
- unzip -q emulator-linux-5889189.zip
- cd -
# Create emulator
- echo no | avdmanager create avd --force --name Nexus_5X_API_26 --abi x86_64 --device "Nexus 5X" -k "system-images;android-26;default;x86_64" -c 200M
- echo "skin.name=1080x1920" >> ~/.android/avd/Nexus_5X_API_26.avd/config.ini
- echo "vm.heapSize=512" >> ~/.android/avd/Nexus_5X_API_26.avd/config.ini
- echo "hw.ramSize=1024" >> ~/.android/avd/Nexus_5X_API_26.avd/config.ini
# Start emulator
- /usr/local/android-sdk/tools/emulator @Nexus_5X_API_26 -verbose -no-window -no-snapshot -no-boot-anim -no-accel -noaudio -camera-back none -camera-front none -gpu swiftshader_indirect &
- ./ci.android-waitforemulator.sh
- adb shell input keyevent 82 &
install:
- nvm install 10
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
- yarn global add react-native-cli
- yarn global add detox-cli
- yarn
script:
- detox build --configuration android.emu.release
- adb reverse tcp:8099 tcp:8099
- adb push android/app/build/outputs/apk/release/app-release.apk /data/local/tmp
- travis_wait adb shell pm install /data/local/tmp/app-release.apk
- adb shell rm /data/local/tmp/app-release.apk
- adb push android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk /data/local/tmp
- adb shell pm install /data/local/tmp/app-release-androidTest.apk
- adb shell rm /data/local/tmp/app-release-androidTest.apk
- adb shell dumpsys window windows | grep -E 'Not Responding' && adb shell input keyevent 61 && adb shell input keyevent 61 && adb shell input keyevent 66 || true
- adb shell dumpsys window windows | grep -E 'has stopped' && adb shell input keyevent 61 && adb shell input keyevent 66 || true
- echo '590000' > timeout.json
- detox test --configuration android.emu.release --loglevel trace --reuse --take-screenshots all
- name: "ios e2e"
language: objective-c
os: osx
osx_image: xcode10.2
env:
- REACT_NATIVE_VERSION=0.60.6
PATH=$PATH:~/Library/Python/2.7/bin
cache: *ios-cache
script:
- nvm install 10
- nvm use 10
- nvm alias default 10
- brew tap wix/brew
- brew install yarn
- brew install applesimutils
- yarn global add react-native-cli
- yarn global add detox-cli
- yarn
- cd ios
- gem install cocoapods
- pod install
- cd ..
- detox build --configuration ios.sim.release
- xcrun simctl shutdown all
- detox test --configuration ios.sim.release --cleanup --take-screenshots all
- name: "build new 0.59 project for android"
language: android
jdk: oraclejdk8
android: *android
before_cache:
- rm ~/.gradle/caches/modules-2/modules-2.lock
cache: *android-cache
script:
- *init-new-project
- yarn run react-native link
- cd android
- ./gradlew build
- ls -lh app/build/outputs/apk
- name: "build new 0.59 project for ios without cocoapods"
language: objective-c
osx_image: xcode10.2
env:
- REACT_NATIVE_VERSION=0.59.9
PATH=$PATH:~/Library/Python/2.7/bin
cache: *ios-cache
script:
- brew install yarn
- *init-new-project
- yarn run react-native link
- cd ios
- xcodebuild -project App.xcodeproj -configuration Debug -scheme App -sdk iphonesimulator -quiet
- name: "build new 0.59 project with pods"
language: objective-c
osx_image: xcode10.2
env:
- REACT_NATIVE_VERSION=0.59.9
PATH=$PATH:~/Library/Python/2.7/bin
cache: *ios-cache
script:
- brew install yarn
- *init-new-project
- cd ios
- |
cat << EOF > Podfile
platform :ios, '9.0'
target 'App' 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',
'RCTImage',
'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 'RNSVG', :path => '../node_modules/react-native-svg'
end
EOF
- pod install --repo-update
- xcodebuild -workspace App.xcworkspace -scheme App -sdk iphonesimulator -quiet
- name: "build new project for ios with auto-linking"
language: objective-c
os: osx
osx_image: xcode11.2
cache: *ios-cache
script:
- nvm install 12
- nvm use 12
- nvm alias default 12
- brew install yarn
- yarn global add react-native-cli
- react-native init App
- cd App
- yarn add react-native-svg
- cd ios
- pod install --repo-update
- xcodebuild -workspace App.xcworkspace -scheme App -sdk iphonesimulator -quiet
- name: "build new project for android with auto-linking"
language: android
jdk: oraclejdk8
android: *android
before_cache:
- rm ~/.gradle/caches/modules-2/modules-2.lock
cache: *android-cache
script:
- nvm install 12
- nvm use 12
- nvm alias default 12
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
- yarn global add react-native-cli
- react-native init App
- cd App
- yarn add react-native-svg
- cd android
- ./gradlew build
- ls -lh app/build/outputs/apk