Skip to content

Commit

Permalink
WIP 314 Add/Fix Maven plugin integration test
Browse files Browse the repository at this point in the history
as the integration tests build the full READMEs of all components.
Then check them for consistency with each UI, i.e., with
CLI, Gradle, and Maven.
  • Loading branch information
ascheman committed Dec 15, 2024
1 parent 03c569d commit a2648cf
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 11 deletions.
51 changes: 41 additions & 10 deletions integration-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id 'base'
}

final String BUILD_DIRECTORY = "${Project.DEFAULT_BUILD_DIR_NAME}"

version = htmlSanityCheckVersion
Expand Down Expand Up @@ -124,34 +128,61 @@ tasks.register("integrationTestCli") {

final String INTEGRATION_TEST_DIRECTORY_MAVEN = "maven-plugin"

tasks.register("integrationTestMaven") {
tasks.register("cleanIntegrationTestMavenPlugin") {
group("Verification")
description("Run overall integration tests (no publish)")
description("Deletes the result directory of maven-plugin integration tests")

File integrationTestDirectory = file(INTEGRATION_TEST_DIRECTORY_MAVEN)
final File testIndex = new File(integrationTestDirectory, "target/reports/index.html")

outputs.file testIndex

doLast {
def result = exec {
workingDir INTEGRATION_TEST_DIRECTORY_MAVEN
commandLine System.getProperty("os.name") ==~ /Windows.*/ ? "cmd /c mvnw.cmd" : "./mvnw",
"clean", "verify", "-Dhsc.version=${project.version}", "-ssettings.xml"
"clean", "-Dhsc.version=${project.version}", "-ssettings.xml"
}

}

outputs.upToDateWhen {
!testIndex.exists()
}
}

tasks.register("integrationTestMavenPlugin") {
group("Verification")
description("Run Maven integration tests (only)")

File integrationTestDirectory = file(INTEGRATION_TEST_DIRECTORY_MAVEN)
final File testIndex = new File(integrationTestDirectory, "target/reports/index.html")

outputs.file testIndex

doLast {
def result = exec {
workingDir INTEGRATION_TEST_DIRECTORY_MAVEN
commandLine System.getProperty("os.name") ==~ /Windows.*/ ? "cmd /c mvnw.cmd" : "./mvnw",
"verify", "-Dhsc.version=${project.version}", "-ssettings.xml"
}
logger.debug "Script output: $result"
File integrationTestDirectory = file(INTEGRATION_TEST_DIRECTORY_MAVEN)
final File testIndex = new File(integrationTestDirectory, "target/reports/htmlSanityCheck/index.html")
assert testIndex.exists()
}
}


tasks.register("integrationTest") {
group("Verification")
description("Run all integration tests (without any installations etc.)")

dependsOn(integrationTestGradlePlugin, integrationTestCli, integrationTestMaven)
dependsOn(integrationTestGradlePlugin, integrationTestCli, integrationTestMavenPlugin)
}

tasks.register("clean", Delete) {
tasks.register("cleanIntegrationTest", Delete) {
group("Build")
description("Deletes all builds")
description("Deletes all integration test builds")

dependsOn(cleanIntegrationTestCommon, cleanIntegrationTestGradlePlugin, cleanIntegrationTestCli)
dependsOn(cleanIntegrationTestCommon, cleanIntegrationTestGradlePlugin,
cleanIntegrationTestCli, cleanIntegrationTestMavenPlugin)
}
clean.dependsOn(cleanIntegrationTest)
19 changes: 18 additions & 1 deletion integration-test/common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,28 @@ tasks.register('buildReadmeCli', org.asciidoctor.gradle.jvm.AsciidoctorTask) {
buildReadmeCli.dependsOn(copyReadmeResources)
buildReadmeCli.mustRunAfter(buildReadmeGradlePlugin)

tasks.register('buildReadmeMavenPlugin', org.asciidoctor.gradle.jvm.AsciidoctorTask) {
group 'Verification'
description 'Convert Maven README for integration test'

sourceDir projectRoot
sources {
include 'htmlSanityCheck-maven-plugin/README.adoc'
}
baseDirFollowsSourceFile()
outputDir file("${Project.DEFAULT_BUILD_DIR_NAME}/docs")
attributes(
"imagesdir": "../images"
)
}
buildReadmeMavenPlugin.dependsOn(copyReadmeResources)
buildReadmeMavenPlugin.mustRunAfter(buildReadmeCli)

tasks.register('buildReadmeAll') {
group 'Verification'
description 'Convert all READMEs for integration test'
}
buildReadmeAll.dependsOn(buildReadmeRoot, buildReadmeGradlePlugin, buildReadmeCli)
buildReadmeAll.dependsOn(buildReadmeRoot, buildReadmeGradlePlugin, buildReadmeCli, buildReadmeMavenPlugin)
build.dependsOn(buildReadmeAll)

/*
Expand Down

0 comments on commit a2648cf

Please sign in to comment.