diff --git a/.github/release-files-spec.json b/.github/release-files-spec.json deleted file mode 100644 index ee43685f90..0000000000 --- a/.github/release-files-spec.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "files": [ - { - "aql": { - "items.find": { - "$and": [ - { - "@build.name": "${buildname}", - "@build.number": "${buildnumber}", - "path": {"$match": "org*"} - }, - { - "$or": [ - { - "name": {"$match": "*.pom"} - }, - { - "name": {"$match": "*.jar"} - }, - { - "name": {"$match": "*.module"} - } - ] - } - ] - } - }, - "target": "nexus/" - } - ] -} diff --git a/.github/workflows/central-sync-close.yml b/.github/workflows/central-sync-close.yml deleted file mode 100644 index a00aebd4d4..0000000000 --- a/.github/workflows/central-sync-close.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Central Sync Close - -on: - workflow_dispatch: - inputs: - stagedRepositoryId: - description: "Staged repository id" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - # Request close promotion repo - - uses: jvalkeal/nexus-sync@v0 - with: - url: ${{ secrets.OSSRH_URL }} - username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} - password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} - staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} - staging-repo-id: ${{ github.event.inputs.stagedRepositoryId }} - close: true diff --git a/.github/workflows/central-sync-create.yml b/.github/workflows/central-sync-create.yml deleted file mode 100644 index 5f7f0e7df2..0000000000 --- a/.github/workflows/central-sync-create.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Central Sync Create - -on: - workflow_dispatch: - inputs: - buildName: - description: "Artifactory build name" - required: true - buildNumber: - description: "Artifactory build number" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - # to get spec file in .github - - uses: actions/checkout@v2 - - # Setup jfrog cli - - uses: jfrog/setup-jfrog-cli@v1 - with: - version: 1.51.1 - env: - JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} - - # Extract build id from input - - name: Extract Build Id - run: | - echo JFROG_CLI_BUILD_NAME="${{ github.event.inputs.buildName }}" >> $GITHUB_ENV - echo JFROG_CLI_BUILD_NUMBER=${{ github.event.inputs.buildNumber }} >> $GITHUB_ENV - - # Download released files - - name: Download Release Files - run: | - jfrog rt download \ - --spec .github/release-files-spec.json \ - --spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER" - - # Create checksums, signatures and create staging repo on central and upload - - uses: jvalkeal/nexus-sync@v0 - id: nexus - with: - url: ${{ secrets.OSSRH_URL }} - username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} - password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} - staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} - create: true - upload: true - generate-checksums: true - pgp-sign: true - pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }} - pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - - # Print staging repo id - - name: Print Staging Repo Id - run: echo ${{ steps.nexus.outputs.staged-repository-id }} diff --git a/.github/workflows/central-sync-release.yml b/.github/workflows/central-sync-release.yml deleted file mode 100644 index abf2cb92f2..0000000000 --- a/.github/workflows/central-sync-release.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Central Sync Release - -on: - workflow_dispatch: - inputs: - stagedRepositoryId: - description: "Staged repository id" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - # Request release promotion repo - - uses: jvalkeal/nexus-sync@v0 - with: - url: ${{ secrets.OSSRH_URL }} - username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} - password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} - staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} - staging-repo-id: ${{ github.event.inputs.stagedRepositoryId }} - release: true diff --git a/.github/workflows/ci-snapshot.yml b/.github/workflows/ci-snapshot.yml new file mode 100644 index 0000000000..92496aacfe --- /dev/null +++ b/.github/workflows/ci-snapshot.yml @@ -0,0 +1,16 @@ +name: CI SNAPSHOT + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + build-snapshot: + uses: artembilan/spring-github-workflows/.github/workflows/spring-artifactory-gradle-snapshot.yml@main + secrets: + GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }} + GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} + GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} \ No newline at end of file diff --git a/.github/workflows/pr-build-workflow.yml b/.github/workflows/pr-build-workflow.yml deleted file mode 100644 index 5c1cb562d2..0000000000 --- a/.github/workflows/pr-build-workflow.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Pull Request build - -on: - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - - services: - rabbitmq: - image: rabbitmq:management - ports: - - 5672:5672 - - 15762:15762 - - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - - name: Run Gradle - uses: burrunan/gradle-cache-action@v1 - with: - arguments: check - - - name: Capture Test Results - if: failure() - uses: actions/upload-artifact@v2 - with: - name: test-results - path: '*/build/reports/tests/**/*.*' - retention-days: 3 diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 0000000000..246f6a7f11 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,10 @@ +name: Pull Request Build + +on: + pull_request: + branches: + - main + +jobs: + build-pull-request: + uses: artembilan/spring-github-workflows/.github/workflows/spring-gradle-pull-request-build.yml@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..24dd09d29c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Release + +on: + workflow_dispatch: + +run-name: Release current version for branch ${{ github.ref_name }} + +jobs: + release: + uses: artembilan/spring-github-workflows/.github/workflows/spring-artifactory-release.yml@main + secrets: + GH_ACTIONS_REPO_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} + GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }} + GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} + GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + OSSRH_URL: ${{ secrets.OSSRH_URL }} + OSSRH_S01_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} + OSSRH_S01_TOKEN_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} + OSSRH_STAGING_PROFILE_NAME: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + SPRING_RELEASE_SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/verify-staged-artifacts.yml b/.github/workflows/verify-staged-artifacts.yml new file mode 100644 index 0000000000..2ce9e9285b --- /dev/null +++ b/.github/workflows/verify-staged-artifacts.yml @@ -0,0 +1,47 @@ +name: Verify Staged Artifacts + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: 'Release version like 5.0.0-M1, 5.1.0-RC1, 5.2.0 etc.' + required: true + type: string + +jobs: + verify-staged-with-samples: + runs-on: ubuntu-latest + steps: + + - name: Checkout Samples Repo + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-amqp-samples + show-progress: false + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + cache: 'maven' + + - uses: jfrog/setup-jfrog-cli@v3 + - name: Configure JFrog Cli + run: | + jf mvnc \ + --repo-resolve-releases=libs-staging-local \ + --repo-resolve-snapshots=snapshot \ + --repo-deploy-releases=libs-milestone-local \ + --repo-deploy-snapshots=libs-snapshot-local + + - name: Verify samples against staged release + run: jf mvn verify -D"spring.amqp.version"=${{ inputs.releaseVersion }} + + - name: Capture Test Results + if: failure() + uses: actions/upload-artifact@v3 + with: + name: test-results + path: '**/target/surefire-reports/**/*.*' + retention-days: 1 \ No newline at end of file diff --git a/build.gradle b/build.gradle index 499c81ccbc..086037186d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { ext.kotlinVersion = '1.9.10' - ext.isCI = System.getenv('GITHUB_ACTION') || System.getenv('bamboo_buildKey') + ext.isCI = System.getenv('GITHUB_ACTION') repositories { mavenCentral() gradlePluginPortal() @@ -19,11 +19,9 @@ plugins { id 'base' id 'project-report' id 'idea' - id 'org.sonarqube' version '4.3.0.3225' - id 'org.ajoberstar.grgit' version '4.0.1' + id 'org.ajoberstar.grgit' version '4.1.1' id 'io.spring.nohttp' version '0.0.11' - id 'io.spring.dependency-management' version '1.0.9.RELEASE' apply false - id 'com.jfrog.artifactory' version '4.33.1' apply false + id 'io.spring.dependency-management' version '1.1.4' apply false id 'org.asciidoctor.jvm.pdf' version '3.3.2' id 'org.asciidoctor.jvm.convert' version '3.3.2' } @@ -135,7 +133,6 @@ configure(javaProjects) { subproject -> apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'project-report' - apply plugin: 'jacoco' apply plugin: 'checkstyle' apply plugin: 'kotlin' apply plugin: 'kotlin-spring' @@ -168,10 +165,6 @@ configure(javaProjects) { subproject -> } } - jacoco { - toolVersion = '0.8.10' - } - // dependencies that are common across all java projects dependencies { compileOnly "com.google.code.findbugs:jsr305:$googleJsr305Version" @@ -279,25 +272,8 @@ configure(javaProjects) { subproject -> showStackTraces = true exceptionFormat = 'full' } - - jacoco { - destinationFile = file("$buildDir/jacoco.exec") - } - - } - - jacocoTestReport { - onlyIf { System.properties['sonar.host.url'] } - dependsOn test - reports { - xml.required = true - csv.required = false - html.required = false - } } - rootProject.tasks['sonarqube'].dependsOn jacocoTestReport - task testAll(type: Test, dependsOn: check) gradle.taskGraph.whenReady { graph -> @@ -402,10 +378,6 @@ project('spring-amqp-bom') { } } } - - sonarqube { - skipProject = true - } } project('spring-rabbit') { @@ -644,16 +616,6 @@ task reference(dependsOn: asciidoctor) { description = 'Generate the reference documentation' } -sonarqube { - properties { - property 'sonar.links.homepage', linkHomepage - property 'sonar.links.ci', linkCi - property 'sonar.links.issue', linkIssue - property 'sonar.links.scm', linkScmUrl - property 'sonar.links.scm_dev', linkScmDevConnection - } -} - task api(type: Javadoc) { group = 'Documentation' description = 'Generates aggregated Javadoc API documentation.' diff --git a/gradle/publish-maven.gradle b/gradle/publish-maven.gradle index c83c8d33fb..0b72dba7c3 100644 --- a/gradle/publish-maven.gradle +++ b/gradle/publish-maven.gradle @@ -1,5 +1,4 @@ apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.artifactory' publishing { publications { @@ -80,8 +79,3 @@ publishing { } } } - -artifactoryPublish { - dependsOn build - publications(publishing.publications.mavenJava) -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c4cd..7f93135c49 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 19d44294b5..46671acb6e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,9 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists - diff --git a/gradlew b/gradlew index fcb6fca147..1aa94a4269 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/settings.gradle b/settings.gradle index ccd2abcf6d..d2eed3f267 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ plugins { - id 'com.gradle.enterprise' version '3.13.4' - id 'io.spring.ge.conventions' version '0.0.13' + id 'com.gradle.enterprise' version '3.14.1' + id 'io.spring.ge.conventions' version '0.0.14' } rootProject.name = 'spring-amqp-dist' diff --git a/spring-rabbit-junit/src/main/java/org/springframework/amqp/rabbit/junit/AbstractTestContainerTests.java b/spring-rabbit-junit/src/main/java/org/springframework/amqp/rabbit/junit/AbstractTestContainerTests.java index f3246d9ab5..0d45fc7aec 100644 --- a/spring-rabbit-junit/src/main/java/org/springframework/amqp/rabbit/junit/AbstractTestContainerTests.java +++ b/spring-rabbit-junit/src/main/java/org/springframework/amqp/rabbit/junit/AbstractTestContainerTests.java @@ -16,14 +16,18 @@ package org.springframework.amqp.rabbit.junit; +import java.io.IOException; import java.time.Duration; +import org.junit.jupiter.api.BeforeAll; import org.testcontainers.containers.RabbitMQContainer; import org.testcontainers.junit.jupiter.Testcontainers; import org.testcontainers.utility.DockerImageName; /** * @author Gary Russell + * @author Artem Bilan + * * @since 2.4 * */ @@ -35,7 +39,7 @@ public abstract class AbstractTestContainerTests { static { if (System.getProperty("spring.rabbit.use.local.server") == null && System.getenv("SPRING_RABBIT_USE_LOCAL_SERVER") == null) { - String image = "rabbitmq:3.11-management"; + String image = "rabbitmq:management"; String cache = System.getenv().get("IMAGE_CACHE"); if (cache != null) { image = cache + image; @@ -44,15 +48,19 @@ public abstract class AbstractTestContainerTests { .asCompatibleSubstituteFor("rabbitmq"); RABBITMQ = new RabbitMQContainer(imageName) .withExposedPorts(5672, 15672, 5552) - .withPluginsEnabled("rabbitmq_stream") .withStartupTimeout(Duration.ofMinutes(2)); - RABBITMQ.start(); } else { RABBITMQ = null; } } + @BeforeAll + static void startContainer() throws IOException, InterruptedException { + RABBITMQ.start(); + RABBITMQ.execInContainer("rabbitmq-plugins", "enable", "rabbitmq_stream"); + } + public static int amqpPort() { return RABBITMQ != null ? RABBITMQ.getAmqpPort() : 5672; } diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/SimpleMessageListenerContainerIntegration2Tests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/SimpleMessageListenerContainerIntegration2Tests.java index 290b7d759d..ec13130380 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/SimpleMessageListenerContainerIntegration2Tests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/SimpleMessageListenerContainerIntegration2Tests.java @@ -103,7 +103,7 @@ public class SimpleMessageListenerContainerIntegration2Tests { public static final String TEST_QUEUE_1 = "test.queue.1.SimpleMessageListenerContainerIntegration2Tests"; - private static Log logger = LogFactory.getLog(SimpleMessageListenerContainerIntegration2Tests.class); + private static final Log logger = LogFactory.getLog(SimpleMessageListenerContainerIntegration2Tests.class); private final ExecutorService executorService = Executors.newSingleThreadExecutor(); @@ -415,7 +415,7 @@ else if (event instanceof ConsumeOkEvent) { ArgumentCaptor contLogCaptor = ArgumentCaptor.forClass(String.class); verify(containerLogger, atLeastOnce()).debug(contLogCaptor.capture()); assertThat(contLogCaptor.getAllValues()).anyMatch(arg -> arg.contains("exclusive")); - ArgumentCaptor lmCaptor = ArgumentCaptor.forClass(LogMessage.class); + ArgumentCaptor lmCaptor = ArgumentCaptor.forClass(LogMessage.class); verify(containerLogger).debug(lmCaptor.capture()); assertThat(lmCaptor.getAllValues()).anyMatch(arg -> arg.toString().startsWith("Restarting ")); }