diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 000000000..e9406519d --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,453 @@ +name: CI +on: + workflow_dispatch: + create: + tags: + - v* + push: + branches-ignore: + - dependabot/** + pull_request: + branches: + - master +env: + JAVA_VERSION: 11 + NODE_VERSION: 14.15.4 + + ARTIFACTS_CYPRESS_TESTS_NAME: cypress-tests + ARTIFACTS_CYPRESS_TESTS_PATH: web/cypress + ARTIFACTS_TASKANA_JARS_NAME: taskana-jars + ARTIFACTS_TASKANA_JARS_PATH: ~/.m2/repository/pro/taskana + ARTIFACTS_TASKANA_WEB_NAME: taskana-web + ARTIFACTS_TASKANA_WEB_PATH: web/dist + ARTIFACTS_JACOCO_REPORTS_NAME: jacoco-reports + ARTIFACTS_JACOCO_REPORTS_PATH: '**/jacoco.exec' + + CACHE_WEB_NAME: web + CACHE_MAVEN_FOR_WEB_NAME: maven-for-web + CACHE_MAVEN_NAME: maven + CACHE_SONAR_NAME: sonar + +jobs: + compile_frontend: + name: Compile taskana-web + runs-on: ubuntu-20.04 + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Cache web dependencies + id: web-cache + uses: actions/cache@v2 + with: + path: web/node_modules + key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }} + - name: Cache maven dependencies (for web) + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.OS }}-${{ env.CACHE_MAVEN_FOR_WEB_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.OS }}-${{ env.CACHE_MAVEN_FOR_WEB_NAME }} + - name: Install Dependencies + if: steps.web-cache.outputs.cache-hit != 'true' + working-directory: web + run: npm ci + - name: Compile & build + working-directory: web + run: | + npm run lint + npm run build:prod + - name: Build maven artifact + run: ./mvnw -B install -pl :taskana-web -am + - name: Upload taskana-web artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_WEB_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_WEB_PATH }} + if-no-files-found: error + - name: Remove taskana artifacts from cache + run: rm -rf ~/.m2/repository/pro/taskana + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 + + compile_backend: + name: Compile all maven modules + runs-on: ubuntu-20.04 + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + - name: Cache maven dependencies + id: cache + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }} + - name: Compile & build + run: ./mvnw -B install -DskipTests -Dasciidoctor.skip -Djacoco.skip + - name: Populate cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + ./mvnw -B dependency:go-offline + ./mvnw -B dependency:go-offline -f rest/taskana-rest-spring-example-wildfly + ./mvnw -B test -Dtest=GibtEsNet -DfailIfNoTests=false + - name: Upload taskana artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }} + if-no-files-found: error + - name: Remove taskana artifacts from cache + run: rm -rf ~/.m2/repository/pro/taskana + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 + + compile_taskana-rest-spring-example-wildfly: + name: Compile taskana-rest-spring-example-wildfly + needs: compile_backend + runs-on: ubuntu-20.04 + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Cache maven dependencies + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }} + - name: Download taskana artifacts + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }} + - name: Compile + run: ./mvnw -B test-compile -f rest/taskana-rest-spring-example-wildfly -DskipTests + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 + + test_frontend: + runs-on: ubuntu-20.04 + name: Test taskana-web + needs: [ compile_frontend, compile_backend ] + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Cache web dependencies + id: web-cache + uses: actions/cache@v2 + with: + path: web/node_modules + key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }} + # Theoretically this is not necessary because we reuse the cache from the 'compile_frontend' job. + # Sometimes the cache is not created, therefore this is a fallback. + - name: Install Dependencies + if: steps.web-cache.outputs.cache-hit != 'true' + working-directory: web + run: npm ci + - name: Cache maven dependencies + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} + - name: Download taskana artifacts + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }} + - name: Test + working-directory: web + run: npm run test -- --coverageReporters text-summary + # TODO: new frontend breaks our cypress tests. + # - name: Cypress tests + # working-directory: web + # run: | + # ../mvnw -B spring-boot:run -P history.plugin -f .. -pl :taskana-rest-spring-example-boot & + # npx wait-port -t 30000 localhost:8080 && npm run e2e -- --config-file ../ci/cypress.json + - name: Upload Cypress tests + if: failure() + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARTIFACTS_CYPRESS_TESTS_NAME }} + path: ${{ env.ARTIFACTS_CYPRESS_TESTS_PATH }} + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 + + test_backend: + runs-on: ubuntu-20.04 + name: Test ${{ matrix.module }} on ${{ matrix.database }} + needs: [ compile_taskana-rest-spring-example-wildfly ] + strategy: + matrix: + module: + - taskana-common + - taskana-common-data + - taskana-common-test + - taskana-core + - taskana-cdi + - taskana-cdi-example + - taskana-spring + - taskana-spring-example + - taskana-rest-spring + - taskana-rest-spring-example-common + - taskana-loghistory-provider + - taskana-simplehistory-provider + - taskana-simplehistory-rest-spring + database: + - H2 + include: + - module: taskana-core + database: POSTGRES_10 + - module: taskana-core + database: DB2_11_1 + - module: taskana-rest-spring-example-boot + database: DB2_11_1 + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + - name: Cache maven dependencies + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }} + - name: Download taskana artifacts + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }} + - name: Prepare database + run: ci/prepare_db.sh ${{ matrix.database }} + - name: Generate JavaDoc for Rest Documentation + if: matrix.module == 'taskana-simplehistory-rest-spring' + run: ./mvnw -B validate -pl :taskana-rest-spring + - name: Test + run: ./mvnw -B verify -pl :${{matrix.module}} + - name: Upload JaCoCo Report + if: matrix.database == 'H2' + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARTIFACTS_JACOCO_REPORTS_NAME }} + path: ${{ env.ARTIFACTS_JACOCO_REPORTS_PATH }} + if-no-files-found: ignore + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 + + # As soon as we can upgrade the JDK to 11 we can add wildfly to the test matrix + test_taskana-rest-spring-example-wildfly: + runs-on: ubuntu-20.04 + name: Test taskana-rest-spring-example-wildfly on POSTGRES_10 + needs: [ compile_taskana-rest-spring-example-wildfly ] + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Cache maven dependencies + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }} + - name: Download taskana artifacts + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }} + - name: Start database + run: ci/prepare_db.sh POSTGRES_10 + - name: Test + run: ./mvnw -B verify -f rest/taskana-rest-spring-example-wildfly + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 + + + release_artifacts: + runs-on: ubuntu-20.04 + name: Release artifacts to OSS Sonatype + if: github.repository == 'Taskana/taskana' && ( startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master' ) && github.head_ref == '' + needs: [ test_frontend, test_backend, test_taskana-rest-spring-example-wildfly ] + # as documented in the gpg manual (https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html) + # we should execute this command before interacting with gpg (otherwise gpg won't work) + env: + GPG_TTY: $(tty) + steps: + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # necessary for push back + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + - name: Cache maven dependencies + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }} + - name: Download taskana-web artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_WEB_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_WEB_PATH }} + - name: Import GPG Key + run: echo -n "$GPG_KEY" | base64 --decode | gpg --batch --import + env: + GPG_KEY: ${{ secrets.GPG_KEY }} + - name: Change versions to match tag + run: ci/change_version.sh -m . + - name: Release artifacts to OSS Sonatype + run: | + ./mvnw -B deploy -P $([[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot") \ + --settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip -Dasciidoctor.skip \ + -pl :taskana-parent,\ + :taskana-common-parent,:taskana-common,:taskana-common-data,:taskana-common-test,\ + :taskana-lib-parent,:taskana-core,:taskana-cdi,:taskana-spring,\ + :taskana-rest-parent,:taskana-web,:taskana-rest-spring,\ + :taskana-history-parent,:taskana-simplehistory-provider,:taskana-simplehistory-rest-spring,:taskana-loghistory-provider + env: + GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + OSSRH_JIRA_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }} + OSSRH_JIRA_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }} + - name: Update version to next snapshot and push back + run: | + ci/change_version.sh -i -m . + ci/update_taskana_dependency_for_wildfly.sh + ci/commitPoms.sh + env: + GH_EMAIL: ${{ secrets.GH_EMAIL }} + GH_USERNAME: ${{ secrets.GH_USERNAME }} + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 + + deploy_to_bluemix: + runs-on: ubuntu-20.04 + name: Deploy demo app to IBM Cloud Foundry + if: github.repository == 'Taskana/taskana' && github.ref == 'refs/heads/master' && github.head_ref == '' + needs: [ test_frontend, test_backend, test_taskana-rest-spring-example-wildfly ] + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + - name: Cache maven dependencies + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }} + - name: Download taskana artifacts + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }} + - name: Download taskana-web artifacts + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACTS_TASKANA_WEB_NAME }} + path: ${{ env.ARTIFACTS_TASKANA_WEB_PATH }} + - name: Build taskana-web + run: ./mvnw -B install -pl :taskana-web + - name: Generate Javadoc + run: ./mvnw -B clean javadoc:jar -pl :taskana-core,:taskana-cdi,:taskana-spring + - name: Generate Rest Documentation + run: ./mvnw -B test asciidoctor:process-asciidoc -Dtest=*DocTest -pl :taskana-rest-spring,:taskana-simplehistory-rest-spring + - name: Build Example Application + run: ./mvnw -B install -P history.plugin -pl :taskana-rest-spring-example-boot -DskipTests -Dcheckstyle.skip + - name: Verify Example Application contains documentation + run: ci/verify_docs_jar.sh + - name: Deploy to IBM Cloud Foundry + uses: IBM/cloudfoundry-deploy@v1.0 + with: + IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }} + IBM_CLOUD_CF_API: ${{ secrets.IBM_CLOUD_CF_API }} + IBM_CLOUD_CF_ORG: ${{ secrets.IBM_CLOUD_CF_ORG }} + IBM_CLOUD_CF_SPACE: ${{ secrets.IBM_CLOUD_CF_SPACE }} + - name: Smoke test documentation + run: ci/verify_docs_alive.sh + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 + + upload_to_sonar: + runs-on: ubuntu-20.04 + name: Upload SonarQube analysis to sonarcloud + needs: [ test_frontend, test_backend, test_taskana-rest-spring-example-wildfly ] + steps: + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-${{ env.CACHE_SONAR_NAME }} + restore-keys: ${{ runner.os }}-${{ env.CACHE_SONAR_NAME }} + - name: Cache maven dependencies + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }} + - name: Download JaCoCo reports + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACTS_JACOCO_REPORTS_NAME }} + - name: Install taskana + run: ./mvnw -B install -DskipTests -Dcheckstyle.skip -Dasciidoctor.skip + - name: Upload SonarQube analysis + run: ./mvnw -B sonar:sonar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} + SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }} + - name: Cancel workflow + if: failure() + uses: andymckay/cancel-action@0.2 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 26f3661dd..000000000 --- a/.travis.yml +++ /dev/null @@ -1,143 +0,0 @@ -os: linux -dist: bionic - -language: java - -jdk: - - openjdk11 - -addons: - sonarcloud: - organization: $SONAR_ORGANIZATION - -git: - #depth false needed by sonarcloud for deep comparison - depth: false - -services: - - docker -cache: - directories: - - $HOME/.m2 - - web/node_modules - -branches: - except: - - /dependabot.*/ - -stages: - - name: Compile - - name: Test - - name: Release / Deploy - if: repo = 'Taskana/taskana' AND (tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ OR branch = master) AND type != pull_request - -env: - global: - - NODE_VERSION=12.10.0 - jobs: - - DB=H2 - - DB=DB2_11_1 - -install: skip -# include SONAR_PROJECT_KEY as a second parameter if this is not a pull request -script: ci/test.sh "$DB" "$([ "false" = "$TRAVIS_PULL_REQUEST" ] && echo "$SONAR_PROJECT_KEY")" -before_cache: rm -rf "$HOME/.m2/repository/pro/taskana" - -jobs: - include: - # We are using the environment variable 'MODULE' to force travis into using a different cache for each build. - # See https://docs.travis-ci.com/user/caching/#caches-and-build-matrices for detailed information on - # which characteristics determine the cache selection. - - stage: Compile - name: taskana-web - language: node_js - node_js: $NODE_VERSION - install: skip - env: MODULE=WEB - script: ci/compile.sh "$MODULE" - before_cache: rm -rf "$HOME/.m2/repository/pro/taskana" - - - stage: Compile - name: taskana-common + taskana-lib - install: skip - env: MODULE=LIB - script: ci/compile.sh COMMON && 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: Compile - name: taskana-history - install: skip - env: MODULE=HISTORY - script: ci/compile.sh "$MODULE" - before_cache: rm -rf "$HOME/.m2/repository/pro/taskana" - - - stage: Test - install: skip - env: DB=POSTGRES_10 - script: ci/test.sh "$DB" - && ./mvnw -q install -f history -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -Dasciidoctor.skip - && export JAVA_HOME=/usr/local/lib/jvm/openjdk8 - && ci/test.sh WILDFLY - before_cache: rm -rf "$HOME/.m2/repository/pro/taskana" - - - stage: Test - before_script: nvm install $NODE_VERSION - install: skip - env: DB=WEB - script: ci/test.sh "$DB" - before_cache: rm -rf "$HOME/.m2/repository/pro/taskana" - - - stage: Release / Deploy - name: release / deploy / commit - # This is necessary in order to fix some gpg issues (for signing the artifacts which will be released) - # More details: https://discuss.circleci.com/t/error-sending-to-agent-inappropriate-ioctl-for-device/17465/7 - before_install: | - echo use-agent >> ~/.gnupg/gpg.conf \ - && echo pinentry-mode loopback >> ~/.gnupg/gpg.conf \ - && echo allow-loopback-pinentry >> ~/.gnupg/gpg-agent.conf \ - && echo RELOADAGENT | gpg-connect-agent \ - && openssl aes-256-cbc -K "$encrypted_21a5d40e43a3_key" -iv "$encrypted_21a5d40e43a3_iv" \ - -in "ci/codesigning.asc.enc" -out "ci/codesigning.asc" -d \ - && gpg --batch --no-tty --yes --import "ci/codesigning.asc" \ - && nvm install "$NODE_VERSION" - install: ci/change_version.sh -m . - && ( cd web && npm install ) - && ( cd web && npm run build:prod-silent ) - && ./mvnw -q install -B -T 2C -pl :taskana-rest-spring-example-boot,:taskana-cdi -am -DskipTests -Dcheckstyle.skip -Dasciidoctor.skip - && ./mvnw -q prepare-package -B -T 2C -pl :taskana-rest-spring - && ./mvnw -q install -B -T 2C -f history -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip - && ./mvnw -q install -B -T 2C -pl :taskana-rest-spring-example-boot -P history.plugin -DskipTests -Dcheckstyle.skip - before_script: ci/verify_docs_jar.sh - script: | - ./mvnw deploy -B -T 2C -P `[[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot"` \ - --settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip \ - -pl :taskana-parent,\ - :taskana-common-parent,:taskana-common,:taskana-common-data,:taskana-common-test,\ - :taskana-lib-parent,:taskana-core,:taskana-cdi,:taskana-spring,\ - :taskana-rest-parent,:taskana-web,:taskana-rest-spring,\ - :taskana-history-parent,:taskana-simplehistory-provider,:taskana-simplehistory-rest-spring,:taskana-loghistory-provider - before_cache: rm -rf "$HOME/.m2/repository/pro/taskana" - # travis_terminate is necessary since after_success is a job phase which can change the build result. - # it is not documented, so this is a little hack. see: https://docs.travis-ci.com/user/job-lifecycle/#breaking-the-build - after_success: ci/change_version.sh -i -m . - && ci/update_taskana_dependency_for_wildfly.sh - && ci/commitPoms.sh || travis_terminate 1 - deploy: - provider: cloudfoundry - username: $BLUEMIX_ACCOUNT - password: $BLUEMIX_ACCOUNT_PASSWORD - api: https://api.ng.bluemix.net - organization: "NovaTec Consulting GmbH" - space: Taskana - on: - all_branches: true - # travis_terminate is necessary since after_deploy is a job phase which can change the build result. - # it is not documented, so this is a little hack. see: https://docs.travis-ci.com/user/job-lifecycle/#breaking-the-build - after_deploy: ci/verify_docs_alive.sh || travis_terminate 1 diff --git a/ci/change_version.sh b/ci/change_version.sh index afa73778a..73bf9f28c 100755 --- a/ci/change_version.sh +++ b/ci/change_version.sh @@ -8,7 +8,7 @@ set -e #fail fast #H #H %FILE% <-m modules...> [-i] #H -#H if a release version exists (extracted from TRAVIS_TAG) +#H if a release version exists (extracted from GITHUB_REF) #H the maven versions of all modules will be changed to the given release version. #H #H module: @@ -17,9 +17,9 @@ set -e #fail fast #H increments version #H #H Environment variables: -#H - TRAVIS_TAG -#H if this is a tagged build then TRAVIS_TAG contains the version number. -#H pattern: v[DIGIT].[DIGIT].[DIGIT] +#H - GITHUB_REF +#H if this is a tagged build then GITHUB_REF contains the version number. +#H pattern: refs/tags/v[DIGIT].[DIGIT].[DIGIT] # Arguments: # $1: exit code function helpAndExit() { @@ -81,8 +81,8 @@ function main() { helpAndExit 1 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}") + if [[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + version=$([[ -n "$INCREMENT" ]] && echo $(increment_version "${GITHUB_REF##refs/tags/v}")-SNAPSHOT || echo "${GITHUB_REF##refs/tags/v}") for dir in ${MODULES[@]}; do change_version "$dir" "$version" done diff --git a/ci/codesigning.asc.enc b/ci/codesigning.asc.enc deleted file mode 100644 index e724bc02a..000000000 Binary files a/ci/codesigning.asc.enc and /dev/null differ diff --git a/ci/commitPoms.sh b/ci/commitPoms.sh index 8b15a7e08..4da06c1eb 100755 --- a/ci/commitPoms.sh +++ b/ci/commitPoms.sh @@ -12,12 +12,9 @@ set -e # fail fast #H #H Requirements: #H current commit is a HEAD commit -#H GH_TOKEN - github access token -#H GH_USER - username for the github access token #H GH_USERNAME - github username / displayname (for git config) #H GH_EMAIL - github email address (for git config) -#H TRAVIS_TAG (format v[0-9]+\.[0-9]+\.[0-9]+) -#H TRAVIS_REPO_SLUG - repo name (in form: owner_name/repo_name) +#H GITHUB_REF (format refs/tags/v[0-9]+\.[0-9]+\.[0-9]+) # Arguments: # $1: exit code function helpAndExit() { @@ -41,26 +38,26 @@ function increment_version() { function main() { [[ "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 - [[ -z "$GH_USER" || -z "$GH_TOKEN" || -z "$GH_EMAIL" || -z "$GH_USERNAME" || -z "$TRAVIS_REPO_SLUG" ]] && helpAndExit 1 - if [[ "$TRAVIS_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+ ]]; then + [[ -z "$GH_EMAIL" || -z "$GH_USERNAME" ]] && helpAndExit 1 + if [[ "$GITHUB_REF" =~ ^refs/tags/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) + commit=$(git ls-remote -q -t origin | grep "$GITHUB_REF" | 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 + echo "the commit '$commit' of tag '${GITHUB_REF##refs/tags/}' 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 "Please make sure, that the tag '${GITHUB_REF##refs/tags/}' is the head of a unique branch" >&2 echo "Branches detected: $branch" exit 1 fi set -x - git config --global user.email $GH_EMAIL - git config --global user.name $GH_USERNAME + git config --global user.email "$GH_EMAIL" + git config --global user.name "$GH_USERNAME" #commit all poms git checkout "$branch" @@ -68,11 +65,8 @@ function main() { 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" + git commit -m "Updated poms to version $(increment_version ${GITHUB_REF##refs/tags/v})-SNAPSHOT" + git push else echo "Nothing to push - this is not a release!" fi diff --git a/ci/compile.sh b/ci/compile.sh deleted file mode 100755 index 898d04468..000000000 --- a/ci/compile.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -set -e # fail fast -#H Usage: -#H %FILE% -h | %FILE% --help -#H -#H prints this help and exits -#H -#H %FILE% -#H -#H compiles the taskana application. Does not package and install artifacts. -#H -#H module: -#H - WEB -#H - COMMON -#H - LIB -#H - REST -#H - HISTORY -# Arguments: -# $1: exit code -function helpAndExit() { - cat "$0" | grep "^#H" | cut -c4- | sed -e "s/%FILE%/$(basename "$0")/g" - exit "$1" -} - -function main() { - [[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 - REL=$(dirname "$0") - case "$1" in - WEB) - set -x - (cd $REL/../web && npm install --silent) - (cd $REL/../web && npm run lint) - (cd $REL/../web && npm run build) - ;; - COMMON) - set -x - $REL/../mvnw -q install -B -T 2C -f $REL/.. -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip -N - $REL/../mvnw -q test-compile -B -T 2C -f $REL/../common - ;; - LIB) - set -x - $REL/../mvnw -q install -B -T 2C -f $REL/.. -pl :taskana-core -am -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip - $REL/../mvnw -q test-compile -B -T 2C -f $REL/../lib - ;; - REST) - set -x - $REL/../mvnw -q install -B -T 2C -f $REL/.. -pl :taskana-simplehistory-rest-spring -am -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip -Dasciidoctor.skip - $REL/../mvnw -q test-compile -B -T 2C -f $REL/../rest - ;; - HISTORY) - set -x - $REL/../mvnw -q install -B -T 2C -f $REL/.. -pl :taskana-rest-spring -am -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip -Dasciidoctor.skip - $REL/../mvnw -q test-compile -B -T 2C -f $REL/../history - ;; - esac -} - -main "$@" diff --git a/ci/taskana-sonar-test-coverage/pom.xml b/ci/taskana-sonar-test-coverage/pom.xml new file mode 100644 index 000000000..0b0cd0935 --- /dev/null +++ b/ci/taskana-sonar-test-coverage/pom.xml @@ -0,0 +1,89 @@ + + 4.0.0 + taskana-sonar-test-coverage + pom + + ${project.groupId}:${project.artifactId} + This pom aggregates the jacoco reports for each module + + + pro.taskana + taskana-parent + 4.3.1-SNAPSHOT + ../../pom.xml + + + + + pro.taskana + taskana-common + ${project.version} + + + pro.taskana + taskana-common-data + ${project.version} + + + + pro.taskana + taskana-core + ${project.version} + + + pro.taskana + taskana-cdi + ${project.version} + + + pro.taskana + taskana-spring + ${project.version} + + + + + pro.taskana + taskana-rest-spring + ${project.version} + + + + + pro.taskana.history + taskana-simplehistory-provider + ${project.version} + + + pro.taskana.history + taskana-simplehistory-rest-spring + ${project.version} + + + pro.taskana.history + taskana-loghistory-provider + ${project.version} + + + + + + + org.jacoco + jacoco-maven-plugin + ${version.jacoco} + + + report-aggregate + verify + + report-aggregate + + + + + + + diff --git a/ci/test.sh b/ci/test.sh deleted file mode 100755 index 5fd4e0b48..000000000 --- a/ci/test.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -set -e # fail fast - -#H Usage: -#H test.sh -h | test.sh --help -#H -#H prints this help and exits -#H -#H test.sh [sonar project key] -#H -#H tests the taskana application. See documentation for further testing details. -#H -#H database: -#H - H2 -#H - DB2_11_1 -#H - POSTGRES_10 -#H module: -#H - HISTORY -#H - WILDFLY -#H sonar project key: -#H the key of the sonarqube project where the coverage will be sent to. -#H If empty nothing will be sent -# 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 - H2) - set -x - eval "$REL/prepare_db.sh '$1'" - # We can not use the fancy '-f' maven option due to a bug in arquillian. See https://issues.jboss.org/browse/THORN-2049 - (cd $REL/.. && ./mvnw -q install -B -T 2C -Pcoverage -Dcheckstyle.skip) - eval "$REL/verify_docs_jar.sh" - # disabling sonarqube for PRs because it's not supported yet. See https://jira.sonarsource.com/browse/MMF-1371 - if [ -n "$2" ]; then - # -Pcoverage to activate jacoco and test coverage reports - # send test coverage and build information to sonarcloud - $REL/../mvnw -q sonar:sonar -B -T 2C -f $REL/.. -Pcoverage -Dsonar.projectKey="$2" - fi - ;; - DB2_11_1) - set -x - eval "$REL/prepare_db.sh '$1'" - $REL/../mvnw -q verify -B -T 2C -f $REL/.. -pl :taskana-core -am -Dmaven.javadoc.skip -Dcheckstyle.skip - ;; - POSTGRES_10) - set -x - eval "$REL/prepare_db.sh '$1'" - ### INSTALL ### - $REL/../mvnw -q install -B -T 2C -f $REL/.. -pl :taskana-rest-spring-example-common -am -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -Dasciidoctor.skip - - ### TEST ### - $REL/../mvnw -q verify -B -T 2C -f $REL/.. -pl :taskana-core -Dmaven.javadoc.skip -Dcheckstyle.skip - ;; - WILDFLY) - set -x - eval "$REL/prepare_db.sh 'POSTGRES_10'" - # Same as above (H2) we can not use the fancy '-f' maven option - (cd $REL/../rest/taskana-rest-spring-example-wildfly && ../../mvnw -q verify -B -T 2C -Ddb.type=postgres) - ;; - HISTORY) - set -x - ### INSTALL ### - $REL/../mvnw -q install -B -T 2C -f $REL/.. -pl :taskana-rest-spring -am -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -Dasciidoctor.skip - - ### TEST ### - $REL/../mvnw -q verify -B -T 2C -f $REL/../history -Dmaven.javadoc.skip -Dcheckstyle.skip - ;; - WEB) - set -x - ### INSTALL ### - - (cd $REL/../web && npm install --silent && npm run build:prod-silent) - $REL/../mvnw -q install -B -T 2C -f $REL/.. -pl :taskana-rest-spring-example-boot -am -P history.plugin -DskipTests -Dmaven.javadoc.skip -Dcheckstyle.skip -Dasciidoctor.skip - $REL/../mvnw spring-boot:run -P history.plugin -f $REL/../rest/taskana-rest-spring-example-boot > /dev/null & - - ### TEST ### - (cd $REL/../web && npm run test -- --coverageReporters text-summary) - ### TEMP REMOVE CYPRESS TESTS ### - ### (cd $REL/../web && npm run e2e -- --config-file ../ci/cypress.json) ### - - ### CLEANUP ### - jobs -p | xargs -rn10 kill - ;; - esac -} - -main "$@" diff --git a/ci/update_taskana_dependency_for_wildfly.sh b/ci/update_taskana_dependency_for_wildfly.sh index cc192fdb5..3423a5d4b 100755 --- a/ci/update_taskana_dependency_for_wildfly.sh +++ b/ci/update_taskana_dependency_for_wildfly.sh @@ -8,7 +8,7 @@ set -e #fail fast #H #H %FILE% #H -#H if a release version exists (extracted from TRAVIS_TAG environment variable) +#H if a release version exists (extracted from GITHUB_REF environment variable) #H the taskana dependency in our wildfly example project will be incremented to the new version snapshot. #H # Arguments: @@ -34,14 +34,16 @@ function increment_version() { function main() { [[ "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 - if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then REL=$(dirname "$0") FILES=( $REL/../rest/taskana-rest-spring-example-wildfly/pom.xml ) for file in ${FILES[@]}; do - sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+-SNAPSHOT/$(increment_version "${TRAVIS_TAG##v}")-SNAPSHOT/g" $file + sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+-SNAPSHOT/$(increment_version "${GITHUB_REF##refs/tags/v}")-SNAPSHOT/g" $file done + else + echo "skipped version change for wildfly because this is not a release build" fi } diff --git a/ci/verify_docs_jar.sh b/ci/verify_docs_jar.sh index 97cfbe3ed..32731fd88 100755 --- a/ci/verify_docs_jar.sh +++ b/ci/verify_docs_jar.sh @@ -18,5 +18,7 @@ set -x verifyDocs "$REL/../lib/taskana-core/target/apidocs" "/static/docs/java/taskana-core" verifyDocs "$REL/../lib/taskana-cdi/target/apidocs" "/static/docs/java/taskana-cdi" verifyDocs "$REL/../lib/taskana-spring/target/apidocs" "/static/docs/java/taskana-spring" +test -n "$(jar -tf $JAR_FILE_LOCATION | grep /static/docs/rest/rest-api.html)" +test -n "$(jar -tf $JAR_FILE_LOCATION | grep /static/docs/rest/simplehistory-rest-api.html)" set +x -echo "the jar file '$JAR_FILE_LOCATION' contains all javadoc" +echo "the jar file '$JAR_FILE_LOCATION' contains documentation" diff --git a/history/taskana-simplehistory-rest-spring/pom.xml b/history/taskana-simplehistory-rest-spring/pom.xml index 309b41cf9..2ec34bf61 100644 --- a/history/taskana-simplehistory-rest-spring/pom.xml +++ b/history/taskana-simplehistory-rest-spring/pom.xml @@ -180,7 +180,7 @@ generate-javadoc-json - compile + validate javadoc-no-fork diff --git a/lib/taskana-cdi/.gitignore b/lib/taskana-cdi/.gitignore deleted file mode 100644 index 6dec5d949..000000000 --- a/lib/taskana-cdi/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/.apt_generated/ -/target/ -.checkstyle diff --git a/manifest.yml b/manifest.yml index c3201d916..af8e98f82 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1,6 +1,6 @@ # Configuration file for Cloud Foundry, see https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html applications: -- name: taskana-rest +- name: taskana-rest-spring-example-boot path: rest/taskana-rest-spring-example-boot/target/taskana-rest-spring-example-boot.jar buildpacks: - https://github.com/cloudfoundry/java-buildpack.git diff --git a/pom.xml b/pom.xml index 2a75f0e5e..dcbea8acf 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,7 @@ rest history + ci/taskana-sonar-test-coverage @@ -41,6 +42,7 @@ 2.1.0 3.1.0 3.1.2 + 3.7.0.1746 1.6 @@ -73,8 +75,19 @@ 11.1.1.1 - - + + + ${env.SONAR_PROJECT_KEY} + ${env.SONAR_ORGANIZATION} + ${project.artifactId} + https://sonarcloud.io + jacoco + + ${project.basedir}/ci/coverage/target/site/jacoco-aggregate/jacoco.xml, + ${project.basedir}/ci/../coverage/target/site/jacoco-aggregate/jacoco.xml, + ${project.basedir}/ci/../../coverage/target/site/jacoco-aggregate/jacoco.xml + + src/main/java @@ -139,6 +152,13 @@ + + + + --pinentry-mode + loopback + + org.sonatype.plugins @@ -177,6 +197,13 @@ + + + + --pinentry-mode + loopback + + org.sonatype.plugins @@ -198,63 +225,32 @@ - - eclipse - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - [1.0.0,) - - check - - - - - - - - - - - - - - - - coverage - - - - org.jacoco - jacoco-maven-plugin - ${version.jacoco} - - - - prepare-agent - report - - - - - - - + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${version.maven.sonar} + + + + + org.jacoco + jacoco-maven-plugin + ${version.jacoco} + + + prepare-agent + + prepare-agent + + + + @@ -313,9 +309,6 @@ org.apache.maven.plugins maven-surefire-plugin ${version.maven.surefire} - - ${argLine} - org.apache.maven.plugins diff --git a/rest/taskana-rest-spring-example-common/pom.xml b/rest/taskana-rest-spring-example-common/pom.xml index fbb63d266..552b6ded4 100644 --- a/rest/taskana-rest-spring-example-common/pom.xml +++ b/rest/taskana-rest-spring-example-common/pom.xml @@ -15,6 +15,10 @@ ../pom.xml + + src/main/java,src/main/resources/templates + + pro.taskana diff --git a/rest/taskana-rest-spring/pom.xml b/rest/taskana-rest-spring/pom.xml index 771865de4..290498a96 100644 --- a/rest/taskana-rest-spring/pom.xml +++ b/rest/taskana-rest-spring/pom.xml @@ -180,7 +180,7 @@ generate-javadoc-json - compile + validate javadoc-no-fork diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index 5b9f64990..000000000 --- a/sonar-project.properties +++ /dev/null @@ -1,4 +0,0 @@ -sonar.sources=src/main/java,src/main/resources/templates -sonar.java.coveragePlugin=jacoco -sonar.jacoco.reportPath=**/jacoco.* -sonar.dynamicAnalysis=reuseReports diff --git a/web/pom.xml b/web/pom.xml index 4e3edddf6..9a217798e 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -13,6 +13,11 @@ 4.3.1-SNAPSHOT ../rest/pom.xml + + + true + +