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

Commit

Permalink
finish
Browse files Browse the repository at this point in the history
  • Loading branch information
wrmswindmill committed Jul 31, 2019
1 parent cd13248 commit 0400639
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 97 deletions.
182 changes: 88 additions & 94 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ before_install:
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 oclint
if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") ]]; then
brew cask uninstall oclint
brew tap oclint/formulae
brew install oclint
fi
Expand All @@ -101,112 +101,106 @@ install:
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://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash
# nvm install 12.6.0
# npm install
# elif [[ ("$TEST_SUITE" = "ios") ]]; then
# curl -o- https://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash
# nvm install 12.6.0
elif [[ ("$TEST_SUITE" = "jsfm") || ("$TEST_SUITE" = "danger") || ("${OCLINT}" = "true") ]]; then
curl -o- https://github.com/raw/nvm-sh/nvm/v0.34.0/install.sh | bash
nvm install 12.6.0
npm install
elif [[ ("$TEST_SUITE" = "ios") ]]; then
curl -o- https://github.com/raw/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 && pod install --repo-update
# cd ../../
# elif [[ ("$TEST_SUITE" = "code_format") ]]; then
# bundle install
git submodule update --init --remote
cd weex-playground/ios && bash update_podfile_for_travisci.sh
cd ../../ && npm install
cd weex-playground/ios && pod install --repo-update
cd ../../
elif [[ ("$TEST_SUITE" = "code_format") ]]; then
bundle install
fi
script:
- |
# case $TEST_SUITE in
# "android")
# case $ABI in
# "armeabi-v7a" )
# GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false"
# ;;
# "arm64-v8a" )
# GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false"
# ;;
# "x86" )
# GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true"
# ;;
# "*" )
# GRADLE_ABI=""
# ;;
# esac
# if npm run danger -- ci --dangerfile ./dangerfile-android.js | grep -q "hasAndroidFile" ; then
# cd android
# ./gradlew clean install -PbuildRuntimeApi=true ${GRADLE_ABI} --info
# ./gradlew install -PbuildRuntimeApi=false ${GRADLE_ABI} --info
# 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
case $TEST_SUITE in
"android")
case $ABI in
"armeabi-v7a" )
GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false"
;;
"arm64-v8a" )
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false"
;;
"x86" )
GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true"
;;
"*" )
GRADLE_ABI=""
;;
esac
if npm run danger -- ci --dangerfile ./dangerfile-android.js | grep -q "hasAndroidFile" ; then
cd android
./gradlew clean install -PbuildRuntimeApi=true ${GRADLE_ABI} --info
./gradlew install -PbuildRuntimeApi=false ${GRADLE_ABI} --info
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 \
# -max-priority-1=15000 \
# -max-priority-2=15000 \
# -max-priority-3=15000 > oclint.log
# export COMMAND="cat ios/sdk/oclint.log | grep -i \"P[1|2]\""
# cd ../../ && npm run danger -- ci -i oclint --dangerfile ./dangerfile-output.js
# fi
# fi
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 \
-max-priority-1=15000 \
-max-priority-2=15000 \
-max-priority-3=15000 > oclint.log
export TITLE="OCLint Result"
export COMMAND="cat ios/sdk/oclint.log | grep -i \"P[1|2]\""
cd ../../ && npm run danger -- ci -i oclint --dangerfile ./dangerfile-output.js
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
# # use androidLint danger plugin to report android lint information
# # androidLint danger need the project .git directory to get github repo infomation
# # and it read from .git from current directory
# # so temp to mv .git to current directory and mv .git to it's origin directory after exec androidLint plugin
# # mv ../.git ./ && bundle exec danger --danger_id=androidLint --dangerfile=../Dangerfile-android && mv .git ../
# bundle exec danger --danger_id=androidLint --dangerfile=../Dangerfile-android
./gradlew lint --quiet
export COMMAND="echo AndroidLint"
cd ../ && npm run danger -- ci -i androidlint --dangerfile ./dangerfile-output.js && cd android
export TITLE="AndroidLint Result"
export COMMAND="cat android/sdk/build/reports/lint-results.xml"
cd ../ && npm run danger -- ci -i androidlint --dangerfile ./dangerfile-output.js
fi
fi
# if [[ ("$TEST_SUITE" = "code_format") ]]; then
# echo "exec code format"
# bundle exec danger --danger_id=codeFormat
# fi
if [[ ("$TEST_SUITE" = "code_format") ]]; then
echo "exec code format"
bundle exec danger --danger_id=codeFormat
fi
notifications:
webhooks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ public Class<? extends WXComponent> getComponentClass(String name, String classN
}
}

}
}
5 changes: 4 additions & 1 deletion dangerfile-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ import { fail, warn } from 'danger'

const shell = require('shelljs')
const command = process.env.COMMAND
const title = process.env.TITLE
const child = shell.exec(command)

if (child.stdout !== '') {
warn(`## ${title}`)
warn(child.stdout)
}
if (child.stderr !== '') {
fail(`## ${title}`)
fail(child.stderr)
}
1 change: 0 additions & 1 deletion ios/sdk/WeexSDK/Sources/Bridge/JSContext+Weex.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@
@property (nonatomic, strong) NSString *instanceId;

@end

0 comments on commit 0400639

Please sign in to comment.