Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit b189e3d

Browse files
committed
test for dangerfile ruby
1 parent a52a635 commit b189e3d

File tree

1 file changed

+147
-149
lines changed

1 file changed

+147
-149
lines changed

.travis.yml

Lines changed: 147 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,45 @@ matrix:
66
include:
77
- env: TEST_SUITE=danger
88
- env: TEST_SUITE=jsfm
9-
# - env: TEST_SUITE=ios
10-
# language: objective-c
11-
# - env: TEST_SUITE=android ABI=armeabi-v7a
12-
# language: android
13-
# dist: trusty
14-
# jdk: oraclejdk8
15-
# android:
16-
# components:
17-
# - android-26
18-
# - extra-android-m2repository
19-
# - env: TEST_SUITE=android ABI=arm64-v8a
20-
# language: android
21-
# dist: trusty
22-
# jdk: oraclejdk8
23-
# android:
24-
# components:
25-
# - android-26
26-
# - extra-android-m2repository
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-
36-
# # static check
37-
# - env: STATIC_CODE_ANALYSIS=true CHECK_C=true
38-
# language: objective-c
39-
# osx_image: xcode7.2
40-
# - env: STATIC_CODE_ANALYSIS=true CHECK_ANDROID=true
41-
# language: android
42-
# dist: trusty
43-
# jdk: oraclejdk8
44-
# android:
45-
# components:
46-
# - android-26
47-
# - extra-android-m2repository
48-
9+
- env: TEST_SUITE=ios
10+
language: objective-c
11+
- env: TEST_SUITE=android ABI=armeabi-v7a
12+
language: android
13+
dist: trusty
14+
jdk: oraclejdk8
15+
android:
16+
components:
17+
- android-26
18+
- extra-android-m2repository
19+
- env: TEST_SUITE=android ABI=arm64-v8a
20+
language: android
21+
dist: trusty
22+
jdk: oraclejdk8
23+
android:
24+
components:
25+
- android-26
26+
- extra-android-m2repository
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: STATIC_CODE_ANALYSIS=true CHECK_C=true
37+
language: objective-c
38+
osx_image: xcode7.2
39+
- env: STATIC_CODE_ANALYSIS=true CHECK_ANDROID=true
40+
language: android
41+
dist: trusty
42+
jdk: oraclejdk8
43+
android:
44+
components:
45+
- android-26
46+
- extra-android-m2repository
47+
# format code using clang-format
4948
- env: FORMAT_CODE=true
5049
language: ruby
5150

@@ -59,136 +58,135 @@ cache:
5958
before_cache:
6059
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
6160
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
61+
# - rm -rf $HOME/bundle
6262

