Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed Feb 11, 2024
2 parents 5569819 + 18f154d commit aa8cdff
Show file tree
Hide file tree
Showing 56 changed files with 219 additions and 90 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
# ================================
- name: Shallow clone
if: ${{ matrix.jdk != 21 }}
uses: actions/checkout@v3
uses: actions/checkout@v4

# ================================
# CHECKOUT
# ================================
- name: Checkout git branch
if: ${{ matrix.jdk == 21 }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Fetch all history for all tags and branches (recommended by SonarQube)
fetch-depth: 0
Expand All @@ -44,7 +44,7 @@ jobs:
# SET UP JDK
# ================================
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-package: jdk
Expand All @@ -54,7 +54,7 @@ jobs:
# CACHE SONARCLOUD PACKAGES
# ================================
- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: ${{ runner.os }}-sonar
path: |
Expand All @@ -66,26 +66,32 @@ jobs:
# SETUP GRADLE
# ================================
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

# ================================
# BUILD
# ================================
- name: Build
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
arguments: build -x check --info --scan

# ================================
# CHECK
# ================================
- name: Check
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
arguments: check --info --scan

# ================================
# COMPATIBILITY REPORT
# ================================
- name: Compatibility report
run: cat ./api-compatibility/build/report.txt >> $GITHUB_STEP_SUMMARY

# ================================
# ANALYZE
# ================================
Expand All @@ -95,6 +101,6 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
SONAR_ORGANIZATION: leakyabstractions
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
with:
arguments: sonarqube --info --scan
21 changes: 11 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
# CHECKOUT
# ================================
- name: Checkout git tag
uses: actions/checkout@v3
uses: actions/checkout@v4

# ================================
# SET UP JDK
# ================================
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-package: jdk
Expand All @@ -41,12 +41,13 @@ jobs:
# ================================
- name: Publish
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
GITHUB_USERNAME: ${{ secrets.PUBLISH_USERNAME }}
GITHUB_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
uses: gradle/gradle-build-action@v2
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_githubUsername: ${{ secrets.PUBLISH_USERNAME }}
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.PUBLISH_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
uses: gradle/actions/setup-gradle@v3
with:
arguments: publish --info --scan
arguments: publish -Prelease --info --scan
53 changes: 53 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

# Publish a Snapshot Release
name: Snapshot

on:
push:
branches:
- 'main'

jobs:
build:

name: Publish snapshot
runs-on: ubuntu-latest

steps:

# ================================
# SHALLOW CLONE
# ================================
- 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: 21

# ================================
# GET CURRENT VERSION
# ================================
- name: Get current version
id: properties
run: echo "version=`./gradlew -q printProperty -Pkey=version`" >> $GITHUB_OUTPUT

# ================================
# PUBLISH
# ================================
- name: Publish snapshot
if: endsWith(steps.properties.outputs.version, '-SNAPSHOT')
env:
ORG_GRADLE_PROJECT_githubUsername: ${{ secrets.PUBLISH_USERNAME }}
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.PUBLISH_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
uses: gradle/actions/setup-gradle@v3
with:
arguments: publish -Psnapshot --info --scan
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2023 Guillermo Calvo
Copyright 2024 Guillermo Calvo

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ By participating, you are expected to uphold this code.

## Author

Copyright 2023 [Guillermo Calvo][AUTHOR].
Copyright 2024 [Guillermo Calvo][AUTHOR].

[![][GUILLERMO_IMAGE]][GUILLERMO]

Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ show_downloads: true
logo: https://dev.leakyabstractions.com/result/result-banner.png
exclude:
- gradle
- lib-lazy
- result-lazy
37 changes: 37 additions & 0 deletions api-compatibility/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

plugins {
id 'me.champeau.gradle.japicmp'
}

repositories {
mavenCentral()
}

configurations {
current
previous
}

dependencies {
current project(":${artifactId}")
previous "${group}:${artifactId}:${previousVersion}"
}

tasks.register("clean", Delete) {
delete layout.buildDirectory
}

tasks.register("check", me.champeau.gradle.japicmp.JapicmpTask) {
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)
txtOutputFile = textReport
htmlOutputFile = htmlReport
onlyModified = true
failOnModification = false
failOnSourceIncompatibility = false
doLast {
logger.quiet(textReport.text)
}
}
25 changes: 20 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
plugins {
alias libs.plugins.spotless apply false
alias libs.plugins.sonarqube apply false
alias libs.plugins.japicmp apply false
alias libs.plugins.nexus.publish
}

// Configure Gradle Nexus Publish Plugin publishing repository
nexusPublishing {
repositories {
sonatype {
username = System.env.SONATYPE_USERNAME
password = System.env.SONATYPE_PASSWORD
if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) {
nexusPublishing {
useStaging = !project.version.endsWith('-SNAPSHOT') && project.hasProperty('release')
repositories {
sonatype {
username = project.sonatypeUsername
password = project.sonatypePassword
stagingProfileId = project.findProperty('sonatypeStagingProfileId')
}
}
}
}
Expand All @@ -21,3 +26,13 @@ if (hasProperty('buildScan')) {
termsOfServiceAgree = 'yes'
}
}

/**
* Print project property by key
* - Usage: `./gradlew -q printProperty -Pkey=description`
*/
task printProperty {
doLast {
printf project[project.key]
}
}
13 changes: 11 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

description = Lazy Results
description = Lazy Result Library for Java
group = com.leakyabstractions
version = 0.6.0.0
artifactName = Lazy Result Library
artifactId = result-lazy
version = 0.6.1.0-SNAPSHOT
previousVersion = 0.6.0.0

homepage = https://dev.leakyabstractions.com/result-lazy/
githubId = leakyabstractions/result-lazy
Expand All @@ -21,3 +24,9 @@ organizationUrl = https://github.com/leakyabstractions/
developerId = guillermocalvo
developerName = Guillermo Calvo
developerEmail = [email protected]

sonarProjectName= result-lazy
sonarProjectKey = LeakyAbstractions_result-lazy

# Suppress Sonar warning (this behavior will be removed in version 5.x)
systemProp.sonar.gradle.skipCompile=true
12 changes: 7 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[versions]
assertj = "3.24.2"
google-java-format = "1.18.1"
assertj = "3.25.3"
google-java-format = "1.19.2"
jacoco = "0.8.10"
junit = "5.10.1"
nexus-publish = "2.0.0-rc-1"
japicmp = "0.4.2"
junit = "5.10.2"
nexus-publish = "2.0.0-rc-2"
result-api = "0.1.0.2"
result-core = "0.15.0.0"
result-assertj = "0.9.0.0"
sonarqube = "4.4.1.3373"
spotless = "6.22.0"
spotless = "6.25.0"

[libraries]
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
Expand All @@ -24,6 +25,7 @@ test-implementation = [ "assertj-core", "junit-jupiter-api", "result-core", "res
test-runtime = [ "junit-jupiter-engine" ]

[plugins]
japicmp = { id = "me.champeau.gradle.japicmp", version.ref = "japicmp" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" }
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 13 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
Loading

0 comments on commit aa8cdff

Please sign in to comment.