1
1
os : linux
2
2
language : node_js
3
- node_js : 7.6
3
+ node_js : 12.6.0
4
4
matrix :
5
5
fast_finish : true
6
6
include :
@@ -25,29 +25,63 @@ matrix:
25
25
- android-26
26
26
- extra-android-m2repository
27
27
- env : TEST_SUITE=android ABI=x86
28
+ language : android
29
+ dist : trusty
30
+ jdk : oraclejdk8
31
+ android :
32
+ components :
33
+ - android-26
34
+ - extra-android-m2repository
35
+ # static check
36
+ - env : TEST_SUITE=static_code_analysis OCLINT=true
37
+ osx_image : xcode7.2
38
+ language : objective-c
39
+ - env : TEST_SUITE=static_code_analysis ANDROID_LINT=true
28
40
language : android
29
41
dist : trusty
30
42
jdk : oraclejdk8
31
43
android :
32
44
components :
33
45
- android-26
34
46
- extra-android-m2repository
47
+
35
48
cache :
36
49
directories :
37
50
- npm
38
51
- $HOME/.gradle/caches/
39
52
- $HOME/.gradle/wrapper/
40
53
- $HOME/.android/build-cache
41
54
- $HOME/android-ndk-r18b
55
+ - bundle
56
+
42
57
before_cache :
43
58
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
44
59
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
60
+ - rm -fr $HOME/node_modules/*
61
+
62
+ before_install :
63
+ - |
64
+ # install android lint
65
+ if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${ANDROID_LINT}" = "true") ]]; then
66
+ apt-get install rubygems
67
+ gem install bundler
68
+ bundle install
69
+ fi
70
+
71
+ # install oclint
72
+ if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then
73
+ brew cask uninstall oclint
74
+ brew tap oclint/formulae
75
+ brew install oclint
76
+ fi
77
+
78
+
79
+
45
80
install :
46
81
- |
47
- case $TEST_SUITE in
48
- "android")
82
+ if [[ ("$TEST_SUITE" = "android") || ("${ANDROID_LINT}" = "true") ]]; then
49
83
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
50
- nvm install 7.6
84
+ nvm install 12.6.0
51
85
npm install
52
86
echo y | sdkmanager "cmake;3.6.4111459"
53
87
if find "${HOME}/android-ndk-r18b" -mindepth 1 | read; then
@@ -64,11 +98,22 @@ install:
64
98
export ANDROID_NDK_HOME=$HOME/android-ndk-r18b
65
99
export PATH=$PATH:$ANDROID_NDK_HOME
66
100
echo "ndk.dir=$ANDROID_NDK_HOME" > android/local.properties
67
- ;;
68
- "jsfm" | "danger" | "ios" )
101
+ elif [[ ("$TEST_SUITE" = "jsfm") || ("$TEST_SUITE" = "danger") || ("${OCLINT}" = "true") ]]; then
102
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
103
+ nvm install 12.6.0
69
104
npm install
70
- ;;
71
- esac
105
+ elif [[ ("$TEST_SUITE" = "ios") ]]; then
106
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
107
+ nvm install 12.6.0
108
+
109
+ git submodule update --init --remote
110
+ cd weex-playground/ios && bash update_podfile_for_travisci.sh
111
+ cd ../../ && npm install
112
+ cd weex-playground/ios && pod install --repo-update
113
+ cd ../../
114
+ fi
115
+
116
+
72
117
script :
73
118
- |
74
119
case $TEST_SUITE in
@@ -87,29 +132,65 @@ script:
87
132
GRADLE_ABI=""
88
133
;;
89
134
esac
90
-
91
- hasAndroidFile=$(npm run danger -- run --dangerfile ./dangerfile-android.js)
92
- echo "The value of hasAndroidFile is ${hasAndroidFile}"
93
- if [[ "$hasAndroidFile" =~ "hasAndroidFile" ]]; then
135
+ if npm run danger -- ci --dangerfile ./dangerfile-android.js | grep -q "hasAndroidFile" ; then
94
136
cd android
95
137
./gradlew clean install -PbuildRuntimeApi=true ${GRADLE_ABI} --info
96
138
./gradlew install -PbuildRuntimeApi=false ${GRADLE_ABI} --info
97
139
fi
98
140
;;
99
141
"jsfm" )
100
- npm run danger -- run --dangerfile ./dangerfile-jsfm.js
142
+ npm run danger -- ci -i jsfm --dangerfile ./dangerfile-jsfm.js
101
143
;;
102
144
"danger" )
103
- npm run danger -- run --dangerfile ./dangerfile.js
145
+ npm run danger -- ci -i danger --dangerfile ./dangerfile.js
104
146
;;
105
147
"ios" )
106
- hasIosFile=$(npm run danger -- run --dangerfile ./dangerfile-ios.js)
107
- echo "The value of hasIosFile is ${hasIosFile}"
108
- if [[ "$hasIosFile" =~ "hasIosFile" ]]; then
109
- xcodebuild -project ios/sdk/WeexSDK.xcodeproj test -scheme WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6"
148
+ if npm run danger -- ci --dangerfile ./dangerfile-ios.js | grep -q "hasIosFile" ; then
149
+ # build WeexSDK and run WeexSDKTests
150
+ 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
151
+ # build WeexDemo and run WeexDemo test
152
+ cd weex-playground/ios && mkdir tmp && mv * tmp;cd tmp
153
+ xcodebuild -quiet -workspace WeexDemo.xcworkspace test -scheme WeexDemo CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" || exit 1
110
154
fi
111
155
;;
112
156
esac
157
+
158
+ if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then
159
+ if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep -q "hasCFile" ; then
160
+ echo "hasCFile"
161
+ cd ios/sdk && xcodebuild | xcpretty -r json-compilation-database -o compile_commands.json
162
+ oclint-json-compilation-database oclint_args -- \
163
+ -disable-rule=ShortVariableName \
164
+ -disable-rule=LongLine \
165
+ -disable-rule=LongMethod \
166
+ -disable-rule=HighNcssMethod \
167
+ -disable-rule=LongVariableName \
168
+ -disable-rule=HighCyclomaticComplexity \
169
+ -disable-rule=HighNPathComplexity \
170
+ -disable-rule=UnusedLocalVariable \
171
+ -disable-rule=DoubleNegative \
172
+ -disable-rule=MultipleUnaryOperator \
173
+ -disable-rule=DeepNestedBlock \
174
+ -disable-rule=AssignIvarOutsideAccessors \
175
+ -disable-rule=BitwiseOperatorInConditional \
176
+ -max-priority-1=15000 \
177
+ -max-priority-2=15000 \
178
+ -max-priority-3=15000 > oclint.log
179
+ export TITLE="OCLint Result"
180
+ cd ../../ && npm run danger -- ci -i oclint --dangerfile ./dangerfile-output.js
181
+ fi
182
+ fi
183
+
184
+ if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${ANDROID_LINT}" = "true") ]]; then
185
+ if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep -q "hasAndroidFile" ; then
186
+ echo "hasAndroidFile"
187
+ cd android
188
+ ./gradlew :weex_sdk:lint --quiet
189
+ export TITLE="AndroidLint Result"
190
+ cd ../ && npm run danger -- ci -i androidlint --dangerfile ./dangerfile-output.js
191
+ fi
192
+ fi
193
+
113
194
notifications :
114
195
webhooks :
115
196
on_pull_requests : false
0 commit comments