forked from alibaba/weex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
227 lines (212 loc) · 8.46 KB
/
.travis.yml
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
os: linux
language: node_js
node_js: 12.6.0
matrix:
fast_finish: true
include:
- env: TEST_SUITE=danger
- env: TEST_SUITE=jsfm
- env: TEST_SUITE=ios
os: osx
osx_image: xcode12
language: objective-c
- env: TEST_SUITE=android ABI=armeabi-v7a
language: android
dist: trusty
jdk: oraclejdk8
android:
components:
- android-28
- extra-android-m2repository
- env: TEST_SUITE=android ABI=arm64-v8a
language: android
dist: trusty
jdk: oraclejdk8
android:
components:
- android-28
- extra-android-m2repository
- env: TEST_SUITE=android ABI=x86
language: android
dist: trusty
jdk: oraclejdk8
android:
components:
- android-28
- extra-android-m2repository
- env: TEST_SUITE=android ABI=x86_64
language: android
dist: trusty
jdk: oraclejdk8
android:
components:
- android-28
- extra-android-m2repository
# static check
- env: TEST_SUITE=static_code_analysis OCLINT=true
os: osx
osx_image: xcode12
language: objective-c
- env: TEST_SUITE=static_code_analysis ANDROID_LINT=true
language: android
dist: trusty
jdk: oraclejdk8
android:
components:
- android-28
- extra-android-m2repository
cache:
directories:
- npm
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
- $HOME/android-ndk-r18b
- bundle
git:
depth: false
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -fr $HOME/node_modules/*
before_install:
- |
# install android lint
if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${ANDROID_LINT}" = "true") ]]; then
apt-get install rubygems
gem install bundler
bundle install
fi
# install oclint
if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then
brew cask uninstall oclint
brew tap oclint/formulae
brew install oclint
fi
install:
- |
if [[ ("$TEST_SUITE" = "android") || ("${ANDROID_LINT}" = "true") ]]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
nvm install 12.6.0
npm install
echo y | sdkmanager "cmake;3.6.4111459"
if find "${HOME}/android-ndk-r18b" -mindepth 1 | read; then
echo "NDK cache hit"
else
echo "NDK cache missed"
rmdir "${HOME}/android-ndk-r18b"
fi
if [[ ! -d "${HOME}/android-ndk-r18b" ]]; then
wget https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip
unzip android-ndk-r18b-linux-x86_64.zip -d $HOME
fi
export ANDROID_NDK_HOME=$HOME/android-ndk-r18b
export PATH=$PATH:$ANDROID_NDK_HOME
echo "ndk.dir=$ANDROID_NDK_HOME" > android/local.properties
elif [[ ("$TEST_SUITE" = "jsfm") || ("$TEST_SUITE" = "danger") || ("${OCLINT}" = "true") ]]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
nvm install 12.6.0
npm install
elif [[ ("$TEST_SUITE" = "ios") ]]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
nvm install 12.6.0
git submodule update --init --remote
cd weex-playground/ios && bash update_podfile_for_travisci.sh
cd ../../ && npm install
cd weex-playground/ios && bundle install && pod install --repo-update
cd ../../
fi
script:
- |
case $TEST_SUITE in
"android")
case $ABI in
"armeabi-v7a" )
GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false -PsupportX86_64=false"
;;
"arm64-v8a" )
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false -PsupportX86_64=false"
;;
"x86" )
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true -PsupportX86_64=false"
;;
"x86_64" )
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=false -PsupportX86_64=true"
;;
"*" )
GRADLE_ABI=""
;;
esac
if npm run danger -- ci --dangerfile ./dangerfile-android.js | grep -q "hasAndroidFile" ; then
cd android
./gradlew clean assembleRelease --quiet -PbuildRuntimeApi=true ${GRADLE_ABI} -PapachePackageName="false" || exit 1
./gradlew :weex_sdk:assembleRelease --quiet -PbuildRuntimeApi=true ${GRADLE_ABI} -PapachePackageName="true" || exit 1
if [[ "$ABI" != "x86_64" ]]; then
./gradlew assembleRelease --quiet ${GRADLE_ABI} -PbuildRuntimeApi=false -Pjsc_url="https://raw.githubusercontent.com/apache/incubator-weex/release/0.26/android/sdk/weex_sdk-0.26.0.aar" -Paar_name="weex_sdk" -PJSInterpolatorName="JavaScriptCore" -PapachePackageName="false" || exit 1
./gradlew :weex_sdk:assembleRelease --quiet ${GRADLE_ABI} -PbuildRuntimeApi=false -Pjsc_url="https://raw.githubusercontent.com/apache/incubator-weex/release/0.26/android/sdk/weex_sdk-0.26.0.aar" -Paar_name="weex_sdk" -PJSInterpolatorName="JavaScriptCore" -PapachePackageName="true" || exit 1
fi
fi
;;
"jsfm" )
npm run danger -- ci -i jsfm --dangerfile ./dangerfile-jsfm.js
;;
"danger" )
npm run danger -- ci -i danger --dangerfile ./dangerfile.js
;;
"ios" )
if npm run danger -- ci --dangerfile ./dangerfile-ios.js | grep -q "hasIosFile" ; then
# build WeexSDK and run WeexSDKTests
xcodebuild -quiet -project ios/sdk/WeexSDK.xcodeproj test -scheme WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" || exit 1
# build WeexDemo and run WeexDemo test
cd weex-playground/ios && mkdir tmp && mv * tmp;cd tmp
xcodebuild -quiet -workspace WeexDemo.xcworkspace test -scheme WeexDemo CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" || exit 1
fi
;;
esac
if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then
if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep -q "hasCFile" ; then
echo "hasCFile"
cd ios/sdk && xcodebuild | xcpretty -r json-compilation-database -o compile_commands.json
oclint-json-compilation-database oclint_args -- \
-disable-rule=ShortVariableName \
-disable-rule=LongLine \
-disable-rule=LongMethod \
-disable-rule=HighNcssMethod \
-disable-rule=LongVariableName \
-disable-rule=HighCyclomaticComplexity \
-disable-rule=HighNPathComplexity \
-disable-rule=UnusedLocalVariable \
-disable-rule=DoubleNegative \
-disable-rule=MultipleUnaryOperator \
-disable-rule=DeepNestedBlock \
-disable-rule=AssignIvarOutsideAccessors \
-disable-rule=BitwiseOperatorInConditional \
-max-priority-1=15000 \
-max-priority-2=15000 \
-max-priority-3=15000 > oclint.log
export TITLE="OCLint Result"
cd ../../ && npm run danger -- ci -i oclint --dangerfile ./dangerfile-output.js || exit 1
fi
fi
if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${ANDROID_LINT}" = "true") ]]; then
if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep -q "hasAndroidFile" ; then
echo "hasAndroidFile"
cd android
./gradlew :weex_sdk:lintLegacyRelease -PapachePackageName="false" --quiet
./gradlew :weex_sdk:lintApacheRelease -PapachePackageName="true" --quiet
export TITLE="AndroidLint Result"
cd ../ && npm run danger -- ci -i androidlint --dangerfile ./dangerfile-output.js || exit 1
fi
fi
notifications:
webhooks:
on_pull_requests: false
urls:
- https://oapi.dingtalk.com/robot/send?access_token=5a6be5eb6ad180fa4d04bdda0b24857ee49c3dd985361efdf0964aa9134ee623
on_success: never
on_failure: always
email:
recipients:
on_success: never
on_failure: always