diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30160ca..c642c62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,12 +96,25 @@ jobs: - name: Check run: ./gradlew check + # ================================ + # SEMANTIC VERSIONING + # ================================ + - name: Semantic versioning + if: ${{ matrix.jdk == 21 }} + run: | + SEMVER=`cat ./api-compatibility/build/semver.txt` + BADGE="https://dev.leakyabstractions.com/result/semver-${SEMVER}.json" + URL="https://img.shields.io/endpoint?url=$BADGE" + echo "## Compatibility Report" >> $GITHUB_STEP_SUMMARY + echo "![Semantic Versioning]($URL)" >> $GITHUB_STEP_SUMMARY + # ================================ # COMPATIBILITY REPORT # ================================ - name: Compatibility with version ${{ steps.properties.outputs.previousVersion }} if: ${{ matrix.jdk == 21 }} - run: cat ./api-compatibility/build/report.txt >> $GITHUB_STEP_SUMMARY + # $GITHUB_STEP_SUMMARY supports content up to a size of 1024k + run: head -c 1MiB ./api-compatibility/build/report.txt >> $GITHUB_STEP_SUMMARY # ================================ # CACHE SONARCLOUD PACKAGES diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index ad3609f..499ff09 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -40,5 +40,7 @@ jobs: - name: Generate and submit dependency graph uses: gradle/actions/dependency-submission@v3 env: + # Exclude all dependencies that originate solely in the 'api-compatibility' project + DEPENDENCY_GRAPH_EXCLUDE_PROJECTS: ':api-compatibility' # Exclude dependencies that are only resolved in test classpaths DEPENDENCY_GRAPH_EXCLUDE_CONFIGURATIONS: '.*[Tt]est(Compile|Runtime)Classpath' diff --git a/.github/workflows/update-gradle-wrapper.yml b/.github/workflows/update-gradle-wrapper.yml index b0c28b6..dd02cde 100644 --- a/.github/workflows/update-gradle-wrapper.yml +++ b/.github/workflows/update-gradle-wrapper.yml @@ -21,6 +21,16 @@ jobs: - name: Shallow clone uses: actions/checkout@v4 + # ================================ + # SET UP JDK + # ================================ + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-package: jdk + java-version: 17 + # ================================ # UPDATE GRADLE WRAPPER # ================================ diff --git a/api-compatibility/build.gradle b/api-compatibility/build.gradle index 3c6a6d4..2153321 100644 --- a/api-compatibility/build.gradle +++ b/api-compatibility/build.gradle @@ -22,10 +22,12 @@ tasks.register("clean", Delete) { } tasks.register("check", me.champeau.gradle.japicmp.JapicmpTask) { + final semverReport= layout.buildDirectory.file('semver.txt').get().asFile final textReport = layout.buildDirectory.file('report.txt').get().asFile final htmlReport = layout.buildDirectory.file('report.html').get().asFile newClasspath.from(configurations.current) oldClasspath.from(configurations.previous) + semverOutputFile = semverReport txtOutputFile = textReport htmlOutputFile = htmlReport ignoreMissingClasses = true diff --git a/badge.json b/badge.json index 4ba456c..b75077a 100644 --- a/badge.json +++ b/badge.json @@ -5,7 +5,7 @@ "style": "flat", "labelColor": "fff", "color": "light-green", - "label": "Result", + "label": "result-micronaut-serde", "message": "{{ site.current_version }}", "logoSvg": "" } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ea36257..4063ae2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ description = Serialize and deserialize Result objects with Micronaut group = com.leakyabstractions artifactName = Micronaut Serialization for Result artifactId = result-micronaut-serde -version = 0.1.0.0 +version = 0.1.1.0-SNAPSHOT previousVersion = 0.1.0.0 homepage = https://dev.leakyabstractions.com/result-micronaut-serde/ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index af04bcb..afe463a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,13 +2,12 @@ assertj = "3.26.0" google-java-format = "1.19.2" jacoco = "0.8.10" -japicmp = "0.4.2" +japicmp = "0.4.3" junit = "5.10.2" micronaut-aot = "4.4.0" micronaut-library = "4.4.0" nexus-publish = "2.0.0" -result-assertj = "0.9.2.0" -result-core = "0.15.0.2" +result-core = "0.15.1.1" sonarqube = "5.0.0.4638" spotless = "6.25.0" @@ -16,11 +15,10 @@ spotless = "6.25.0" assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" } junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } -result-assertj = { module = "com.leakyabstractions:result-assertj", version.ref = "result-assertj" } result-core = { module = "com.leakyabstractions:result", version.ref = "result-core" } [bundles] -test-implementation = [ "assertj-core", "junit-jupiter-api", "result-assertj" ] +test-implementation = [ "assertj-core", "junit-jupiter-api" ] test-runtime = [ "junit-jupiter-engine" ] [plugins] diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 381baa9..8a1f6b9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionSha256Sum=a4b4158601f8636cdeeab09bd76afb640030bb5b144aafe261a5e8af027dc612 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/result-micronaut-serde/src/test/java/com/leakyabstractions/result/micronaut/serde/ResultArgumentTest.java b/result-micronaut-serde/src/test/java/com/leakyabstractions/result/micronaut/serde/ResultArgumentTest.java index 065383e..b5e6a1a 100644 --- a/result-micronaut-serde/src/test/java/com/leakyabstractions/result/micronaut/serde/ResultArgumentTest.java +++ b/result-micronaut-serde/src/test/java/com/leakyabstractions/result/micronaut/serde/ResultArgumentTest.java @@ -16,12 +16,12 @@ package com.leakyabstractions.result.micronaut.serde; -import static com.leakyabstractions.result.assertj.ResultAssertions.assertThat; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.FAILURE_NAME; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.SUCCESS_NAME; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.failureOf; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.resultOf; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.successOf; +import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import java.util.Map; diff --git a/result-micronaut-serde/src/test/java/com/leakyabstractions/result/micronaut/serde/ResultDeserializerTest.java b/result-micronaut-serde/src/test/java/com/leakyabstractions/result/micronaut/serde/ResultDeserializerTest.java index d8de92c..80a8cee 100644 --- a/result-micronaut-serde/src/test/java/com/leakyabstractions/result/micronaut/serde/ResultDeserializerTest.java +++ b/result-micronaut-serde/src/test/java/com/leakyabstractions/result/micronaut/serde/ResultDeserializerTest.java @@ -16,12 +16,13 @@ package com.leakyabstractions.result.micronaut.serde; -import static com.leakyabstractions.result.assertj.ResultAssertions.assertThat; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.FAILURE_NAME; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.SUCCESS_NAME; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.failureOf; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.resultOf; import static com.leakyabstractions.result.micronaut.serde.ResultArgument.successOf; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.InstanceOfAssertFactories.OPTIONAL; import java.io.IOException; import java.math.BigDecimal; @@ -62,7 +63,7 @@ void read_successful_result() throws IOException { // When final Result result = mapper.readValue(json, resultOf(String.class, Integer.class)); // Then - assertThat(result).hasSuccess("SUCCESS"); + assertThat(result).extracting("success", OPTIONAL).contains("SUCCESS"); } @Test @@ -73,7 +74,8 @@ void read_successful_map_result() throws IOException { final Result result = mapper.readValue(json, Result.class); // Then assertThat(result) - .hasSuccessSatisfying( + .extracting("success", OPTIONAL) + .hasValueSatisfying( x -> { assertThat(x).hasFieldOrPropertyWithValue("x", "SUCCESS"); assertThat(x).hasFieldOrPropertyWithValue("y", 123); @@ -87,7 +89,7 @@ void read_failed_result() throws IOException { // When final Result result = mapper.readValue(json, resultOf(String.class, Integer.class)); // Then - assertThat(result).hasFailure(404); + assertThat(result).extracting("failure", OPTIONAL).contains(404); } @Test @@ -117,7 +119,7 @@ void read_malformed_result_as_failure() throws IOException { // When final Result result = mapper.readValue(json, resultOf(String.class, Integer.class)); // Then - assertThat(result).hasFailure(321); + assertThat(result).extracting("failure", OPTIONAL).contains(321); } @Test @@ -150,7 +152,8 @@ void read_complex_successful_result() throws IOException { final Result>, ?> result = mapper.readValue(json, arg); // Then assertThat(result) - .hasSuccessSatisfying( + .extracting("success", OPTIONAL) + .hasValueSatisfying( s -> assertThat(s) .hasFieldOrPropertyWithValue("foo", List.of(1, 2, 3)) .hasFieldOrPropertyWithValue("bar", true)); @@ -166,7 +169,8 @@ void read_complex_failed_result() throws IOException { final Result> result = mapper.readValue(json, arg); // Then assertThat(result) - .hasFailureSatisfying( + .extracting("failure", OPTIONAL) + .hasValueSatisfying( f -> assertThat(f) .hasFieldOrPropertyWithValue("foo", 404L) .hasFieldOrPropertyWithValue("bar", null)); @@ -205,7 +209,7 @@ void read_malformed_complex_result_as_failure() throws IOException { // When final Result, Long> result = mapper.readValue(json, arg); // Then - assertThat(result).hasFailure(321L); + assertThat(result).extracting("failure", OPTIONAL).contains(321L); } @SuppressWarnings("unchecked") diff --git a/result-micronaut-serde/test.gradle b/result-micronaut-serde/test.gradle index 206b607..acd3be7 100644 --- a/result-micronaut-serde/test.gradle +++ b/result-micronaut-serde/test.gradle @@ -10,7 +10,6 @@ testing { //implementation libs.bundles.test.implementation implementation libs.assertj.core implementation libs.junit.jupiter.api - implementation libs.result.assertj } } }