Skip to content

Commit

Permalink
WIP Full integration test for (freshly installed) Gradle Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ascheman committed Jan 26, 2024
1 parent 2d77987 commit 2f91b66
Show file tree
Hide file tree
Showing 10 changed files with 516 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

- name: Execute Gradle build
run: ./gradlew check --scan -stacktrace
run: ./gradlew clean integrationTest --scan -stacktrace

- name: 'Publish Test Results'
uses: EnricoMi/publish-unit-test-result-action/composite@v2
Expand Down
37 changes: 33 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// gradle build script for htmlSanityCheck
// =======================================

buildscript {
repositories {
mavenCentral()
Expand Down Expand Up @@ -51,7 +48,7 @@ configure(subprojects) {
implementation platform(libs.groovy.bom)
implementation 'org.codehaus.groovy:groovy'

testImplementation platform (libs.spock)
testImplementation platform(libs.spock)
testImplementation "org.spockframework:spock-core"
testImplementation "org.spockframework:spock-junit4"

Expand All @@ -64,6 +61,17 @@ configure(subprojects) {
}
}

publishing {
repositories {
maven {
name = 'myLocalRepositoryForFullIntegrationTests'
//noinspection GrDeprecatedAPIUsage
url = new File (project.parent.buildDir, "maven-repo")
}
mavenLocal()
}
}

tasks.named('test', Test) {
useJUnitPlatform()
}
Expand All @@ -73,6 +81,27 @@ configure(subprojects) {
// apply plugin: 'codenarc'
}

tasks.register("integrationTest") {
group("Verification")
description("Run overall integration tests")

final String INTEGRATION_TEST_DIRECTORY = "integration-test/gradle-plugin"

doLast {
def result = exec {
workingDir INTEGRATION_TEST_DIRECTORY
commandLine "./gradlew", "clean", "htmlSanityCheck", "-PhtmlSanityCheckVersion=${project.version}"
}
logger.debug "Script output: $result"
final File testIndex = new File(INTEGRATION_TEST_DIRECTORY, "build/reports/index.html")
assert testIndex.exists()
}
}
integrationTest.dependsOn(
':htmlSanityCheck-core:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository',
':htmlSanityCheck-gradle-plugin:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository'
)

/*
* Copyright Gernot Starke and aim42 contributors.
*
Expand Down
37 changes: 37 additions & 0 deletions integration-test/gradle-plugin/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

#
# Copyright Gerd Aschemann and aim42 contributors.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#
56 changes: 56 additions & 0 deletions integration-test/gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This is a general purpose Gradle build.
* To learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.5/samples
* This project uses @Incubating APIs which are subject to change.
*/

plugins {
id('org.aim42.htmlSanityCheck').version("${htmlSanityCheckVersion}")
// version project.properties['htmlSanityCheck.version'] ?: "UNKNOWN"
}

htmlSanityCheck {
sourceDir = new File("../../htmlSanityCheck-core/src/test/resources")

// where to put results of sanityChecks...
checkingResultsDir = new File("build/reports")

logger.quiet "docToolchain> HSC sourceDir: ${sourceDir}"
logger.quiet "docToolchain> HSC checkingResultsDir: ${checkingResultsDir}"
}

tasks.register("clean", Delete) {
//noinspection GrDeprecatedAPIUsage
delete project.buildDir
}

/*
* Copyright Gerd Aschemann and aim42 contributors.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
3 changes: 3 additions & 0 deletions integration-test/gradle-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This project is used for integration testing with the current version of htmlSanityCheck-gradle-plugin
# You need to set the desired version explicitely, e.g., by calling Gradle with '-PhtmlSanityCheckVersion=x.y.z'
htmlSanityCheckVersion = "PLEASE SPECIFY VERSION EXPICITELY"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 2f91b66

Please sign in to comment.