From ae0fcbe09d3b5cd1a8acf6a49b68471591504141 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Thu, 8 Jun 2023 23:05:50 +0200 Subject: [PATCH] [CI] Fix test support --- .github/workflows/ci-main.yml | 2 +- .github/workflows/ci-manual.yml | 31 +++++++++++++++ .github/workflows/common.yml | 32 ++++++++-------- applications/sink/elasticsearch-sink/pom.xml | 6 +-- applications/sink/mqtt-sink/pom.xml | 2 +- applications/sink/rabbit-sink/pom.xml | 3 ++ applications/sink/redis-sink/pom.xml | 1 + applications/source/debezium-source/pom.xml | 5 ++- applications/source/mqtt-source/pom.xml | 2 +- applications/source/rabbit-source/pom.xml | 4 +- applications/stream-applications-core/pom.xml | 14 +++++++ .../stream-applications-test-support/pom.xml | 17 +++++++-- .../pom.xml | 18 ++++----- build-folder.sh | 38 ++++++++++--------- .../common/function-test-support/pom.xml | 11 ++++++ functions/common/mongodb-common/pom.xml | 1 + functions/consumer/cassandra-consumer/pom.xml | 1 + .../consumer/elasticsearch-consumer/pom.xml | 2 +- functions/consumer/mongodb-consumer/pom.xml | 1 + .../function/aggregator-function/pom.xml | 1 + functions/spring-functions-parent/pom.xml | 11 +++++- functions/supplier/mongodb-supplier/pom.xml | 1 + stream-applications-build/pom.xml | 21 +++++----- stream-applications-release-train/pom.xml | 5 --- .../stream-applications-descriptor/pom.xml | 3 +- .../stream-applications-docs/pom.xml | 22 +++++++++-- 26 files changed, 176 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/ci-manual.yml diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 762f428c..48e2b492 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -26,4 +26,4 @@ jobs: with: branch: 'main' verbose: ${{ inputs.verbose == 'true' }} - useMavenThreads: false + maven_threads: '0.5C' diff --git a/.github/workflows/ci-manual.yml b/.github/workflows/ci-manual.yml new file mode 100644 index 00000000..78df924f --- /dev/null +++ b/.github/workflows/ci-manual.yml @@ -0,0 +1,31 @@ +name: 'CI - Manual' + +on: + workflow_dispatch: + inputs: + verbose: + default: 'false' + description: 'Verbose output' + required: false + branch: + description: 'Enter branch name' + required: true + maven_threads: + description: 'Maven Threads' + default: '1' + required: true + +jobs: + build: + uses: ./.github/workflows/common.yml + secrets: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + TMC_API_TOKEN: ${{ secrets.TMC_API_TOKEN }} + GCP_CRED_JSON: ${{ secrets.GCP_CRED_JSON }} + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + with: + branch: ${{ inputs.branch }} + verbose: ${{ inputs.verbose == 'true' }} + mavenThreads: ${{ inputs.maven_threads }} diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index ee28d21b..f3dc63f7 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -13,11 +13,11 @@ on: required: false default: false description: 'Verbose output' - useMavenThreads: - type: boolean + mavenThreads: + type: string required: false - default: false - description: 'Enable Maven Threads' + default: '1' + description: 'Maven Thread Option. Examples 0.5C, 2' secrets: DOCKERHUB_USERNAME: DOCKERHUB_TOKEN: @@ -33,7 +33,7 @@ on: env: VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }} BRANCH: ${{ inputs.branch }} - MAVEN_THREADS: ${{ inputs.useMavenThreads }} + MAVEN_THREADS: ${{ inputs.mavenThreads }} jobs: scan: @@ -57,6 +57,7 @@ jobs: shell: bash run: echo "::info ::Scanned" parameters: + name: 'parameters - ${{ inputs.branch }}' if: ${{ github.repository == 'spring-cloud/stream-applications' }} runs-on: ubuntu-latest steps: @@ -108,12 +109,12 @@ jobs: echo "SOURCES=$SOURCES" >> $GITHUB_ENV popd - if [ "${{ inputs.branch }}" == "main" ]; then + if [[ "${{ inputs.branch }}" == *"2021"* ]]; then + echo "JDK_BUILD=8" >> $GITHUB_ENV + echo "JRE_DEFAULT=11" >> $GITHUB_ENV + else echo "JDK_BUILD=17" >> $GITHUB_ENV echo "JRE_DEFAULT=17" >> $GITHUB_ENV - else - echo "JDK_BUILD=8" >> $GITHUB_ENV - echo "JRE_DEFAULT=11" >> $GITHUB_ENV fi if [ "${{ inputs.verbose }}" == "true" ]; then echo "::debug ::MAX_PARALLEL=$MAX_PARALLEL" @@ -142,6 +143,7 @@ jobs: jdk_build: ${{ env.JDK_BUILD }} jre_version: ${{ env.JRE_DEFAULT }} core: + name: 'core - ${{ inputs.branch }}' if: ${{ github.repository == 'spring-cloud/stream-applications' }} runs-on: ubuntu-latest needs: @@ -213,13 +215,13 @@ jobs: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }} - MAVEN_THREADS: ${{ inputs.useMavenThreads }} + MAVEN_THREADS: ${{ inputs.mavenThreads }} run: | ROOT_DIR=$(realpath $PWD) pushd stream-applications > /dev/null echo "::notice ::building - stream-applications-build,functions,applications/stream-applications-core" set -e - $ROOT_DIR/build-folder.sh stream-applications-build,functions,applications/stream-applications-core "install verify deploy" + $ROOT_DIR/build-core.sh "install verify deploy" set +e echo "::notice ::core build completed" popd > /dev/null @@ -343,7 +345,7 @@ jobs: ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }} - MAVEN_THREADS: ${{ inputs.useMavenThreads }} + MAVEN_THREADS: ${{ inputs.mavenThreads }} run: ./build-app.sh "stream-applications" "applications/processor/${{ matrix.app }}" - name: 'Upload: Test Reports' if: ${{ always() }} @@ -444,7 +446,7 @@ jobs: ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }} - MAVEN_THREADS: ${{ inputs.useMavenThreads }} + MAVEN_THREADS: ${{ inputs.mavenThreads }} run: ./build-app.sh "stream-applications" "applications/sink/${{ matrix.app }}" - name: 'Upload: Test Reports' if: ${{ always() }} @@ -545,7 +547,7 @@ jobs: ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }} - MAVEN_THREADS: ${{ inputs.useMavenThreads }} + MAVEN_THREADS: ${{ inputs.mavenThreads }} run: ./build-app.sh "stream-applications" "applications/source/${{ matrix.app }}" - name: 'Upload: Test Reports' if: ${{ always() }} @@ -637,7 +639,7 @@ jobs: ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }} - MAVEN_THREADS: ${{ inputs.useMavenThreads }} + MAVEN_THREADS: ${{ inputs.mavenThreads }} run: | ROOT_DIR=$(realpath $PWD) pushd stream-applications > /dev/null diff --git a/applications/sink/elasticsearch-sink/pom.xml b/applications/sink/elasticsearch-sink/pom.xml index 47d680d0..1cd376ba 100644 --- a/applications/sink/elasticsearch-sink/pom.xml +++ b/applications/sink/elasticsearch-sink/pom.xml @@ -33,19 +33,19 @@ org.testcontainers testcontainers - ${test-containers.version} + ${testcontainers.version} test org.testcontainers junit-jupiter - ${test-containers.version} + ${testcontainers.version} test org.testcontainers elasticsearch - ${test-containers.version} + ${testcontainers.version} test diff --git a/applications/sink/mqtt-sink/pom.xml b/applications/sink/mqtt-sink/pom.xml index e055bf2d..4ce107a9 100644 --- a/applications/sink/mqtt-sink/pom.xml +++ b/applications/sink/mqtt-sink/pom.xml @@ -22,7 +22,7 @@ org.testcontainers testcontainers - ${test-containers.version} + ${testcontainers.version} test diff --git a/applications/sink/rabbit-sink/pom.xml b/applications/sink/rabbit-sink/pom.xml index bbd3c375..9a7230c4 100644 --- a/applications/sink/rabbit-sink/pom.xml +++ b/applications/sink/rabbit-sink/pom.xml @@ -37,16 +37,19 @@ org.testcontainers testcontainers + ${testcontainers.version} test org.testcontainers junit-jupiter + ${testcontainers.version} true org.testcontainers rabbitmq + ${testcontainers.version} test diff --git a/applications/sink/redis-sink/pom.xml b/applications/sink/redis-sink/pom.xml index f1249555..d8edea4c 100644 --- a/applications/sink/redis-sink/pom.xml +++ b/applications/sink/redis-sink/pom.xml @@ -23,6 +23,7 @@ org.testcontainers testcontainers + ${testcontainers.version} test diff --git a/applications/source/debezium-source/pom.xml b/applications/source/debezium-source/pom.xml index 8bc7ee00..c58ca640 100644 --- a/applications/source/debezium-source/pom.xml +++ b/applications/source/debezium-source/pom.xml @@ -65,6 +65,7 @@ org.testcontainers testcontainers + ${testcontainers.version} test @@ -77,12 +78,14 @@ org.testcontainers junit-jupiter + ${testcontainers.version} test org.testcontainers mysql + ${testcontainers.version} test @@ -123,7 +126,7 @@ org.testcontainers mssqlserver - 1.18.2 + ${testcontainers.version} test diff --git a/applications/source/mqtt-source/pom.xml b/applications/source/mqtt-source/pom.xml index 03066664..6d3bde51 100644 --- a/applications/source/mqtt-source/pom.xml +++ b/applications/source/mqtt-source/pom.xml @@ -22,7 +22,7 @@ org.testcontainers testcontainers - ${test-containers.version} + ${testcontainers.version} test diff --git a/applications/source/rabbit-source/pom.xml b/applications/source/rabbit-source/pom.xml index 0195ac42..1af7cf02 100644 --- a/applications/source/rabbit-source/pom.xml +++ b/applications/source/rabbit-source/pom.xml @@ -27,13 +27,13 @@ org.testcontainers testcontainers - ${test-containers.version} + ${testcontainers.version} test org.testcontainers rabbitmq - ${test-containers.version} + ${testcontainers.version} test diff --git a/applications/stream-applications-core/pom.xml b/applications/stream-applications-core/pom.xml index fa4c2251..9b9bdbc9 100644 --- a/applications/stream-applications-core/pom.xml +++ b/applications/stream-applications-core/pom.xml @@ -65,6 +65,20 @@ mockserver-client-java ${mockserver.version} + + org.junit + junit-bom + 5.9.3 + pom + import + + + org.testcontainers + testcontainers-bom + ${testcontainers.version} + pom + import + diff --git a/applications/stream-applications-core/stream-applications-test-support/pom.xml b/applications/stream-applications-core/stream-applications-test-support/pom.xml index 52c59f93..d03c68e1 100644 --- a/applications/stream-applications-core/stream-applications-test-support/pom.xml +++ b/applications/stream-applications-core/stream-applications-test-support/pom.xml @@ -49,28 +49,38 @@ org.springframework spring-web + + org.junit.jupiter + junit-jupiter + compile + org.testcontainers junit-jupiter - true + ${testcontainers.version} + compile org.testcontainers kafka - true + ${testcontainers.version} + compile org.testcontainers rabbitmq - true + ${testcontainers.version} + compile com.github.ben-manes.caffeine caffeine + compile org.awaitility awaitility + compile com.rabbitmq @@ -82,6 +92,7 @@ org.apache.httpcomponents httpclient ${apache-httpclient.version} + compile diff --git a/applications/stream-applications-integration-tests/pom.xml b/applications/stream-applications-integration-tests/pom.xml index e38e7398..1243a8fd 100644 --- a/applications/stream-applications-integration-tests/pom.xml +++ b/applications/stream-applications-integration-tests/pom.xml @@ -31,30 +31,36 @@ org.testcontainers testcontainers + ${testcontainers.version} test org.testcontainers junit-jupiter + ${testcontainers.version} test org.testcontainers kafka + ${testcontainers.version} test org.testcontainers rabbitmq + ${testcontainers.version} org.testcontainers mongodb + ${testcontainers.version} test org.testcontainers mysql + ${testcontainers.version} test @@ -101,19 +107,9 @@ spring-boot-starter-jdbc test + - - - - org.testcontainers - testcontainers-bom - ${test-containers.version} - pom - import - - - diff --git a/build-folder.sh b/build-folder.sh index 281c827e..5d769912 100755 --- a/build-folder.sh +++ b/build-folder.sh @@ -89,34 +89,36 @@ if [[ "$MAVEN_GOAL" == *"deploy"* ]]; then check_env ARTIFACTORY_USERNAME check_env ARTIFACTORY_PASSWORD fi +MAVEN_THREADS_OPT=1 +if [ "$MAVEN_THREADS" != "" ]; then + case $MAVEN_THREADS in + "true") + MAVEN_THREADS_OPT="0.5C" + ;; + "false") + MAVEN_THREADS_OPT="1" -case $MAVEN_THREADS in -"true") - MVN_THR="-T 0.75C" - ;; -"false") - MVN_THR= - ;; -*) - MVN_THR="-T 0.5C" - ;; -esac - + ;; + *) + MAVEN_THREADS_OPT="$MAVEN_THREADS" + ;; + esac +fi +MVN_THR="-T $MAVEN_THREADS_OPT" if [ "$SKIP_RESOLVE" = "" ]; then SKIP_RESOLVE=true fi if [ "$SKIP_RESOLVE" = "true" ]; then - RETRIES=-1 + RETRIES=0 RESULT=0 else RETRIES=3 fi -while ((RETRIES >= 0)); do +while ((RETRIES > 0)); do echo -e "Resolving dependencies for ${bold}$FOLDER_FOLDER_NAMES${end}" set +e - - $SCDIR/mvnw -U -pl "$FOLDER_NAMES" $MAVEN_OPTS $MVN_THR dependency:resolve + $SCDIR/mvnw -U -pl "$FOLDER_NAMES" $MAVEN_OPTS -T 0.5C dependency:resolve RESULT=$? set -e if ((RESULT == 0)); then @@ -139,12 +141,12 @@ if ((RESULT == 0)); then source "$FOLDER/set-env.sh" fi set +e - echo -e "Maven goals:${bold}-f $FOLDER $MAVEN_OPTS $MVN_THR $MAVEN_GOAL${end}" + echo -e "Maven goals:${bold}-f $FOLDER $MAVEN_OPTS $MVN_THR "-DmavenThreads=$MAVEN_THREADS_OPT" $MAVEN_GOAL${end}" MVNW="./mvnw" if [ ! -f $MVNW ]; then MVNW="$SCDIR/mvnw" fi - $MVNW -f "$FOLDER" $MAVEN_OPTS $MVN_THR $MAVEN_GOAL + $MVNW -f "$FOLDER" $MAVEN_OPTS $MVN_THR "-DmavenThreads=$MAVEN_THREADS_OPT" $MAVEN_GOAL RESULT=$? set -e if ((RESULT != 0)); then diff --git a/functions/common/function-test-support/pom.xml b/functions/common/function-test-support/pom.xml index e5f67fe9..cbd42ee9 100644 --- a/functions/common/function-test-support/pom.xml +++ b/functions/common/function-test-support/pom.xml @@ -43,18 +43,29 @@ org.apache.sshd sshd-sftp ${sshd-sftp.version} + compile + + + org.junit.jupiter + junit-jupiter + compile org.testcontainers testcontainers + ${testcontainers.version} + compile org.testcontainers junit-jupiter + ${testcontainers.version} + compile org.awaitility awaitility + compile diff --git a/functions/common/mongodb-common/pom.xml b/functions/common/mongodb-common/pom.xml index 1eaeb2c3..3b62ba45 100644 --- a/functions/common/mongodb-common/pom.xml +++ b/functions/common/mongodb-common/pom.xml @@ -18,6 +18,7 @@ org.testcontainers mongodb + ${testcontainers.version} test diff --git a/functions/consumer/cassandra-consumer/pom.xml b/functions/consumer/cassandra-consumer/pom.xml index 9e7de98e..f906614f 100644 --- a/functions/consumer/cassandra-consumer/pom.xml +++ b/functions/consumer/cassandra-consumer/pom.xml @@ -26,6 +26,7 @@ org.testcontainers cassandra + ${testcontainers.version} test diff --git a/functions/consumer/elasticsearch-consumer/pom.xml b/functions/consumer/elasticsearch-consumer/pom.xml index fb00f8af..17042c12 100644 --- a/functions/consumer/elasticsearch-consumer/pom.xml +++ b/functions/consumer/elasticsearch-consumer/pom.xml @@ -41,7 +41,7 @@ org.testcontainers elasticsearch - ${test-containers.version} + ${testcontainers.version} test diff --git a/functions/consumer/mongodb-consumer/pom.xml b/functions/consumer/mongodb-consumer/pom.xml index fd3d274d..1a5ffba9 100644 --- a/functions/consumer/mongodb-consumer/pom.xml +++ b/functions/consumer/mongodb-consumer/pom.xml @@ -26,6 +26,7 @@ org.testcontainers mongodb + ${testcontainers.version} test diff --git a/functions/function/aggregator-function/pom.xml b/functions/function/aggregator-function/pom.xml index 57a24503..6a8d350f 100644 --- a/functions/function/aggregator-function/pom.xml +++ b/functions/function/aggregator-function/pom.xml @@ -37,6 +37,7 @@ org.testcontainers mongodb + ${testcontainers.version} test diff --git a/functions/spring-functions-parent/pom.xml b/functions/spring-functions-parent/pom.xml index 0a7bdb11..26c6221c 100644 --- a/functions/spring-functions-parent/pom.xml +++ b/functions/spring-functions-parent/pom.xml @@ -56,6 +56,11 @@ spring-boot-starter-test test + + org.junit.jupiter + junit-jupiter + test + org.springframework.integration spring-integration-test @@ -68,12 +73,14 @@ org.testcontainers - junit-jupiter + testcontainers + ${testcontainers.version} test org.testcontainers - testcontainers + junit-jupiter + ${testcontainers.version} test diff --git a/functions/supplier/mongodb-supplier/pom.xml b/functions/supplier/mongodb-supplier/pom.xml index 465671b9..0b37beca 100644 --- a/functions/supplier/mongodb-supplier/pom.xml +++ b/functions/supplier/mongodb-supplier/pom.xml @@ -36,6 +36,7 @@ org.testcontainers mongodb + ${testcontainers.version} test diff --git a/stream-applications-build/pom.xml b/stream-applications-build/pom.xml index a1ef8a04..6c67f77a 100644 --- a/stream-applications-build/pom.xml +++ b/stream-applications-build/pom.xml @@ -35,22 +35,23 @@ 0.0.10 true 0.0.35 + 3.0.7 3.0.7 3.0.4 6.0.9 6.0.5 - 2022.0.2 - 4.0.2 - 4.0.2 - 4.0.2 - 1.17.6 + 2022.0.3 + 4.0.3 + 4.0.3 + 4.0.3 + 1.18.3 5.13.2 4.0.5 3.1.0 - + 1 https://spring.io/projects/spring-cloud-stream-applications @@ -86,7 +87,7 @@ org.testcontainers testcontainers-bom - ${test-containers.version} + ${testcontainers.version} pom import @@ -150,7 +151,7 @@ ${maven-surefire-plugin.version} classes - 0.25C + ${mavenThreads} true @@ -328,7 +329,7 @@ ${maven-surefire-plugin.version} classes - 0.25C + ${mavenThreads} integration @@ -345,7 +346,7 @@ ${maven-surefire-plugin.version} classes - 0.25C + ${mavenThreads} integration diff --git a/stream-applications-release-train/pom.xml b/stream-applications-release-train/pom.xml index 29112f97..ba0e2c24 100644 --- a/stream-applications-release-train/pom.xml +++ b/stream-applications-release-train/pom.xml @@ -33,11 +33,6 @@ true - - spring-releases - Spring Releases - https://repo.spring.io/release - spring-milestones Spring Milestones diff --git a/stream-applications-release-train/stream-applications-descriptor/pom.xml b/stream-applications-release-train/stream-applications-descriptor/pom.xml index 6517301c..02626601 100644 --- a/stream-applications-release-train/stream-applications-descriptor/pom.xml +++ b/stream-applications-release-train/stream-applications-descriptor/pom.xml @@ -41,9 +41,8 @@ org.codehaus.groovy groovy-all - 3.0.9 + 3.0.17 pom - runtime diff --git a/stream-applications-release-train/stream-applications-docs/pom.xml b/stream-applications-release-train/stream-applications-docs/pom.xml index b484684a..4873e65c 100644 --- a/stream-applications-release-train/stream-applications-docs/pom.xml +++ b/stream-applications-release-train/stream-applications-docs/pom.xml @@ -16,9 +16,25 @@ - spring-release - spring-release - https://repo.spring.io/release + maven-central + Maven Central + https://repo.maven.apache.org/maven2 + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true +