Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mestebangutierrez committed Jul 14, 2016
2 parents 5ae49af + 2461b73 commit 192dd18
Show file tree
Hide file tree
Showing 428 changed files with 1,919 additions and 1,341 deletions.
58 changes: 24 additions & 34 deletions .travis.yml
@@ -1,45 +1,35 @@
sudo: false
cache:
directories:
- $HOME/.m2/repository
- $HOME/.sonar
notifications:
slack: sdhub:ti8lMh7ERZIqLzWF4dHkcgwt
language: java
jdk:
- oraclejdk7

notifications:
slack: sdhub:ti8lMh7ERZIqLzWF4dHkcgwt

services:
- rabbitmq
- rabbitmq

cache:
directories:
- $HOME/.m2/repository
- $HOME/.sonar

before_cache:
- source ./.travis/utils.sh backup-maven-repo

before_install:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
install:
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -U
- source ./.travis/utils.sh prepare-repo

before_script:
- openssl aes-256-cbc -pass pass:$ENCRYPTION_PASSWORD -in target/config/ci/secring.gpg.enc
-out local.secring.gpg -d
- openssl aes-256-cbc -pass pass:$ENCRYPTION_PASSWORD -in target/config/ci/pubring.gpg.enc
-out local.pubring.gpg -d
- source ./.travis/utils.sh prepare-keys $ENCRYPTION_PASSWORD

script:
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ];
then
if [ "${TRAVIS_BRANCH}" = "master" ] || [ "${TRAVIS_BRANCH}" = "develop" ];
then mvn clean deploy -B -Dcodebase.directory=`pwd` -Dcoverage.reports.dir=`pwd`/target/all --settings target/config/ci/settings.xml;
else mvn clean install -B -Dcoverage.reports.dir=`pwd`/target/all --settings target/config/ci/settings.xml;
fi
else
echo mvn clean install -B -Dcoverage.reports.dir=`pwd`/target/all --settings target/config/ci/settings.xml;
fi
#- if [ "${TRAVIS_PULL_REQUEST}" = "false" ];
# then
# case "${TRAVIS_BRANCH}" in
# master) mvn sonar:sonar -B -Dsonar.branch=$TRAVIS_BRANCH -Dcoverage.reports.dir=`pwd`/target/all --settings target/config/ci/settings.xml;;
# develop) mvn sonar:sonar -B -Dsonar.branch=$TRAVIS_BRANCH -Dcoverage.reports.dir=`pwd`/target/all --settings target/config/ci/settings.xml;;
# feature*) mvn sonar:sonar -B -Dsonar.branch=$TRAVIS_BRANCH -Dcoverage.reports.dir=`pwd`/target/all --settings target/config/ci/settings.xml;;
# *) echo "Skip SonarQube analysis (${TRAVIS_BRANCH})";;
# esac
# fi
- mkdir /tmp/cache-trick
- mv $HOME/.m2/repository/org/smartdeveloperhub /tmp/cache-trick/
- source ./.travis/build.sh

after_success:
- source ./.travis/utils.sh restore-maven-repo
- source ./.travis/qa.sh

env:
global:
- secure: fGejDkt2Gpmfio8VaqGB4hqn+F/n0pK/IMM4nM3W5+Sft0PC+fVc6xcA1rQKyEt9YuwsLeYrTCflehgwK3EnXczAoKdaGYfdIwLRe28HaLwWrBtVGj9Tp3Oc1i2zD7KetV/RzApkycUz6DCOc2Sv2i7eYOYBF0nWn7aSvNxygNuw1tBgJWZUpiQxXi9ST62ZVb7CqOkt9uNNgYESOrPeaRrBA9cqtw9UkM+MnYHPO2TiKvaeJuNGkXA9zptUreyKeHwvmLp0AZnBpnwAo8AWXmf3WuOE19Xmi731PNOqSOj71AmqeL+JEJ3wXkakkn7lO48hTDzHjezzERVitzZOHaHQ7SjW1acb9y5OpilY9e/nOk6hXxNykMShHUp6ym0t6xYkqc6OhlNd3Mpbru6KoXlYdQR88OVGNQKI1Sa8ED3b/vo1QuA+AYyjHxRVCV9ZUJTvzlK7QIR4cW9Kayd5jVYQMEXi0K1T3TJUqIXDiy5U6hozYKTdJxTGZDp5zqRtw1eyoB7yZFI/DgWGylM9462Cg1ZhCELzIfc2YP7R1v7fFihX2UE3QMngiVc5fJ4U+9uUIBy8Lsr+OsI+ZQ9PZJT08pj9cjXUT4dpk4TmXWi9RF4fL/JCdj5U/DBHEn8psE4f1KxJDIb9Nvk5yUShseD81wKfQssf/XJ7xrNjNio=
Expand Down
52 changes: 52 additions & 0 deletions .travis/build.sh
@@ -0,0 +1,52 @@
#!/bin/bash
# Abort script on first failure
set -e

function deploy() {
if [ "$1" != "porcelain" ];
then
echo "Executing Maven deploy (${TRAVIS_BRANCH})..."
mvn clean deploy -B -Dcodebase.directory=$(pwd) -Dcoverage.reports.dir=$(pwd)/target/all --settings target/config/ci/settings.xml
else
echo "Skipped Maven deploy (${TRAVIS_BRANCH}): Porcelain"
fi
}

