-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#318 Migrate integration-test to this subdirectory
- Loading branch information
Showing
6 changed files
with
211 additions
and
130 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
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,135 @@ | ||
final String BUILD_DIRECTORY = "${Project.DEFAULT_BUILD_DIR_NAME}" | ||
|
||
version = htmlSanityCheckVersion | ||
|
||
final String INTEGRATION_TEST_DIRECTORY_COMMON = "common" | ||
final String INTEGRATION_TEST_DIRECTORY_COMMON_BUILD = "common/${BUILD_DIRECTORY}" | ||
|
||
final static String gradleCall() { | ||
return System.getProperty("os.name") ==~ /Windows.*/ | ||
? "..\\..\\gradlew.bat" | ||
: "../../gradlew" | ||
} | ||
|
||
tasks.register("cleanIntegrationTestCommon", Delete) { | ||
group("Build") | ||
description("Deletes the common data for integration tests") | ||
|
||
def filesToDelete | ||
= files(INTEGRATION_TEST_DIRECTORY_COMMON_BUILD) | ||
|
||
delete(filesToDelete) | ||
|
||
outputs.upToDateWhen { | ||
!filesToDelete.files.any { it.exists() } | ||
} | ||
} | ||
tasks.register("integrationTestPrepare") { | ||
group("Verification") | ||
description("Prepare integration tests data") | ||
|
||
mustRunAfter(cleanIntegrationTestCommon) | ||
|
||
doLast { | ||
def result = exec { | ||
workingDir INTEGRATION_TEST_DIRECTORY_COMMON | ||
commandLine (gradleCall(), "clean", "buildReadmeAll") | ||
} | ||
logger.debug "Script output: $result" | ||
} | ||
} | ||
|
||
final String INTEGRATION_TEST_DIRECTORY_GRADLE_PLUGIN = "gradle-plugin" | ||
final String INTEGRATION_TEST_DIRECTORY_GRADLE_PLUGIN_BUILD = "gradle-plugin/${BUILD_DIRECTORY}" | ||
|
||
tasks.register("cleanIntegrationTestGradlePlugin", Delete) { | ||
group("Build") | ||
description("Deletes the result directory from gradle-plugin integration tests") | ||
|
||
def filesToDelete | ||
= files(INTEGRATION_TEST_DIRECTORY_GRADLE_PLUGIN_BUILD) | ||
|
||
delete(filesToDelete) | ||
|
||
outputs.upToDateWhen { | ||
!filesToDelete.files.any { it.exists() } | ||
} | ||
} | ||
tasks.register("integrationTestGradlePlugin") { | ||
group("Verification") | ||
description("Run gradle-plugin integration tests (only)") | ||
|
||
final String buildReportsDirectory = "${INTEGRATION_TEST_DIRECTORY_GRADLE_PLUGIN_BUILD}/reports" | ||
final File testIndex = new File(file(buildReportsDirectory), "index.html") | ||
outputs.file testIndex | ||
|
||
dependsOn(integrationTestPrepare) | ||
mustRunAfter(cleanIntegrationTestGradlePlugin) | ||
|
||
doLast { | ||
def result = exec { | ||
workingDir INTEGRATION_TEST_DIRECTORY_GRADLE_PLUGIN | ||
commandLine (gradleCall(), "clean", "htmlSanityCheck", "-PhtmlSanityCheckVersion=${project.version}") | ||
} | ||
logger.debug "Script output: $result" | ||
assert testIndex.exists() | ||
} | ||
} | ||
|
||
final String INTEGRATION_TEST_DIRECTORY_CLI = "cli" | ||
final String INTEGRATION_TEST_DIRECTORY_CLI_BUILD = "${INTEGRATION_TEST_DIRECTORY_CLI}/${BUILD_DIRECTORY}" | ||
|
||
tasks.register("cleanIntegrationTestCli", Delete) { | ||
group("Build") | ||
description("Deletes the result directory from CLI integration tests") | ||
|
||
def filesToDelete | ||
= files(INTEGRATION_TEST_DIRECTORY_CLI_BUILD) | ||
|
||
delete(filesToDelete) | ||
|
||
outputs.upToDateWhen { | ||
!filesToDelete.files.any { it.exists() } | ||
} | ||
} | ||
tasks.register("integrationTestCli") { | ||
group("Verification") | ||
description("Run CLI integration tests (only)") | ||
|
||
final File buildReportsDirectory = file("${INTEGRATION_TEST_DIRECTORY_CLI_BUILD}/reports") | ||
final File testIndex = new File(buildReportsDirectory, "index.html") | ||
|
||
outputs.file testIndex | ||
|
||
dependsOn(integrationTestPrepare) | ||
mustRunAfter(cleanIntegrationTestCli) | ||
|
||
doLast { | ||
def result = exec { | ||
buildReportsDirectory.mkdirs() | ||
final String hscScriptFileName = "../htmlSanityCheck-cli/${BUILD_DIRECTORY}/install/hsc/bin/hsc" | ||
String params = "-r ${buildReportsDirectory} ${INTEGRATION_TEST_DIRECTORY_COMMON_BUILD}/docs" | ||
if (System.getProperty("os.name") ==~ /Windows.*/) { | ||
commandLine 'cmd', '/c', "echo off && ${hscScriptFileName.replace('/', '\\')}.bat ${params}" | ||
} else { | ||
commandLine 'sh', '-c', "${hscScriptFileName} ${params}" | ||
} | ||
} | ||
logger.debug "Script output: ${result}" | ||
assert testIndex.exists() | ||
} | ||
} | ||
|
||
tasks.register("integrationTest") { | ||
group("Verification") | ||
description("Run all integration tests (without any installations etc.)") | ||
|
||
dependsOn(integrationTestGradlePlugin, integrationTestCli) | ||
} | ||
|
||
tasks.register("clean", Delete) { | ||
group("Build") | ||
description("Deletes all builds") | ||
|
||
dependsOn(cleanIntegrationTestCommon, cleanIntegrationTestGradlePlugin, cleanIntegrationTestCli) | ||
} |
Oops, something went wrong.