Skip to content
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
12 changes: 9 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ jobs:
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
- name: Build with Gradle
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build
run: ./gradlew build
- name: Upload build reports
if: always()
uses: actions/upload-artifact@v3
with:
arguments: build
name: build-reports
path: build/reports/
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,29 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.io.TempDir
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.MethodSource
import org.junit.jupiter.params.provider.ValueSource
import java.io.File
import java.util.stream.Stream

class SemanticVersionPluginTest {

companion object {
@JvmStatic
private fun gradleVersions(): Stream<Arguments> = Stream.of(
Arguments.of("7.4.2")
)
}

@TempDir
lateinit var testProjectDir: File
@TempDir
lateinit var mavenRepo: File

@Test
fun `project version set correctly`() {
@ParameterizedTest(name = "{index} gradle version {0}")
@MethodSource("gradleVersions")
fun `project version set correctly`(gradleVersion: String) {
val build = """
plugins {
java
Expand Down Expand Up @@ -56,6 +67,7 @@ class SemanticVersionPluginTest {
GradleRunner.create()
.withPluginClasspath()
.withProjectDir(testProjectDir)
.withGradleVersion(gradleVersion)
.withArguments("publish")
// .withDebug(true)
.build()
Expand All @@ -72,6 +84,7 @@ class SemanticVersionPluginTest {
GradleRunner.create()
.withPluginClasspath()
.withProjectDir(testProjectDir)
.withGradleVersion(gradleVersion)
.withArguments("publish")
// .withDebug(true)
.build()
Expand All @@ -85,8 +98,9 @@ class SemanticVersionPluginTest {
assertEquals("0.1.1", pom.version)
}

@Test
fun `modules version is set correctly`() {
@ParameterizedTest(name = "{index} gradle version {0}")
@MethodSource("gradleVersions")
fun `modules version is set correctly`(gradleVersion: String) {
val build = """
plugins {
java
Expand Down Expand Up @@ -150,6 +164,7 @@ class SemanticVersionPluginTest {
GradleRunner.create()
.withPluginClasspath()
.withProjectDir(testProjectDir)
.withGradleVersion(gradleVersion)
.withArguments("publish")
// .withDebug(true)
.build()
Expand All @@ -162,7 +177,7 @@ class SemanticVersionPluginTest {
"${mavenRepo.absolutePath}/dev/poolside/test/my-library/0.1.0/my-library-0.1.0.jar",
"${mavenRepo.absolutePath}/dev/poolside/test/my-sublibrary/0.1.0/my-sublibrary-0.1.0.jar"
)
mavenRepo.walk().filter { it.name.endsWith(".jar") }.forEach {jarFile ->
mavenRepo.walk().filter { it.name.endsWith(".jar") }.forEach { jarFile ->
if (valid.contains(jarFile.absolutePath)) {
valid.remove(jarFile.absolutePath)
} else {
Expand All @@ -172,8 +187,9 @@ class SemanticVersionPluginTest {
assertTrue(valid.isEmpty())
}

@Test
fun `bom version set correct`() {
@ParameterizedTest(name = "{index} gradle version {0}")
@MethodSource("gradleVersions")
fun `bom version set correct`(gradleVersion: String) {
val build = """
plugins {
`java-library`
Expand Down Expand Up @@ -268,6 +284,7 @@ class SemanticVersionPluginTest {
GradleRunner.create()
.withPluginClasspath()
.withProjectDir(testProjectDir)
.withGradleVersion(gradleVersion)
.withArguments("publish")
// .withDebug(true)
.build()
Expand All @@ -280,7 +297,7 @@ class SemanticVersionPluginTest {
"${mavenRepo.absolutePath}/dev/poolside/test/my-library/0.1.0/my-library-0.1.0.jar",
"${mavenRepo.absolutePath}/dev/poolside/test/my-sublibrary/0.1.0/my-sublibrary-0.1.0.jar"
)
mavenRepo.walk().filter { it.name.endsWith(".jar") }.forEach {jarFile ->
mavenRepo.walk().filter { it.name.endsWith(".jar") }.forEach { jarFile ->
if (valid.contains(jarFile.absolutePath)) {
valid.remove(jarFile.absolutePath)
} else {
Expand Down Expand Up @@ -346,8 +363,9 @@ class SemanticVersionPluginTest {
assertEquals("0.1.2", latestVersion.toString())
}

@Test
fun `manual versioning`() {
@ParameterizedTest(name = "{index} gradle version {0}")
@MethodSource("gradleVersions")
fun `manual versioning`(gradleVersion: String) {
val build = """
plugins {
java
Expand Down Expand Up @@ -380,6 +398,7 @@ class SemanticVersionPluginTest {
GradleRunner.create()
.withPluginClasspath()
.withProjectDir(testProjectDir)
.withGradleVersion(gradleVersion)
.withArguments("publish")
// .withDebug(true)
.build()
Expand All @@ -396,6 +415,7 @@ class SemanticVersionPluginTest {
val result = GradleRunner.create()
.withPluginClasspath()
.withProjectDir(testProjectDir)
.withGradleVersion(gradleVersion)
.withArguments("publish")
// .withDebug(true)
.build()
Expand Down