diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 8ab4fed1..eab6d398 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -34,9 +34,13 @@ jobs: env: GRADLE_USER_HOME: ~/.gradle - - name: Run Gradle build + - name: Build and run unit tests run: | - ./gradlew clean build -DdownloadRabbitConnector=false --continue --scan + ./gradlew clean build -x integrationTest --continue --scan + + - name: Run integration tests + run: | + ./gradlew integrationTest --rerun-tasks -DdownloadRabbitConnector=true --scan - name: Capture Test Results if: failure() diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2164f7f4..d7e2eb25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,9 +39,12 @@ jobs: uses: gradle/gradle-build-action@v2 env: GRADLE_USER_HOME: ~/.gradle - - name: Run Gradle build + - name: Build and run unit tests run: | - ./gradlew clean build -DdownloadRabbitConnector=false --continue -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" + ./gradlew clean build -x integrationTest --continue --scan -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" + - name: Run integration tests + run: | + ./gradlew integrationTest --rerun-tasks -DdownloadRabbitConnector=true --scan - name: Capture test results if: failure() uses: actions/upload-artifact@v3 diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 450c8812..6468a855 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -106,6 +106,10 @@ gradlePlugin { id = "io.spring.convention.artfiactory" implementationClass = "io.spring.gradle.convention.ArtifactoryPlugin" } + integrationTestPlugin { + id = "io.spring.convention.integration-test" + implementationClass = "io.spring.gradle.convention.IntegrationTestPlugin" + } repositoryConventionPlugin { id = "io.spring.convention.repository" implementationClass = "io.spring.gradle.convention.RepositoryConventionPlugin" diff --git a/buildSrc/src/main/groovy/io/spring/gradle/convention/IntegrationTestPlugin.groovy b/buildSrc/src/main/groovy/io/spring/gradle/convention/IntegrationTestPlugin.groovy new file mode 100644 index 00000000..5ce8321b --- /dev/null +++ b/buildSrc/src/main/groovy/io/spring/gradle/convention/IntegrationTestPlugin.groovy @@ -0,0 +1,116 @@ +/* + * Copyright 2016-2023 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package io.spring.gradle.convention + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.Task +import org.gradle.api.plugins.JavaPlugin +import org.gradle.api.tasks.testing.Test +import org.gradle.plugins.ide.eclipse.EclipsePlugin +import org.gradle.plugins.ide.idea.IdeaPlugin + +import org.springframework.boot.gradle.optional.OptionalDependenciesPlugin + +/** + * Adds support for integration tests to java projects. + *