Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed Jun 14, 2024
2 parents dfd0a0c + 4777d8d commit fd88e62
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 21 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
10 changes: 10 additions & 0 deletions .github/workflows/update-gradle-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ================================
Expand Down
2 changes: 2 additions & 0 deletions api-compatibility/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion badge.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"style": "flat",
"labelColor": "fff",
"color": "light-green",
"label": "Result",
"label": "result-micronaut-serde",
"message": "{{ site.current_version }}",
"logoSvg": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' role='img'><path fill='#000' d='m128 0c-70.692496 0-128 57.307556-128 128 0 70.69245 57.307504 128 128 128 70.6925 0 128-57.30755 128-128 0-70.692444-57.3075-128-128-128z'/><path fill='#fff' d='m136.35564 57.292727-40.67397-13.292725-23.68167 75.404758 10.5988 3.14252 10.03853-31.546757 25.76122 7.912145 3.29783 7.051312-8.19024 24.69695 10.51558 3.34618 9.44724-28.93646-3.77957-8.198802 7.87469-4.149675 6.69237-21.031168zm-7.41926 8.851265 3.54748 6.440357-3.80826 12.228035-6.84766 3.38107-26.04807-7.791706 7.15442-22.743615zm-17.85826-43.378365c38.23512 0 69.22657 30.999275 69.22657 69.234375 0 38.235098-30.99145 69.234378-69.22657 69.234378-38.23513 0-69.23437-30.99928-69.23437-69.234378 0-38.2351 30.99924-69.234375 69.23437-69.234375z'/></svg>"
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
8 changes: 3 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@
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"

[libraries]
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]
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -62,7 +63,7 @@ void read_successful_result() throws IOException {
// When
final Result<String, Integer> result = mapper.readValue(json, resultOf(String.class, Integer.class));
// Then
assertThat(result).hasSuccess("SUCCESS");
assertThat(result).extracting("success", OPTIONAL).contains("SUCCESS");
}

@Test
Expand All @@ -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);
Expand All @@ -87,7 +89,7 @@ void read_failed_result() throws IOException {
// When
final Result<String, Integer> result = mapper.readValue(json, resultOf(String.class, Integer.class));
// Then
assertThat(result).hasFailure(404);
assertThat(result).extracting("failure", OPTIONAL).contains(404);
}

@Test
Expand Down Expand Up @@ -117,7 +119,7 @@ void read_malformed_result_as_failure() throws IOException {
// When
final Result<String, Integer> result = mapper.readValue(json, resultOf(String.class, Integer.class));
// Then
assertThat(result).hasFailure(321);
assertThat(result).extracting("failure", OPTIONAL).contains(321);
}

@Test
Expand Down Expand Up @@ -150,7 +152,8 @@ void read_complex_successful_result() throws IOException {
final Result<Foobar<List<Integer>>, ?> 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));
Expand All @@ -166,7 +169,8 @@ void read_complex_failed_result() throws IOException {
final Result<Integer, Foobar<Long>> result = mapper.readValue(json, arg);
// Then
assertThat(result)
.hasFailureSatisfying(
.extracting("failure", OPTIONAL)
.hasValueSatisfying(
f -> assertThat(f)
.hasFieldOrPropertyWithValue("foo", 404L)
.hasFieldOrPropertyWithValue("bar", null));
Expand Down Expand Up @@ -205,7 +209,7 @@ void read_malformed_complex_result_as_failure() throws IOException {
// When
final Result<Foobar<BigDecimal>, Long> result = mapper.readValue(json, arg);
// Then
assertThat(result).hasFailure(321L);
assertThat(result).extracting("failure", OPTIONAL).contains(321L);
}

@SuppressWarnings("unchecked")
Expand Down
1 change: 0 additions & 1 deletion result-micronaut-serde/test.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ testing {
//implementation libs.bundles.test.implementation
implementation libs.assertj.core
implementation libs.junit.jupiter.api
implementation libs.result.assertj
}
}
}
Expand Down

0 comments on commit fd88e62

Please sign in to comment.