Running tests for parsed version

This commit is contained in:
Marcin Grzejszczak
2016-07-22 21:09:25 +02:00
parent aab86d1e55
commit c94ab9e417
7 changed files with 52 additions and 53 deletions

View File

@@ -1,17 +1,13 @@
#!/usr/bin/env bash
set -o errexit
source common.sh || source scripts/common.sh || echo "No common.sh script found..."
ROOT_FOLDER=`pwd`
echo "Current folder is $ROOT_FOLDER"
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
cd ..
ROOT_FOLDER=`pwd`
fi
set -e
ADDITIONAL_MAVEN_OPTS=${ADDITIONAL_MAVEN_OPTS:--Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn}
echo "Building Maven and Gradle projects for version [$VERIFIER_VERSION]"
echo "Building Maven stuff with additional opts [$ADDITIONAL_MAVEN_OPTS]"
./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Psonar --batch-mode $ADDITIONAL_MAVEN_OPTS

View File

@@ -1,14 +1,8 @@
#!/usr/bin/env bash
set -o errexit
source common.sh || source scripts/common.sh || echo "No common.sh script found..."
ROOT_FOLDER=`pwd`
echo "Current folder is $ROOT_FOLDER"
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
cd ..
ROOT_FOLDER=`pwd`
fi
set -e
function print_usage() {
cat <<EOF
@@ -39,7 +33,13 @@ esac
shift # past argument or value
done
[[ -z "${VERIFIER_VERSION}" ]] && VERIFIER_VERSION="1.0.0.BUILD-SNAPSHOT"
# Code grepping for the 3rd presence of "version" in pom.xml.
# The 3rd one is where we define the SC-Contract version
VERSION_NODE=`awk '/version/{i++}i==3{print; exit}' $ROOT_FOLDER/pom.xml`
# Extract the contents of the version node
VERSION_VALUE=$(sed -ne '/version/{s/.*<version>\(.*\)<\/version>.*/\1/p;q;}' <<< "$VERSION_NODE")
[[ -z "${VERIFIER_VERSION}" ]] && VERIFIER_VERSION="$VERSION_VALUE"
export VERIFIER_VERSION
echo -e "\n\nBUILDING AND RUNNING TESTS FOR VERIFIER IN VERSION [$VERIFIER_VERSION]\n\n"

24
scripts/common.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
ROOT_FOLDER=`pwd`
echo "Current folder is $ROOT_FOLDER"
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
cd ..
ROOT_FOLDER=`pwd`
fi
echo "Root folder is $ROOT_FOLDER"
# Code grepping for the 3rd presence of "version" in pom.xml.
# The 3rd one is where we define the SC-Contract version
VERSION_NODE=`awk '/version/{i++}i==3{print; exit}' $ROOT_FOLDER/pom.xml`
# Extract the contents of the version node
VERSION_VALUE=$(sed -ne '/version/{s/.*<version>\(.*\)<\/version>.*/\1/p;q;}' <<< "$VERSION_NODE")
echo "Extracted version from root pom.xml is [$VERSION_VALUE]"
export ROOT_FOLDER
export VERSION_VALUE

View File

@@ -1,14 +1,7 @@
#!/usr/bin/env bash
set -o errexit
ROOT_FOLDER=`pwd`
echo "Current folder is $ROOT_FOLDER"
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
cd ..
ROOT_FOLDER=`pwd`
fi
source common.sh || source scripts/common.sh || echo "No common.sh script found..."
set -e
./mvnw clean install && (cd *-gradle-plugin; ./gradlew clean build install) && ./scripts/runTests.sh && ./mvnw deploy && (cd *-gradle-plugin; ./gradlew uploadArchives -x test)

View File

@@ -1,14 +1,8 @@
#!/usr/bin/env bash
set -o errexit
source common.sh || source scripts/common.sh || echo "No common.sh script found..."
ROOT_FOLDER=`pwd`
echo "Current folder is $ROOT_FOLDER"
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
cd ..
ROOT_FOLDER=`pwd`
fi
set -e
./mvnw -s .settings.xml --fail-never dependency:go-offline || true
cd $ROOT_FOLDER/spring-cloud-contact-gradle-plugin && ./gradlew resolveDependencies || true

View File

@@ -1,14 +1,10 @@
#!/usr/bin/env bash
set -o errexit
source common.sh || source scripts/common.sh || echo "No common.sh script found..."
ROOT_FOLDER=`pwd`
echo "Current folder is $ROOT_FOLDER"
set -e
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
cd ..
ROOT_FOLDER=`pwd`
fi
echo "Generating docs for Spring Cloud Contract version [$VERIFIER_VERSION]"
echo "Building main docs"
./mvnw clean install -P docs -DskipTests=true --pl docs

View File

@@ -1,25 +1,21 @@
#!/usr/bin/env bash
set -o errexit
source common.sh || source scripts/common.sh || echo "No common.sh script found..."
ROOT_FOLDER=`pwd`
echo "Current folder is $ROOT_FOLDER"
set -e
if [[ ! -e "${ROOT_FOLDER}/.git" ]]; then
cd ..
ROOT_FOLDER=`pwd`
fi
[[ -z "${VERSION_VALUE}" ]] && VERSION_VALUE="1.0.0.BUILD-SNAPSHOT"
[[ -z "${VERIFIER_VERSION}" ]] && VERIFIER_VERSION="$VERSION_VALUE"
export VERIFIER_VERSION
export CONTRACT_VERIFIER_VERSION=${CONTRACT_VERIFIER_VERSION:-1.0.0.BUILD-SNAPSHOT}
echo "Current Spring Cloud Contract Verifier version is ${CONTRACT_VERIFIER_VERSION}"
echo -e "\n\nRUNNING TESTS FOR VERIFIER IN VERSION [${VERIFIER_VERSION}]\n\n"
cd samples/standalone
echo "Running Gradle tests"
. ./runTests.sh
./runTests.sh
echo "Running Maven tests"
. ./runMavenTests.sh
./runMavenTests.sh
cd $ROOT_FOLDER