Skip to content

Commit a24da80

Browse files
committed
tests: Build with Gradle 9/Java 21, but test against Gradle 7/8/9 and Java 17
1 parent d530f86 commit a24da80

File tree

14 files changed

+206
-156
lines changed

14 files changed

+206
-156
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
os: [ubuntu-latest, windows-latest]
16+
os: [ubuntu-latest, windows-2022]
17+
java-version: [17, 21]
1718
steps:
1819
- uses: actions/checkout@v6
20+
- uses: actions/setup-java@v5
21+
with:
22+
distribution: 'temurin'
23+
java-version: '17' # Version for tests
1924
- uses: actions/setup-java@v5
2025
with:
2126
distribution: 'temurin'
2227
java-version: '21'
28+
cache: gradle
2329
- uses: getgauge/setup-gauge@master
2430
with:
2531
gauge-plugins: java, html-report, xml-report
2632
- uses: gradle/actions/setup-gradle@v5
27-
- name: Build with Gradle on ubuntu
28-
if: matrix.os != 'windows-latest'
29-
run: |
30-
./gradlew plugin:build
31-
./gradlew gaugeValidate gaugeDevRepeat
32-
- name: Build with Gradle on windows
33-
if: matrix.os == 'windows-latest'
33+
- name: Build with Gradle
3434
run: |
3535
gauge config runner_connection_timeout 300000
36-
.\gradlew.bat plugin:build
37-
.\gradlew.bat gaugeDevRepeat
36+
./gradlew build

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
with:
1818
distribution: 'temurin'
1919
java-version: '21'
20+
cache: 'gradle'
2021
- uses: getgauge/setup-gauge@master
2122
with:
2223
gauge-plugins: java, html-report, xml-report

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If you have an existing project, and you would like to add the plugin manually y
2828

2929
```groovy
3030
plugins {
31-
id 'org.gauge' version '3.1.0'
31+
id 'org.gauge' version '3.0.0'
3232
}
3333
3434
repositories {
@@ -64,7 +64,7 @@ buildscript {
6464
}
6565
}
6666
dependencies {
67-
classpath "org.gauge.gradle:gauge-gradle-plugin:3.1.0"
67+
classpath "org.gauge.gradle:gauge-gradle-plugin:3.0.0"
6868
}
6969
}
7070

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins {
2+
id 'base'
3+
}
4+
5+
["assemble", "check", "build"].each { task ->
6+
tasks.named(task) {
7+
dependsOn(gradle.includedBuild("plugin").task(":$task"))
8+
}
9+
}

plugin/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ testing {
3939
targets {
4040
all {
4141
testTask.configure {
42+
javaLauncher = javaToolchains.launcherFor {
43+
languageVersion = JavaLanguageVersion.of(17)
44+
}
4245
shouldRunAfter(test)
4346
}
4447
}
@@ -56,9 +59,7 @@ tasks.withType(Test).configureEach {
5659
}
5760
}
5861

59-
tasks.named('check') {
60-
dependsOn(testing.suites.named("integrationTest"))
61-
}
62+
tasks.check.dependsOn(tasks.named("integrationTest"))
6263

6364
gradlePlugin {
6465
testSourceSets(sourceSets.integrationTest)

plugin/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=3.1.0
1+
version=3.0.0

plugin/src/integrationTest/java/org/gauge/gradle/Base.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
import java.io.IOException;
77
import java.net.URL;
88
import java.nio.file.Path;
9+
910
import org.apache.commons.io.FileUtils;
1011
import org.gradle.testkit.runner.GradleRunner;
1112
import org.junit.jupiter.api.Assertions;
1213
import org.junit.jupiter.api.BeforeEach;
1314
import org.junit.jupiter.api.io.TempDir;
1415

15-
class Base {
16+
abstract class Base {
1617

1718
@TempDir
1819
File primaryProjectDir;
@@ -50,12 +51,18 @@ protected void copyGaugeProjectToTemp(final String project, final File testProje
5051

5152
protected String getApplyPluginsBlock() {
5253
return """
53-
plugins {id 'org.gauge'}
54-
repositories {mavenLocal()
55-
mavenCentral()}
56-
dependencies {testImplementation 'com.thoughtworks.gauge:gauge-java:+'}
54+
plugins {
55+
id 'org.gauge'
56+
}
57+
repositories {
58+
mavenLocal()
59+
mavenCentral()
60+
}
61+
dependencies {
62+
testImplementation 'com.thoughtworks.gauge:gauge-java:+'
63+
}
5764
tasks.withType(AbstractTestTask).configureEach {
58-
failOnNoDiscoveredTests = false
65+
if (GradleVersion.current().version >= '9') failOnNoDiscoveredTests = false
5966
}
6067
""";
6168
}

plugin/src/integrationTest/java/org/gauge/gradle/ClasspathTest.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)