function install() {
if [ "$1" != "porcelain" ];
then
echo "Executing Maven install (${TRAVIS_BRANCH})..."
mvn clean install -B -Dcoverage.reports.dir=$(pwd)/target/all --settings target/config/ci/settings.xml
else
echo "Skipped Maven install (${TRAVIS_BRANCH}): Porcelain"
fi
}

function runBuild() {
mode=$1
if [ "${TRAVIS_PULL_REQUEST}" = "false" ];
then
case "${TRAVIS_BRANCH}" in
master | develop ) deploy "$mode";;
feature\/* ) install "$mode";;
* ) install "$mode";;
esac
else
install "$mode"
fi
}

function skipBuild() {
echo "Skipping build..."
}

if [ "${DEBUG}" = "trace" ];
then
set -x
fi

case "${CI}" in
skip ) skipBuild ;;
porcelain ) runBuild porcelain ;;
* ) runBuild "$1" ;;
esac
147 changes: 147 additions & 0 deletions .travis/qa.sh
@@ -0,0 +1,147 @@
#!/bin/bash
# Avoid aborting script on failure
set +e

function logCheckResults() {
case "${DEBUG}" in
trace | verbose )
echo "-> Trace:"
cat log.txt
echo "-> Response:"
cat data.txt
;;
* )
:
;;
esac
}

function checkWithCurl() {
if [ "${DEBUG}" = "verbose" ];
then
curl --version
fi
curl --head --silent --verbose --connect-timeout 5 "$1" > data.txt 2> log.txt
error=$?
logCheckResults
return "$error"
}

function checkWithWget() {
if [ "${DEBUG}" = "verbose" ];
then
wget --version
fi
# Write response (and headers) to 'data.txt', (verbose) activity to 'log.txt'
# including additional debug entries (e.g., requests and responses), with a
# generic timeout of 5s, and retry only once.
# In addition, discard the additional output (both standard and error)
wget --output-document=data.txt --output-file=log.txt --verbose --debug --timeout=5 --tries 1 --save-headers "$1" > error.log 2>&1
error=$?
if [ "$error" != "0" ];
then
# If a failure happens, but the server sent a response...
if [ "$(grep -c "response begin" log.txt)" -gt 0 ]
then
# ... we extract the response from the log...
from=$(awk '/response begin/{ print NR; exit }' log.txt)
to=$(awk '/response end/{ print NR; exit }' log.txt)
head -n $((to - 1)) log.txt | tail -n $((to - from - 1)) > data.txt
# ... and clear the failure status.
error=0
fi
fi
logCheckResults
return "$error"
}

function checkSonarQubeServer() {
echo "Checking SonarQube Server..."

case "${CHECKER}" in
curl ) checkWithCurl "$1";;
* ) checkWithWget "$1";;
esac

error=$?
if [ "$error" = "0" ];
then
status=$(head -n 1 data.txt | awk '{print $2}')
if [ "$status" != "200" ];
then
echo "SonarQube Server is not available (response status code: $status)"
error=1
fi
else
echo "Could not connect to SonarQube Server: "
cat log.txt
error=2
fi
rm data.txt
rm log.txt
return "$error"
}

function analyzeBranch() {
checkSonarQubeServer "$1"
if [ "$?" = "0" ];
then
if [ "$2" != "porcelain" ];
then
echo "Executing SonarQube analysis (${TRAVIS_BRANCH})..."
# If SSL network failures happen, execute the analysis with -Djavax.net.debug=all
mvn sonar:sonar -B -Dsonar.branch="$TRAVIS_BRANCH" -Dcoverage.reports.dir="$(pwd)/target/all" --settings target/config/ci/settings.xml
else
echo "Skipped SonarQube analysis (${TRAVIS_BRANCH}): Porcelain"
fi
else
echo "Skipped SonarQube analysis (${TRAVIS_BRANCH})"
fi
}

function skipBranchAnalysis() {
echo "Skipped SonarQube analysis (${TRAVIS_BRANCH}): Non Q.A. branch"
}

function skipPullRequestAnalysis() {
echo "Skipped SonarQube analysis (${TRAVIS_BRANCH}): Pull request"
}

function skipBuild() {
echo "Skipping build..."
}

function skipSonarQubeAnalysis() {
echo "Skipping SonarQube analysis..."
}

function runSonarQubeAnalysis() {
if [ "${TRAVIS_PULL_REQUEST}" = "false" ];
then
case "${TRAVIS_BRANCH}" in
master | develop ) analyzeBranch "$1" "$2";;
feature\/* ) analyzeBranch "$1" "$2";;
* ) skipBranchAnalysis ;;
esac
else
skipPullRequestAnalysis
fi
}

if [ "${DEBUG}" = "trace" ];
then
set -x
fi

server=http://www.smartdeveloperhub.org/sonar/

case "${CI}" in
skip ) skipBuild ;;
noqa ) skipSonarQubeAnalysis ;;
porcelain ) runSonarQubeAnalysis "$server" porcelain ;;
* ) runSonarQubeAnalysis "$server" "$1" ;;
esac

set +x

return 0

0 comments on commit 192dd18

Please sign in to comment.