63-
# before_install:
64-
# - |
63+
before_install:
64+
- |
6565
# install oclint
66-
# if [[ ("${STATIC_CODE_ANALYSIS}" = "true") && ("${CHECK_C}" = "true") ]]; then
67-
# brew cask uninstall oclint
68-
# brew tap oclint/formulae
69-
# brew install oclint
70-
# fi
66+
if [[ ("${STATIC_CODE_ANALYSIS}" = "true") && ("${CHECK_C}" = "true") ]]; then
67+
brew cask uninstall oclint
68+
brew tap oclint/formulae
69+
brew install oclint
70+
fi
7171
7272
install:
7373
- |
74-
# if [[ ("$TEST_SUITE" = "android") || ("${CHECK_ANDROID}" = "true") ]]; then
75-
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
76-
# nvm install 7.6
77-
# npm install
78-
# echo y | sdkmanager "cmake;3.6.4111459"
79-
# if find "${HOME}/android-ndk-r18b" -mindepth 1 | read; then
80-
# echo "NDK cache hit"
81-
# else
82-
# echo "NDK cache missed"
83-
# rmdir "${HOME}/android-ndk-r18b"
84-
# fi
85-
86-
# if [[ ! -d "${HOME}/android-ndk-r18b" ]]; then
87-
# wget https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip
88-
# unzip android-ndk-r18b-linux-x86_64.zip -d $HOME
89-
# fi
90-
# export ANDROID_NDK_HOME=$HOME/android-ndk-r18b
91-
# export PATH=$PATH:$ANDROID_NDK_HOME
92-
# echo "ndk.dir=$ANDROID_NDK_HOME" > android/local.properties
93-
# elif [[ ("$TEST_SUITE" = "jsfm") || ("$TEST_SUITE" = "danger") || ("${CHECK_C}" = "true") ]]; then
94-
# npm install
95-
# elif [[ ("$TEST_SUITE" = "ios") ]]; then
96-
# bash weex-playground/ios/update_podfile_for_travisci.sh
97-
# npm install
98-
# cd weex-playground/ios && pod install --repo-update
99-
# cd ../../
100-
# fi
74+
if [[ ("$TEST_SUITE" = "android") || ("${CHECK_ANDROID}" = "true") ]]; then
75+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
76+
nvm install 7.6
77+
npm install
78+
echo y | sdkmanager "cmake;3.6.4111459"
79+
if find "${HOME}/android-ndk-r18b" -mindepth 1 | read; then
80+
echo "NDK cache hit"
81+
else
82+
echo "NDK cache missed"
83+
rmdir "${HOME}/android-ndk-r18b"
84+
fi
10185
102-
before_script:
103-
- |
104-
if [[ ("FORMAT_CODE" = "true" )]]; then
105-
bundle exec danger
86+
if [[ ! -d "${HOME}/android-ndk-r18b" ]]; then
87+
wget https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip
88+
unzip android-ndk-r18b-linux-x86_64.zip -d $HOME
89+
fi
90+
export ANDROID_NDK_HOME=$HOME/android-ndk-r18b
91+
export PATH=$PATH:$ANDROID_NDK_HOME
92+
echo "ndk.dir=$ANDROID_NDK_HOME" > android/local.properties
93+
elif [[ ("$TEST_SUITE" = "jsfm") || ("$TEST_SUITE" = "danger") || ("${CHECK_C}" = "true") ]]; then
94+
npm install
95+
elif [[ ("$TEST_SUITE" = "ios") ]]; then
96+
bash weex-playground/ios/update_podfile_for_travisci.sh
97+
npm install
98+
cd weex-playground/ios && pod install --repo-update
99+
cd ../../
106100
fi
107101
108102
script:
109103
- |
110104
case $TEST_SUITE in
111-
# "android")
112-
# case $ABI in
113-
# "armeabi-v7a" )
114-
# GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false"
115-
# ;;
116-
# "arm64-v8a" )
117-
# GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false"
118-
# ;;
119-
# "x86" )
120-
# GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true"
121-
# ;;
122-
# "*" )
123-
# GRADLE_ABI=""
124-
# ;;
125-
# esac
105+
"android")
106+
case $ABI in
107+
"armeabi-v7a" )
108+
GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false"
109+
;;
110+
"arm64-v8a" )
111+
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false"
112+
;;
113+
"x86" )
114+
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true"
115+
;;
116+
"*" )
117+
GRADLE_ABI=""
118+
;;
119+
esac
126120
127-
# hasAndroidFile=$(npm run danger -- run --dangerfile ./dangerfile-android.js)
128-
# echo "The value of hasAndroidFile is ${hasAndroidFile}"
129-
# if [[ "$hasAndroidFile" =~ "hasAndroidFile" ]]; then
130-
# cd android
131-
# ./gradlew clean install -PbuildRuntimeApi=true ${GRADLE_ABI} --info
132-
# ./gradlew install -PbuildRuntimeApi=false ${GRADLE_ABI} --info
133-
# fi
134-
# ;;
121+
hasAndroidFile=$(npm run danger -- run --dangerfile ./dangerfile-android.js)
122+
echo "The value of hasAndroidFile is ${hasAndroidFile}"
123+
if [[ "$hasAndroidFile" =~ "hasAndroidFile" ]]; then
124+
cd android
125+
./gradlew clean install -PbuildRuntimeApi=true ${GRADLE_ABI} --info
126+
./gradlew install -PbuildRuntimeApi=false ${GRADLE_ABI} --info
127+
fi
128+
;;
135129
"jsfm" )
136130
npm run danger -- run --dangerfile ./dangerfile-jsfm.js
137131
;;
138132
"danger" )
139133
npm run danger -- run --dangerfile ./dangerfile.js
140134
;;
141-
# "ios" )
142-
# hasIosFile=$(npm run danger -- run --dangerfile ./dangerfile-ios.js)
143-
# echo "The value of hasIosFile is ${hasIosFile}"
144-
# if [[ "$hasIosFile" =~ "hasIosFile" ]]; then
145-
# # build WeexSDK and run WeexSDKTests
146-
# xcodebuild -project ios/sdk/WeexSDK.xcodeproj test -scheme WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" | egrep -A 5 error:
147-
# # build WeexDemo and run WeexDemo test
148-
# xcodebuild -workspace weex-playground/ios/WeexDemo.xcworkspace test -scheme WeexDemo CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" | egrep -A 5 error:
149-
# fi
150-
# ;;
135+
"ios" )
136+
hasIosFile=$(npm run danger -- run --dangerfile ./dangerfile-ios.js)
137+
echo "The value of hasIosFile is ${hasIosFile}"
138+
if [[ "$hasIosFile" =~ "hasIosFile" ]]; then
139+
# build WeexSDK and run WeexSDKTests
140+
xcodebuild -project ios/sdk/WeexSDK.xcodeproj test -scheme WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" | egrep -A 5 error:
141+
# build WeexDemo and run WeexDemo test
142+
xcodebuild -workspace weex-playground/ios/WeexDemo.xcworkspace test -scheme WeexDemo CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination "platform=iOS Simulator,name=iPhone 6" | egrep -A 5 error:
143+
fi
144+
;;
151145
esac
152146
153-
# if [[ ("${STATIC_CODE_ANALYSIS}" = "true") && ("${CHECK_C}" = "true") ]]; then
154-
# hasCFile=$(npm run danger -- run --dangerfile ./dangerfile-static-check.js)
155-
# echo "The value of hasCFile is ${hasCFile}"
156-
# if [[ "$hasCFile" =~ "hasCFile" ]]; then
157-
# echo "hasCFile"
158-
# cd ios/sdk && xcodebuild | xcpretty -r json-compilation-database -o compile_commands.json
159-
# oclint-json-compilation-database oclint_args -- \
160-
# -disable-rule=ShortVariableName \
161-
# -disable-rule=LongLine \
162-
# -disable-rule=LongMethod \
163-
# -disable-rule=HighNcssMethod \
164-
# -disable-rule=LongVariableName \
165-
# -disable-rule=HighCyclomaticComplexity \
166-
# -disable-rule=HighNPathComplexity \
167-
# -disable-rule=UnusedLocalVariable \
168-
# -disable-rule=DoubleNegative \
169-
# -disable-rule=MultipleUnaryOperator \
170-
# -disable-rule=DeepNestedBlock \
171-
# -max-priority-1=15000 \
172-
# -max-priority-2=15000 \
173-
# -max-priority-3=15000
174-
# fi
175-
# fi
147+
if [[ ("${STATIC_CODE_ANALYSIS}" = "true") && ("${CHECK_C}" = "true") ]]; then
148+
hasCFile=$(npm run danger -- run --dangerfile ./dangerfile-static-check.js)
149+
echo "The value of hasCFile is ${hasCFile}"
150+
if [[ "$hasCFile" =~ "hasCFile" ]]; then
151+
echo "hasCFile"
152+
cd ios/sdk && xcodebuild | xcpretty -r json-compilation-database -o compile_commands.json
153+
oclint-json-compilation-database oclint_args -- \
154+
-disable-rule=ShortVariableName \
155+
-disable-rule=LongLine \
156+
-disable-rule=LongMethod \
157+
-disable-rule=HighNcssMethod \
158+
-disable-rule=LongVariableName \
159+
-disable-rule=HighCyclomaticComplexity \
160+
-disable-rule=HighNPathComplexity \
161+
-disable-rule=UnusedLocalVariable \
162+
-disable-rule=DoubleNegative \
163+
-disable-rule=MultipleUnaryOperator \
164+
-disable-rule=DeepNestedBlock \
165+
-max-priority-1=15000 \
166+
-max-priority-2=15000 \
167+
-max-priority-3=15000
168+
fi
169+
fi
170+
171+
if [[ ("${STATIC_CODE_ANALYSIS}" = "true") && ("${CHECK_ANDROID}" = "true") ]]; then
172+
hasAndroidFile=$(npm run danger -- run --dangerfile ./dangerfile-static-check.js)
173+
echo "The value of hasAndroidFile is ${hasAndroidFile}"
174+
if [[ "$hasAndroidFile" =~ "hasAndroidFile" ]]; then
175+
# format code using google-java-format at first
176+
# for n in `find ./android -name "*.java"`; do
177+
# java -jar ./format-tool/google-java-format-1.7-all-deps.jar --replace $n
178+
# done
179+
# then run android lint
180+
# echo "hasAndroidFile"
181+
echo "run android lint"
182+
cd android
183+
./gradlew lint
184+
fi
185+
fi
176186
177-
# if [[ ("${STATIC_CODE_ANALYSIS}" = "true") && ("${CHECK_ANDROID}" = "true") ]]; then
178-
# hasAndroidFile=$(npm run danger -- run --dangerfile ./dangerfile-static-check.js)
179-
# echo "The value of hasAndroidFile is ${hasAndroidFile}"
180-
# if [[ "$hasAndroidFile" =~ "hasAndroidFile" ]]; then
181-
# # format code using google-java-format at first
182-
# # for n in `find ./android -name "*.java"`; do
183-
# # java -jar ./format-tool/google-java-format-1.7-all-deps.jar --replace $n
184-
# # done
185-
# # then run android lint
186-
# # echo "hasAndroidFile"
187-
# echo "run android lint"
188-
# cd android
189-
# ./gradlew lint
190-
# fi
191-
# fi
187+
if [[ ("FORMAT_CODE" = "true" )]]; then
188+
bundle exec danger
189+
fi
192190
193191
notifications:
194192
webhooks:

0 commit comments

Comments
 (0)