Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support remote execution by removing jth.jenkins-war.path #233

Merged
merged 8 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,24 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "temurin"
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
cache: "gradle"
- name: Build
run: ./gradlew clean build testGradle8.4
- name: Archive Codenarc Report
uses: actions/upload-artifact@v3
if: ${{ always() }}
- name: Archive Codenarc Report on Failure
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: codenarc-results
path: build/reports/codenarc
- name: Archive Test Results
uses: actions/upload-artifact@v3
if: ${{ always() }}
- name: Archive Test Results on Failure
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: test-results
name: ${{ matrix.os }}-ci-test-results
path: build/reports/tests
19 changes: 7 additions & 12 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,18 @@ jobs:
os: [ubuntu-latest, windows-latest]
gradle_version: ["7.1.1", "8.0.2"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "temurin"
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
cache: "gradle"
- name: Test ${{ matrix.gradle_version }}
run: ./gradlew testGradle${{ matrix.gradle_version }}
- name: Archive Test Results
uses: actions/upload-artifact@v3
if: ${{ always() }}
- name: Archive Test Results on Failure
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: test-results
name: ${{ matrix.os }}-${{ matrix.gradle_version }}-test-results
path: build/reports/tests
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import okio.buffer
import okio.sink
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.nio.file.StandardOpenOption

buildscript {
Expand Down Expand Up @@ -149,9 +150,13 @@ tasks.addRule("Pattern: testGradle<ID>") {
}
}

val isCi = providers.environmentVariable("CI")
tasks.withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
if (isCi.map { it.toBoolean() }.getOrElse(false)) {
events(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED)
}
exceptionFormat = FULL
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Set<DependencyFactory> find(String configuration, String jenkinsVersion)
deps.add(testHarness);
return deps;
case "declaredJenkinsWar":
deps.add(new MavenDependency("org.jenkins-ci.main:jenkins-war:" + jenkinsVersion + "@war"));
deps.add(new MavenDependency("org.jenkins-ci.main:jenkins-war:" + jenkinsVersion));
return deps;
}
return deps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ open class JpiTestingPlugin : Plugin<Project> {
companion object {
fun Test.useJenkinsRule(dir: Provider<Directory>) {
doFirst {
val war = project.configurations.getByName("declaredJenkinsWar").resolvedConfiguration.resolvedArtifacts.single()
systemProperty("jth.jenkins-war.path", war.file.absolutePath)
systemProperty("java.awt.headless", "true")
// set build directory for Jenkins test harness, JENKINS-26331
// this is the directory the war will be exploded to
Expand All @@ -29,7 +27,7 @@ open class JpiTestingPlugin : Plugin<Project> {
}
}
override fun apply(target: Project) {
target.configurations.create("declaredJenkinsWar") {
val declaredJenkinsWar = target.configurations.create("declaredJenkinsWar") {
isVisible = false
isCanBeConsumed = false
isCanBeResolved = true
Expand Down Expand Up @@ -109,6 +107,9 @@ open class JpiTestingPlugin : Plugin<Project> {
testClassesDirs = generatedSourceSet.output.classesDirs
classpath = project.files(generatedJenkinsPluginsDir.get().asFile.parentFile) + generatedSourceSet.runtimeClasspath
}
target.configurations.getByName("generatedJenkinsTestRuntimeOnly") {
extendsFrom(declaredJenkinsWar)
}
target.tasks.named("check").configure {
dependsOn(generatedJenkinsTest)
}
Expand All @@ -128,5 +129,8 @@ open class JpiTestingPlugin : Plugin<Project> {
inputs.files(copyPluginsForTest)
classpath += project.files(testPluginsDir.get().asFile.parentFile)
}
target.configurations.getByName("testRuntimeOnly") {
extendsFrom(declaredJenkinsWar)
}
}
}
Loading
Loading