porting ci to jenkins

This commit is contained in:
sebv
2014-09-28 18:48:24 +08:00
parent ef5ad90eee
commit 2c6a4e9be4
4 changed files with 45 additions and 36 deletions

View File

@@ -0,0 +1,6 @@
# Needs to be sourced!
set -e
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.10.26 . ./use-node

View File

@@ -1,78 +1,79 @@
#!/bin/bash
set -e
TARBALL=appium-${TRAVIS_BRANCH}-${TRAVIS_JOB_NUMBER}-${TRAVIS_COMMIT:0:10}.tar.bz2
# Configuration
export SAUCE_REST_ROOT=https://saucelabs.com/rest/v1
RUN_SAUCE=false
if [[ $TRAVIS_SECURE_ENV_VARS == true ]] && [[ $TRAVIS_PULL_REQUEST == false ]]; then
RUN_SAUCE=true
fi
TARBALL=appium-${CI_CONFIG}-${BUILD_NUMBER}-${GIT_COMMIT:0:10}.tar.bz2
if [[ $CI_CONFIG == 'unit' ]]; then
npm install -g jshint grunt-cli
npm install
# cd docs
# appium_doc_lint || exit 1
# cd -
npm test
elif [[ $CI_CONFIG == 'ios' ]]; then
elif [[ $CI_CONFIG == 'build-ios' ]]; then
echo $TARBALL
unset SUDO_UID
echo OS X version: `sw_vers -productVersion`
echo Xcode version: `xcodebuild build -version`
echo Xcode path: `xcode-select --print-path`
./reset.sh --no-npmlink --dev --ios
if [[ $RUN_SAUCE == true ]]; then
if [[ $UPLOAD_TO_SAUCE == 1 ]]; then
TARBALL=$TARBALL ./ci/upload_build_to_sauce.sh
TARBALL=sauce-storage:$TARBALL \
./ci/tools/parallel-mocha.js \
-p $IOS_CONCURRENCY \
-c ios
# TARBALL=sauce-storage:$TARBALL \
# ./ci/tools/parallel-mocha.js \
# -p $IOS_CONCURRENCY \
# -c ios
fi
elif [[ $CI_CONFIG == 'android' ]]; then
source ./ci/android_env
elif [[ $CI_CONFIG == 'build-android' ]]; then
echo JAVA_HOME: $JAVA_HOME
./reset.sh --no-npmlink --dev --android
if [[ $RUN_SAUCE == true ]]; then
if [[ $UPLOAD_TO_SAUCE == 1 ]]; then
TARBALL=$TARBALL ./ci/upload_build_to_sauce.sh
TARBALL=sauce-storage:$TARBALL \
./ci/tools/parallel-mocha.js \
-p $ANDROID_CONCURRENCY \
-c android
# TARBALL=sauce-storage:$TARBALL \
# ./ci/tools/parallel-mocha.js \
# -p $ANDROID_CONCURRENCY \
# -c android
fi
elif [[ $CI_CONFIG == 'gappium' ]]; then
if [[ $TRAVIS_PULL_REQUEST != false ]]; then
echo "Skipping this config for pull requests, it takes too long."
exit 0
fi
source ./ci/android_env
# source ./ci/android_env
echo OS X version: `sw_vers -productVersion`
echo Xcode version: `xcodebuild build -version`
echo Xcode path: `xcode-select --print-path`
echo JAVA_HOME: $JAVA_HOME
./reset.sh --ios --android --selendroid-quick --no-npmlink
./reset.sh --dev --gappium --no-npmlink
if [[ $RUN_SAUCE == true ]]; then
TARBALL=$TARBALL ./ci/upload_build_to_sauce.sh
TARBALL=sauce-storage:$TARBALL \
./ci/tools/parallel-mocha.js \
-p $GAPPIUM_CONCURRENCY \
-c gappium
fi
# if [[ $UPLOAD_TO_SAUCE == 1 ]]; then
# TARBALL=$TARBALL ./ci/upload_build_to_sauce.sh
# TARBALL=sauce-storage:$TARBALL \
# ./ci/tools/parallel-mocha.js \
# -p $GAPPIUM_CONCURRENCY \
# -c gappium
# fi
elif [[ $CI_CONFIG == 'selendroid' ]]; then
if [[ $TRAVIS_PULL_REQUEST != false ]]; then
echo "Skipping this config for pull requests, it takes too long."
exit 0
fi
source ./ci/android_env
# source ./ci/android_env
echo OS X version: `sw_vers -productVersion`
echo Xcode version: `xcodebuild build -version`
echo Xcode path: `xcode-select --print-path`
echo JAVA_HOME: $JAVA_HOME
./reset.sh --android --no-npmlink
./reset.sh --dev --selendroid-quick --no-npmlink
if [[ $RUN_SAUCE == true ]]; then
TARBALL=$TARBALL ./ci/upload_build_to_sauce.sh
TARBALL=sauce-storage:$TARBALL \
./ci/tools/parallel-mocha.js \
-p $SELENDROID_CONCURRENCY \
-c selendroid
fi
# if [[ $UPLOAD_TO_SAUCE == 1 ]]; then
# TARBALL=$TARBALL ./ci/upload_build_to_sauce.sh
# TARBALL=sauce-storage:$TARBALL \
# ./ci/tools/parallel-mocha.js \
# -p $SELENDROID_CONCURRENCY \
# -c selendroid
# fi
fi

View File

@@ -18,13 +18,15 @@ tar \
--exclude=submodules . | \
curl \
-k \
--progress-bar \
--silent \
-u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY \
-X POST "${SAUCE_REST_ROOT}/storage/${SAUCE_USERNAME}/${TARBALL}?overwrite=true" \
-H "Content-Type: application/octet-stream" \
--data-binary @- \
-o $UPLOAD_INFO_FILE
# --progress-bar \
# checking/printing result file
ci/tools/build-upload-tool.js $UPLOAD_INFO_FILE

View File

@@ -73,7 +73,7 @@ module.exports.getSampleCode = function (grunt, hardcore, cb) {
var sampleCodeGit = path.resolve(submodulesDir, "sample-code");
var sampleCodeDir = path.resolve(__dirname, "sample-code");
var sampleCodeExists = fs.existsSync(sampleCodeDir);
var updateCmd = "git submodule update --init " + sampleCodeGit;
var updateCmd = "git submodule update --init '" + sampleCodeGit + "'";
console.log("Cloning/updating Appium sample-code submodule");
execWithOutput(updateCmd, function (err, stdout, stderr) {
if (err) return cb(err);