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

Run android&js ci in linux #5

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 40 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,47 @@
language: objective-c
os:
- osx
- linux
language: ruby
rvm: 2.0.0
osx_image: xcode8.2
jdk: oraclejdk8
env:
matrix:
- TEST_SUITE=android
- TEST_SUITE=ios
- TEST_SUITE=danger
- TEST_SUITE=jsfm
- TEST_SUITE=ios
- TEST_SUITE=danger
- TEST_SUITE=jsfm
- TEST_SUITE=android
matrix:
fast_finish: true
exclude:
- os: linux
env: TEST_SUITE=ios
- os: linux
env: TEST_SUITE=danger
- os: osx
env: TEST_SUITE=jsfm
- os: osx
env: TEST_SUITE=android
- os: osx
env: TEST_SUITE=ios
- os: linux
env: TEST_SUITE=android
include:
- os: osx
env: TEST_SUITE=ios
osx_image: xcode8.2
language: objective-c
- os: linux
env: TEST_SUITE=android
jdk: oraclejdk8
language: android
android:
components:
- platform-tools
- tools
- build-tools-23.0.2
- android-23
- android-19
- extra-google-m2repository
- extra-android-m2repository
- sys-img-armeabi-v7a-android-21
cache:
directories:
- node_modules
Expand Down
49 changes: 28 additions & 21 deletions test/ci-funcs.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
function installAndroidSDK {
brew install android-sdk
export ANDROID_HOME=/usr/local/opt/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
echo yes | android update sdk --all --no-ui --force -t 2 #platform tools
echo yes | android update sdk --all --no-ui --force -t 1 #tools
echo yes | android update sdk --all --no-ui --force -t 11 #build-tool
echo yes | android update sdk --all --no-ui --force -t 39 #sdk android-19
echo yes | android update sdk --all --no-ui --force -t 35 #sdk android-23
echo yes | android update sdk --all --no-ui --force -t 96 #sys-img
echo yes | android update sdk --all --no-ui --force -t 160 #support
# brew install android-sdk
# export ANDROID_HOME=/usr/local/opt/android-sdk
# export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
echo yes | android update sdk --all --no-ui --force -t platform-tools #platform tools
echo yes | android update sdk --all --no-ui --force -t tools #tools
echo yes | android update sdk --all --no-ui --force -t build-tools-23.0.2 #build-tool
echo yes | android update sdk --all --no-ui --force -t android-19 #sdk android-19
echo yes | android update sdk --all --no-ui --force -t android-23 #sdk android-23
echo yes | android update sdk --all --no-ui --force -t sys-img-armeabi-v7a-android-21 #sys-img
echo yes | android update sdk --all --no-ui --force -t extra-android-m2repository #support
}

function createAVD {
Expand Down Expand Up @@ -38,36 +38,43 @@ function setup_cpt {

target=${1:-$target_android}

setupBasic

if [ $target = $target_android ]; then
setupBasic
installAndroidSDK
JAVA_HOME=$(/usr/libexec/java_home) npm install -g macaca-android
# setupBasic
# installAndroidSDK
npm install -g macaca-cli
npm install -g macaca-android
createAVD
startAVD &
npm install
export DISPLAY=:99.0
elif [ $target = $target_ios ]
then
setupBasic
# setupBasic
npm install -g macaca-cli
brew update
brew install ios-webkit-debug-proxy
npm install -g macaca-ios
npm install
gem install danger danger-xcode_summary xcpretty xcpretty-json-formatter
elif [ $target = $target_jsfm ]
then
# setupBasic
npm install
else
gem install danger danger-xcode_summary xcpretty xcpretty-json-formatter
fi
}

function setupBasic {
brew update
brew install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
export CHROME_BIN=chromium-browser
source $(brew --prefix nvm)/nvm.sh
nvm install 7.0.0
brew install ios-webkit-debug-proxy
npm install -g macaca-cli
nvm use 7.0.0

}

function printEnvInfo {
Expand All @@ -89,10 +96,10 @@ function test_cpt {

if [ $target = $target_android ]; then
./test/serve.sh 2&>1 > /dev/null &
export ANDROID_HOME=/usr/local/opt/android-sdk
# export ANDROID_HOME=/usr/local/opt/android-sdk
cd android && ./run-ci.sh && cd $TRAVIS_BUILD_DIR
waitForEmulator
JAVA_HOME=$(/usr/libexec/java_home) run_in_ci=true ./test/run.sh
run_in_ci=true ./test/run.sh
elif [ $target = $target_ios ]
then
./test/serve.sh 2&>1 > /dev/null &
Expand Down