diff --git a/.travis.yml b/.travis.yml index 7e9d76958..6885ba6ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,84 +1,83 @@ +dist: xenial + language: java + jdk: - - oraclejdk8 + - openjdk8 services: - docker - + - xvfb # required because our frontend tests currently use firefox as a browser (and thus do not run headless) + # see https://docs.travis-ci.com/user/gui-and-headless-browsers/#using-xvfb-to-run-tests-that-require-a-gui for more information cache: directories: - $HOME/.m2 - web/node_modules - - web/dist stages: - - Build + - Compile - Test - "Release / Deploy" env: global: - - FORCE_DEPLOY=false - - NODE_VERSION=12.10.0 - DEPLOY_REPO=Taskana/taskana - - VERSION=v`mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.6.0:exec -f ./lib` matrix: - - DB=H2 PROJECT=REST - - DB=H2 PROJECT=LIB - - DB=DB2_10_5 PROJECT=CORE - - DB=DB2_11_1 PROJECT=CORE - - DB=POSTGRES_10_4 PROJECT=CORE - - DB=POSTGRES_10_4 PROJECT=WILDFLY - -install: mvn dependency:resolve + - DB=H2 + - DB=DB2_10_5 + - DB=DB2_11_1 + - DB=POSTGRES_10_4 stage: Test -script: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" - - sleep 3 # give xvfb some time to start - - nvm install $NODE_VERSION - && ci/change_version.sh -m . - && ci/test.sh $DB $PROJECT +install: skip +script: ci/test.sh $DB +before_cache: rm -rf $HOME/.m2/repository/pro/taskana -jobs: +matrix: include: - - stage: Build - install: - - nvm install $NODE_VERSION - && (cd web && npm install && npm rebuild node-sass) - && ci/change_version.sh -m . - script: - - (cd web && npm run build:prod) - && mvn clean install -q -DskipTests -Dmaven.javadoc.skip -P history.plugin + - stage: Compile + name: taskana-web + language: node_js + node_js: 12.10.0 + install: skip + env: MODULE=WEB + script: ci/compile.sh $MODULE + before_cache: rm -rf $HOME/.m2/repository/pro/taskana + + - stage: Compile + name: taskana-lib + install: skip + env: MODULE=LIB + script: ci/compile.sh $MODULE + before_cache: rm -rf $HOME/.m2/repository/pro/taskana + + - stage: Compile + name: taskana-rest + install: skip + env: MODULE=REST + script: ci/compile.sh $MODULE + before_cache: rm -rf $HOME/.m2/repository/pro/taskana + + - stage: "Release / Deploy" - name: "Release stage" - script: - - ci/release.sh . $TRAVIS_TAG - && mvn install -q -DskipTests - && mvn prepare-package -q -f ./rest/taskana-rest-spring-test - && ci/release.sh lib $TRAVIS_TAG - && ci/release.sh lib/taskana-core $TRAVIS_TAG - && ci/release.sh lib/taskana-spring $TRAVIS_TAG - && ci/release.sh lib/taskana-cdi $TRAVIS_TAG - && ci/release.sh web $TRAVIS_TAG - && ci/release.sh rest $TRAVIS_TAG - && ci/release.sh rest/taskana-rest-spring $TRAVIS_TAG - && ci/release.sh rest/taskana-rest-spring-base $TRAVIS_TAG - if: repo = env(DEPLOY_REPO) AND (tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ OR branch = master) AND type != pull_request - - stage: "Release / Deploy" - name: "Update Pom's stage" - script: - - ci/change_version.sh -i -m . - && ci/commitPoms.sh lib/taskana-cdi/src/test/java/pro/taskana/TaskanaProducersTest.java - if: repo = env(DEPLOY_REPO) AND tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ - - stage: "Release / Deploy" - name: "Deploy stage" - script: - - if [[ $FORCE_DEPLOY = true ]]; - then ci/copy-rest-spring.sh $VERSION; - else ci/copy-rest-spring.sh $TRAVIS_TAG; - fi + install: ci/change_version.sh -m . + && ( cd web && npm install ) + && ( cd web && npm run build:prod ) + && mvn -q install -T 4C -am -DskipTests -DmFaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-rest-spring-test + && mvn -q prepare-package -pl :taskana-rest-spring-test + && mvn -q install -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-rest-spring-example + env: RELEASE_PROFILE=$([[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot") + name: release / deploy / commit + # decoding gpg key and importing it. Gpg key is necessary to sign artifacts for release. + before_script: | + openssl aes-256-cbc -K "$encrypted_21a5d40e43a3_key" -iv "$encrypted_21a5d40e43a3_iv" + -in "ci/codesigning.asc.enc" -out "ci/codesigning.asc" -d && gpg --import "ci/codesigning.asc" + script: | + mvn deploy -P "$RELEASE_PROFILE" --settings ci/mvnsettings.xml + -pl \!taskana-cdi-example,\!taskana-spring-example,\!taskana-rest-spring-test,\!taskana-rest-spring-example, + \!taskana-rest-spring-wildfly-example -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip + after_success: ci/change_version.sh -i -m . && ci/commitPoms.sh + before_cache: rm -rf $HOME/.m2/repository/pro/taskana deploy: provider: cloudfoundry username: $BLUEMIX_ACCOUNT @@ -88,4 +87,4 @@ jobs: space: Taskana on: all_branches: true - if: (repo = env(DEPLOY_REPO) AND tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$) OR (env(FORCE_DEPLOY) = true) + if: repo = env(DEPLOY_REPO) AND (tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ OR branch = master) AND type != pull_request diff --git a/ci/change_version.sh b/ci/change_version.sh index 961c53774..fe802e250 100755 --- a/ci/change_version.sh +++ b/ci/change_version.sh @@ -4,11 +4,11 @@ set -e #fail fast #H Usage: #H change_version.sh -h | change_version.sh --help #H -#H prints this help and exits -#H -#H change_version.sh <-m modules...> [-i] +#H prints this help and exits #H -#H if a release version exists (extracted from TRAVIS_TAG) +#H change_version.sh <-m modules...> [-i] +#H +#H if a release version exists (extracted from TRAVIS_TAG) #H the maven versions of all modules will be changed to the given release version. #H #H module: @@ -17,18 +17,18 @@ set -e #fail fast #H increments version #H #H Environment variables: -#H - TRAVIS_TAG +#H - TRAVIS_TAG #H if this is a tagged build then TRAVIS_TAG contains the version number. #H pattern: v[DIGIT].[DIGIT].[DIGIT] # Arguments: # $1: exitcode -function helpAndExit { +function helpAndExit() { cat "$0" | grep "^#H" | cut -c4- exit "$1" } # takes a version (without leading v) and increments its -# last number by one. +# last number by one. # Arguments: # $1: version (without leading v) which will be patched # Return: @@ -36,41 +36,41 @@ function helpAndExit { function increment_version() { if [[ ! "$1" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then echo "'$1' does not match tag pattern." >&2 - exit 1; + exit 1 fi - echo "${1%\.*}.`expr ${1##*\.*\.} + 1`" + echo "${1%\.*}.$(expr ${1##*\.*\.} + 1)" } # changing version in pom and all its children # Arguments: # $1: directory of pom # $2: new version -function change_version { - mvn versions:set -f "$1" -DnewVersion="$2" -DartifactId=* -DgroupId=* versions:commit +function change_version() { + mvn -q versions:set -f "$1" -DnewVersion="$2" -DartifactId=* -DgroupId=* versions:commit } -function main { +function main() { [[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 while [[ $# -gt 0 ]]; do case $1 in - -i) - INCREMENT="true" - shift # past argument - ;; - -m|--modules) - if [[ -z "$2" || "$2" == -* ]]; then - echo "missing parameter for argument '-m|--modules'" >&2 - exit 1 - fi - MODULES=($2) - shift # past argument - shift # past value - ;; - *) # unknown option - echo "unknown parameter $1" >&2 + -i) + INCREMENT="true" + shift # passed argument + ;; + -m | --modules) + if [[ -z "$2" || "$2" == -* ]]; then + echo "missing parameter for argument '-m|--modules'" >&2 exit 1 - ;; + fi + MODULES=($2) + shift # passed argument + shift # passed value + ;; + *) # unknown option + echo "unknown parameter $1" >&2 + exit 1 + ;; esac done @@ -80,7 +80,7 @@ function main { fi if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - version=`[[ -n "$INCREMENT" ]] && echo $(increment_version "${TRAVIS_TAG##v}")-SNAPSHOT || echo "${TRAVIS_TAG##v}"` + version=$([[ -n "$INCREMENT" ]] && echo $(increment_version "${TRAVIS_TAG##v}")-SNAPSHOT || echo "${TRAVIS_TAG##v}") for dir in ${MODULES[@]}; do change_version "$dir" "$version" done diff --git a/ci/commitPoms.sh b/ci/commitPoms.sh index f269c5b32..66eff43cb 100755 --- a/ci/commitPoms.sh +++ b/ci/commitPoms.sh @@ -18,13 +18,13 @@ set -e # fail fast #H TRAVIS_REPO_SLUG - repo name (in form: owner_name/repo_name) # Arguments: # $1: exit code -function helpAndExit { +function helpAndExit() { cat "$0" | grep "^#H" | cut -c4- exit "$1" } # takes a version (without leading v) and increments its -# last number by one. +# last number by one. # Arguments: # $1: version (without leading v) which will be patched # Return: @@ -32,48 +32,51 @@ function helpAndExit { function increment_version() { if [[ ! "$1" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then echo "'$1' does not match tag pattern." >&2 - exit 1; + exit 1 fi - echo "${1%\.*}.`expr ${1##*\.*\.} + 1`" + echo "${1%\.*}.$(expr ${1##*\.*\.} + 1)" } -function main { - [[ "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 - [[ -z "$GH_USER" || -z "$GH_TOKEN" || -z "$TRAVIS_REPO_SLUG" ]] && helpAndExit 1 - if [[ "$TRAVIS_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+ ]]; then - #check if tagged commit is a head commit of any branch - commit=`git ls-remote -q -t origin | grep "$TRAVIS_TAG" | cut -c1-40` - branch=`git ls-remote -q -h origin | grep "$commit" | sed "s/$commit.*refs\/heads\///"` +function main() { + [[ "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 + [[ -z "$GH_USER" || -z "$GH_TOKEN" || -z "$TRAVIS_REPO_SLUG" ]] && helpAndExit 1 + if [[ "$TRAVIS_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+ ]]; then + #check if tagged commit is a head commit of any branch + commit=$(git ls-remote -q -t origin | grep "$TRAVIS_TAG" | cut -c1-40) + branch=$(git ls-remote -q -h origin | grep "$commit" | sed "s/$commit.*refs\/heads\///") - if [[ -z "$commit" || -z "$branch" ]]; then - echo "the commit '$commit' of tag '$TRAVIS_TAG' is not a head commit. Can not release" >&2 - exit 1 - fi - - if [[ `echo "$branch" | wc -l` != '1' ]]; then - echo "can not match commit '$commit' to a unique branch." >&2 - echo "Please make sure, that the tag '$TRAVIS_TAG' is the head of a unique branch" >&2 - echo "Branches detected: $branch" - exit 1 - fi - - #commit all poms - git checkout -b "$branch" - #to compensate new updates - git pull - git add "./*pom.xml" - for file in "$@"; do - [[ -n "$file" ]] && git add "$file" - done - git commit -m "Updated poms to version `increment_version ${TRAVIS_TAG##v}`-SNAPSHOT" - - #push poms (authentication via GH_TOKEN) - git remote add deployment "https://$GH_USER:$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git" - git push --quiet --set-upstream deployment "$branch" - else - echo "Nothing to push - this is not a release!" + if [[ -z "$commit" || -z "$branch" ]]; then + echo "the commit '$commit' of tag '$TRAVIS_TAG' is not a head commit. Can not release" >&2 + exit 1 fi + if [[ $(echo "$branch" | wc -l) != '1' ]]; then + echo "can not match commit '$commit' to a unique branch." >&2 + echo "Please make sure, that the tag '$TRAVIS_TAG' is the head of a unique branch" >&2 + echo "Branches detected: $branch" + exit 1 + fi + + git config --global user.email $GH_EMAIL + git config --global user.name $GH_USERNAME + + #commit all poms + git checkout -b "$branch" + #to compensate new updates + git pull + git add "./*pom.xml" + for file in "$@"; do + [[ -n "$file" ]] && git add "$file" + done + git commit -m "Updated poms to version $(increment_version ${TRAVIS_TAG##v})-SNAPSHOT" + + #push poms (authentication via GH_TOKEN) + git remote add deployment "https://$GH_USER:$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git" + git push --quiet --set-upstream deployment "$branch" + else + echo "Nothing to push - this is not a release!" + fi + } main "$@" diff --git a/ci/compile.sh b/ci/compile.sh new file mode 100755 index 000000000..c51a4364e --- /dev/null +++ b/ci/compile.sh @@ -0,0 +1,45 @@ +#!/bin/bash +set -e # fail fast + +#H Usage: +#H compile.sh -h | test.sh --help +#H +#H prints this help and exits +#H +#H compile.sh +#H +#H compiles the taskana application. Does not package and install artifacts. +#H +#H module: +#H - WEB +#H - LIB +#H - REST +# Arguments: +# $1: exit code +function helpAndExit() { + cat "$0" | grep "^#H" | cut -c4- + exit "$1" +} + +function main() { + [[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 + REL=$(dirname "$0") + case "$1" in + WEB) + (cd $REL/../web && npm install --silent) + (cd $REL/../web && npm run build) + ;; + LIB) + mvn -q install -N -Dcheckstyle.skip -f $REL/.. + mvn -q compile -f $REL/../lib + ;; + REST) + mvn -q install -N -Dcheckstyle.skip + mvn -q install -f lib -N -Dcheckstyle.skip + mvn -q install -f lib/taskana-core -DskipTests -Dmaven.javadoc.skip + mvn -q install -f lib/taskana-spring -DskipTests -Dmaven.javadoc.skip + ;; + esac +} + +main "$@" diff --git a/ci/copy-rest-spring.sh b/ci/copy-rest-spring.sh deleted file mode 100755 index 6691eaa81..000000000 --- a/ci/copy-rest-spring.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -e # fail fast - -if [[ ! "$1" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?$ ]]; then - echo "missing tag" >&2 - exit 1 -fi - -cp ~/.m2/repository/pro/taskana/taskana-rest-spring-example/${1##v}/taskana-rest-spring-example-${1##v}.jar taskana-rest-spring-example.jar diff --git a/ci/prepare_db.sh b/ci/prepare_db.sh index b6f378b65..b66311b9c 100755 --- a/ci/prepare_db.sh +++ b/ci/prepare_db.sh @@ -17,66 +17,67 @@ set -e #fail fast #H - POSTGRES_10_4 # Arguments: # $1: exit code -function helpAndExit { +function helpAndExit() { cat "$0" | grep "^#H" | cut -c4- exit "$1" } -function main { +function main() { [[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 - propFile="$HOME/taskanaUnitTest.properties" - - case "$1" in - H2) - if [[ -f "$propFile" ]]; then - rm "$propFile" + propFile="$HOME/taskanaUnitTest.properties" + + case "$1" in + H2) + if [[ -f "$propFile" ]]; then + rm "$propFile" + fi + ;; + DB2_10_5) + if [[ -z $(docker ps -aq -f name=^/taskana-db2_10_5$ -f status=running) ]]; then + if [[ -z $(docker ps -aq -f name=^/taskana-db2_10_5$) ]]; then + docker run -d -p 50100:50000 --name taskana-db2_10_5 taskana/db2:10.5 -d + else + docker start taskana-db2_10_5 fi - ;; - DB2_10_5) - if [[ -z `docker ps -aq -f name=^/taskana-db2_10_5$ -f status=running` ]]; then - if [[ -z `docker ps -aq -f name=^/taskana-db2_10_5$` ]]; then - docker run -d -p 50100:50000 --name taskana-db2_10_5 taskana/db2:10.5 -d - else - docker start taskana-db2_10_5 - fi + fi + echo 'jdbcDriver=com.ibm.db2.jcc.DB2Driver' >$propFile + echo 'jdbcUrl=jdbc:db2://localhost:50100/tskdb' >>$propFile + echo 'dbUserName=db2inst1' >>$propFile + echo 'dbPassword=db2inst1-pwd' >>$propFile + echo 'schemaName=TASKANA' >>$propFile + ;; + DB2_11_1) + if [[ -z $(docker ps -aq -f name=^/taskana-db2_11_1$ -f status=running) ]]; then + if [[ -z $(docker ps -aq -f name=^/taskana-db2_11_1$) ]]; then + docker run -d -p 50101:50000 --name taskana-db2_11_1 taskana/db2:11.1 -d + else + docker start taskana-db2_11_1 fi - echo 'jdbcDriver=com.ibm.db2.jcc.DB2Driver' > $propFile - echo 'jdbcUrl=jdbc:db2://localhost:50100/tskdb' >> $propFile - echo 'dbUserName=db2inst1' >> $propFile - echo 'dbPassword=db2inst1-pwd' >> $propFile - echo 'schemaName=TASKANA' >> $propFile - ;; - DB2_11_1) - if [[ -z `docker ps -aq -f name=^/taskana-db2_11_1$ -f status=running` ]]; then - if [[ -z `docker ps -aq -f name=^/taskana-db2_11_1$` ]]; then - docker run -d -p 50101:50000 --name taskana-db2_11_1 taskana/db2:11.1 -d - else - docker start taskana-db2_11_1 - fi + fi + echo 'jdbcDriver=com.ibm.db2.jcc.DB2Driver' >$propFile + echo 'jdbcUrl=jdbc:db2://localhost:50101/tskdb' >>$propFile + echo 'dbUserName=db2inst1' >>$propFile + echo 'dbPassword=db2inst1-pwd' >>$propFile + echo 'schemaName=TASKANA' >>$propFile + ;; + POSTGRES_10_4) + if [[ -z $(docker ps -aq -f name=^/taskana-postgres_10_4$ -f status=running) ]]; then + if [[ -z $(docker ps -aq -f name=^/taskana-postgres_10_4$) ]]; then + docker run -d -p 50102:5432 --name taskana-postgres_10_4 -e POSTGRES_PASSWORD=postgres postgres:10.4 + else + docker start taskana-postgres_10_4 fi - echo 'jdbcDriver=com.ibm.db2.jcc.DB2Driver' > $propFile - echo 'jdbcUrl=jdbc:db2://localhost:50101/tskdb' >> $propFile - echo 'dbUserName=db2inst1' >> $propFile - echo 'dbPassword=db2inst1-pwd' >> $propFile - echo 'schemaName=TASKANA' >> $propFile - ;; - POSTGRES_10_4) - if [[ -z `docker ps -aq -f name=^/taskana-postgres_10_4$ -f status=running` ]]; then - if [[ -z `docker ps -aq -f name=^/taskana-postgres_10_4$` ]]; then - docker run -d -p 50102:5432 --name taskana-postgres_10_4 -e POSTGRES_PASSWORD=postgres postgres:10.4 - else - docker start taskana-postgres_10_4 - fi - fi - echo 'jdbcDriver=org.postgresql.Driver' > $propFile - echo 'jdbcUrl=jdbc:postgresql://localhost:50102/postgres' >> $propFile - echo 'dbUserName=postgres' >> $propFile - echo 'dbPassword=postgres' >> $propFile - echo 'schemaName=taskana' >> $propFile - ;; - *) - echo "unknown database '$1'" >&2 - exit 1 + fi + echo 'jdbcDriver=org.postgresql.Driver' >$propFile + echo 'jdbcUrl=jdbc:postgresql://localhost:50102/postgres' >>$propFile + echo 'dbUserName=postgres' >>$propFile + echo 'dbPassword=postgres' >>$propFile + echo 'schemaName=taskana' >>$propFile + ;; + *) + echo "unknown database '$1'" >&2 + exit 1 + ;; esac docker ps diff --git a/ci/release.sh b/ci/release.sh deleted file mode 100755 index 4fd16a5ed..000000000 --- a/ci/release.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -set -e # fail fast - -#H Usage: -#H release.sh -h | release.sh --help -#H -#H prints this help and exits -#H -#H release.sh [version] -#H -#H an easy deployment tool to deploy maven projects. -#H -#H module: -#H -#H path to maven project -#H -#H version: -#H -#H new version for the . -#H format: ^v[0-9]+\.[0-9]+\.[0-9]+$ -#H if the format is wrong it will be ignored. -#H -#H requirements: -#H -#H - 's pom file contains the profiles 'release' and 'snapshot' -#H - the files -#H * mvnsettings.xml -#H * codesigning.asc.enc -#H have to exist in the same folder as this script -#H - the environment variables -#H * encrypted_21a5d40e43a3_key -#H * encrypted_21a5d40e43a3_iv -#H have to exist (in order to decode codesigning.asc.enc) -# Arguments: -# $1: exit code -function helpAndExit { - cat "$0" | grep "^#H" | cut -c4- - exit "$1" -} - -# decripting gpg keys and importing them (needed to sign artifacts) -# Global: -# $encrypted_21a5d40e43a3_key: decription key -# $encrypted_21a5d40e43a3_iv: initialisation vector -# Arguments: -# $1: basedir -function decodeAndImportKeys { - if [[ ! -f "$1/codesigning.asc" ]]; then - openssl aes-256-cbc -K "$encrypted_21a5d40e43a3_key" -iv "$encrypted_21a5d40e43a3_iv" -in "$1/codesigning.asc.enc" -out "$1/codesigning.asc" -d - gpg --import "$1/codesigning.asc" - fi -} - -# deploying a given project -# Arguments: -# $1: project folder (dir) -# $2: profile name -# $3: settings file (dir) -function release { - mvn deploy -f "$1" -P "$2" --settings "$3" -DskipTests=true -B -U -N -} - -# changing version in pom and all its children -# Arguments: -# $1: directory of pom -# $2: new version -function change_version { - mvn versions:set -f "$1" -DnewVersion="$2" -DartifactId=* -DgroupId=* versions:commit -} - -function main { - [[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 - [[ "$1" == '.' && "$2" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && change_version "$1" "${2##v}" - decodeAndImportKeys `dirname "$0"` - release "$1" `[[ "$2" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot"` "`dirname "$0"`/mvnsettings.xml" -} - -main "$@" diff --git a/ci/test.sh b/ci/test.sh index bde670a56..2e101a6bd 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -6,52 +6,43 @@ set -e # fail fast #H #H prints this help and exits #H -#H test.sh +#H test.sh #H -#H tests the taskana application +#H tests the taskana application. See documentation for further testing details. #H #H database: #H - H2 #H - DB2_10_5 #H - DB2_11_1 #H - POSTGRES_10_4 -#H project: -#H - REST -#H - WILDFLY -#H - CORE -#H - LIB # Arguments: # $1: exit code -function helpAndExit { +function helpAndExit() { cat "$0" | grep "^#H" | cut -c4- exit "$1" } -function main { +function main() { [[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 - REL=`dirname "$0"` + REL=$(dirname "$0") eval "$REL/prepare_db.sh '$1'" - if [[ "$1" == "H2" && "$2" == "REST" ]]; then - (cd $REL/../web && npm run test) - (cd $REL/../rest/ && mvn install -q -B) #reinstalling rest because rest-doc is built during tests. - (cd $REL/../rest/ && mvn verify -q -B -pl taskana-rest-spring-example -P history.plugin) - elif [[ "$1" == "H2" && "$2" == "LIB" ]]; then - (cd $REL/.. && mvn install -q -N -B ) - (cd $REL/../lib/ && mvn install -q -B -Dmaven.javadoc.skip) - elif [[ "$1" == "POSTGRES_10_4" && "$2" == "CORE" ]]; then - (cd $REL/.. && mvn install -q -N -B) - (cd $REL/../lib && mvn install -q -N -B) - (cd $REL/../lib/taskana-core && mvn verify -q -B) - elif [[ "$1" == "POSTGRES_10_4" && "$2" == "WILDFLY" ]]; then - #installing dependencies for rest (since this tests runs in a different cache) - mvn install -q -N - (cd $REL/../lib/ && mvn install -q -B -DskipTests -Dmaven.javadoc.skip) - - (cd $REL/../rest/ && mvn install -q -B -DskipTests -pl !taskana-rest-spring-wildfly-example -Dmaven.javadoc.skip) - (cd $REL/../rest/ && mvn install -q -B -pl taskana-rest-spring-wildfly-example -Dmaven.javadoc.skip -P postgres) - else - (cd $REL/../lib/taskana-core && mvn verify -q -B) - fi + case "$1" in + H2) + (cd $REL/.. && mvn -q install -B -T 4C -am -Dmaven.javadoc.skip -Dcheckstyle.skip) + (cd $REL/../web && npm install --silent && npm run test) + ;; + DB2_10_5 | DB2_11_1) + (cd $REL/.. && mvn -q verify -B -am -Dmaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-core) + ;; + POSTGRES_10_4) + ### INSTALL ### + (cd $REL/.. && mvn -q install -B -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -P postgres -am -T 4C -pl :taskana-rest-spring-wildfly-example) + + ### TEST ### + (cd $REL/.. && mvn -q verify -B -Dmaven.javadoc.skip -Dcheckstyle.skip -pl :taskana-core) + (cd $REL/../rest/taskana-rest-spring-wildfly-example && mvn -q verify -B -P postgres -Dmaven.javadoc.skip -Dcheckstyle.skip) + ;; + esac } main "$@" diff --git a/manifest.yml b/manifest.yml index e9610be59..13c585f3f 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1,7 +1,7 @@ # Configuration file for Cloud Foundry, see https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html applications: - name: taskana-rest - path: taskana-rest-spring-example.jar + path: rest/taskana-rest-spring-example/target/taskana-rest-spring-example.jar buildpacks: - https://github.com/cloudfoundry/java-buildpack.git memory: 640M diff --git a/rest/taskana-rest-spring-example/pom.xml b/rest/taskana-rest-spring-example/pom.xml index f6bc68085..a1760a339 100644 --- a/rest/taskana-rest-spring-example/pom.xml +++ b/rest/taskana-rest-spring-example/pom.xml @@ -113,6 +113,7 @@ + ${project.artifactId} org.springframework.boot diff --git a/web/package.json b/web/package.json index a8d29e243..09d205792 100644 --- a/web/package.json +++ b/web/package.json @@ -5,8 +5,8 @@ "scripts": { "ng": "ng", "start": "ng serve", - "build": " npm run lint && ng build --env=dev ", - "build:prod": "npm run lint && ng build --configuration=production", + "build": "ng build", + "build:prod": "ng build --prod=true", "test": "ng test --karma-config karma.conf.js --watch=false --browsers Firefox", "test:watch": "ng test --karma-config karma.conf.js --browsers Chrome", "lint": "ng lint" diff --git a/web/src/environments/environment.prod.ts b/web/src/environments/environment.prod.ts index 04fc818b9..281daefb4 100644 --- a/web/src/environments/environment.prod.ts +++ b/web/src/environments/environment.prod.ts @@ -1,5 +1,5 @@ export const environment = { production: true, taskanaRestUrl: '/api', - taskanaLogoutUrl: '' + taskanaLogoutUrl: '/logout' };