-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: migrate maven plugin integration tests to a composite build (#…
…1662) ### 📝 Description Migrate Maven plugin integration tests to a composite build to speed up the overall build and simplify main build logic. ### 🔗 Related Issues
- Loading branch information
1 parent
1fbbd48
commit d13be15
Showing
74 changed files
with
741 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+58.5 KB
integration/maven-plugin-integration-tests/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
integration/maven-plugin-integration-tests/.mvn/wrapper/maven-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar |
94 changes: 94 additions & 0 deletions
94
integration/maven-plugin-integration-tests/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import com.github.tomakehurst.wiremock.standalone.WireMockServerRunner | ||
import java.time.Duration | ||
import java.util.Properties | ||
|
||
description = "GraphQL Kotlin Maven Plugin that can generate type-safe GraphQL Kotlin client and GraphQL schema in SDL format using reflections" | ||
|
||
buildscript { | ||
dependencies { | ||
classpath(libs.wiremock.standalone) | ||
} | ||
} | ||
|
||
@Suppress("DSL_SCOPE_VIOLATION") // TODO: remove once KTIJ-19369 / Gradle#22797 is fixed | ||
plugins { | ||
alias(libs.plugins.kotlin.jvm) | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal { | ||
content { | ||
includeGroup("com.expediagroup") | ||
} | ||
} | ||
} | ||
|
||
val properties = Properties() | ||
properties.load(File(rootDir.parentFile.parent, "gradle.properties").inputStream()) | ||
for ((key, value) in properties) { | ||
project.ext[key.toString()] = value | ||
} | ||
|
||
tasks { | ||
val kotlinJvmVersion: String by project | ||
/* | ||
Integration tests are run through maven-invoker-plugin which will execute tests under src/integration/<scenario> | ||
*/ | ||
val mavenEnvironmentVariables = mapOf( | ||
"graphqlKotlinVersion" to project.ext["version"], | ||
"graphqlJavaVersion" to libs.versions.graphql.java.get(), | ||
"kotlinJvmTarget" to kotlinJvmVersion, | ||
"kotlinVersion" to libs.versions.kotlin.get(), | ||
"kotlinxCoroutinesVersion" to libs.versions.kotlinx.coroutines.get(), | ||
"kotlinPoetVersion" to libs.versions.poet.get(), | ||
"kotlinxSerializationVersion" to libs.versions.kotlinx.serialization.get(), | ||
"ktorVersion" to libs.versions.ktor.get(), | ||
"reactorVersion" to libs.versions.reactor.core.get(), | ||
"junitVersion" to libs.versions.junit.get() | ||
) | ||
var wireMockServer: WireMockServerRunner? = null | ||
var wireMockServerPort: Int? = null | ||
val startWireMock by register("startWireMock") { | ||
dependsOn(gradle.includedBuild("graphql-kotlin").task(":resolveIntegrationTestDependencies")) | ||
finalizedBy("stopWireMock") | ||
|
||
doLast { | ||
val wireMockConfig = arrayOf( | ||
"--root-dir=${project.projectDir}/integration/wiremock", | ||
"--port=0" | ||
) | ||
wireMockServer = WireMockServerRunner() | ||
wireMockServer?.run(*wireMockConfig) | ||
wireMockServerPort = wireMockServer?.port() | ||
logger.info("wiremock started at port $wireMockServerPort") | ||
} | ||
} | ||
val stopWireMock by register("stopWireMock") { | ||
mustRunAfter("startWireMock") | ||
|
||
doLast { | ||
val server = wireMockServer | ||
if (server?.isRunning == true) { | ||
logger.info("attempting to stop wiremock server") | ||
server.stop() | ||
logger.info("wiremock server stopped") | ||
} | ||
} | ||
} | ||
val integrationTest by register("integrationTest") { | ||
dependsOn(startWireMock.path) | ||
finalizedBy(stopWireMock.path) | ||
timeout.set(Duration.ofSeconds(500)) | ||
doLast { | ||
exec { | ||
environment(mavenEnvironmentVariables) | ||
environment("graphqlEndpoint", "http://localhost:$wireMockServerPort") | ||
commandLine("${project.projectDir}/mvnw", "dependency:go-offline", "invoker:install", "invoker:run", "--no-transfer-progress") | ||
} | ||
} | ||
} | ||
check { | ||
dependsOn(integrationTest.path) | ||
} | ||
} |
Binary file added
BIN
+60.1 KB
integration/maven-plugin-integration-tests/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
integration/maven-plugin-integration-tests/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.