Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed Dec 11, 2022
2 parents 026781d + 4c46389 commit c2081e3
Show file tree
Hide file tree
Showing 22 changed files with 154 additions and 174 deletions.
70 changes: 19 additions & 51 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
- main
- develop

env:
GRADLE_OPTS: '-Dorg.gradle.daemon=false'

jobs:
build:

Expand All @@ -22,22 +19,21 @@ jobs:

strategy:
matrix:
jdk: [ 8, 11, 17 ]
jdk: [ 8, 11, 17, 19 ]

steps:

# ================================
# CHECKOUT
# ================================
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout git branch
uses: actions/checkout@v3

# ================================
# SET UP JDK
# ================================
- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-package: jdk
Expand All @@ -47,7 +43,7 @@ jobs:
# CACHE SONARCLOUD PACKAGES
# ================================
- name: Cache SonarCloud packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
key: ${{ runner.os }}-sonar
path: |
Expand All @@ -56,58 +52,28 @@ jobs:
${{ runner.os }}-sonar
# ================================
# CACHE GRADLE PACKAGES
# SETUP GRADLE
# ================================
- name: Cache Gradle packages
uses: actions/cache@v2
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
path: |
~/.gradle/caches
~/.gradle/wrapper
restore-keys: |
${{ runner.os }}-gradle-
# ================================
# GOOGLE JAVA FORMAT WORKAROUND
# ================================
- name: Set Gradle properties on JDK16+
if: ${{ matrix.jdk >= 16 }}
shell: bash
run: cat google-java-format.properties >> gradle.properties
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

# ================================
# BUILD
# ================================
- name: Build
run: ./gradlew build --info

# ================================
# JAVADOC
# ================================
- name: Javadoc
run: ./gradlew javadoc --info

# ================================
# UPLOAD JAVADOC
# ================================
- name: Upload Javadoc files
uses: actions/upload-artifact@v2
uses: gradle/gradle-build-action@v2
with:
name: javadoc
path: lib/build/docs/javadoc/
arguments: build -x check --info --scan

# ================================
# TEST
# CHECK
# ================================
- name: Test
run: ./gradlew test --info

# ================================
# CODE COVERAGE
# ================================
- name: Code Coverage
run: ./gradlew jacocoTestReport jacocoTestCoverageVerification --info
- name: Check
uses: gradle/gradle-build-action@v2
with:
arguments: check --info --scan

# ================================
# ANALYZE
Expand All @@ -119,4 +85,6 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_RESULT }}
SONAR_HOST_URL: https://sonarcloud.io
SONAR_ORGANIZATION: leakyabstractions
run: ./gradlew :lib:sonarqube --info
uses: gradle/gradle-build-action@v2
with:
arguments: sonarqube --info --scan
57 changes: 8 additions & 49 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ name: Release

on:
push:
tags: ['[0-9]+.[0-9]+.[0-9]+*']

env:
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
tags: ['[0-9]+.[0-9]+.[0-9]+.[0-9]+*']

jobs:
build:
Expand All @@ -21,83 +18,45 @@ jobs:
# CHECKOUT
# ================================
- name: Checkout git tag
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v3

# ================================
# SET UP JDK
# ================================
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-package: jdk
java-version: 8

# ================================
# CACHE GRADLE
# ================================
- name: Cache Gradle packages
uses: actions/cache@v2
with:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
path: |
~/.gradle/caches
~/.gradle/wrapper
restore-keys: |
${{ runner.os }}-gradle-
# ================================
# GENERATE CHANGELOG
# ================================
- name: Generate changelog
id: changelog
shell: bash
run: |
CURRENT_VERSION=$(./gradlew --quiet printProperty -Pkey=version)
PREVIOUS_VERSION=$(./gradlew --quiet printProperty -Pkey=previousVersion)
echo "Generating changelog from previous version: $PREVIOUS_VERSION to current version: $CURRENT_VERSION"
CHANGELOG=$(git log --format="- %s%%0A" ${PREVIOUS_VERSION}..${CURRENT_VERSION})
echo "##[set-output name=changes;]$(echo ${CHANGELOG})"
# ================================
# CREATE RELEASE
# ================================
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
Changes in this release:
${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false

# ================================
# PUBLISH
# ================================
- name: Publish with Gradle
id: publish
- 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 }}
run: ./gradlew publish publishToSonatype closeAndReleaseSonatypeStagingRepository

# ================================
# UPLOAD JAVADOC
# ================================
- name: Upload Javadoc files
uses: actions/upload-artifact@v2
uses: gradle/gradle-build-action@v2
with:
name: javadoc
path: lib/build/docs/javadoc/
arguments: publish --info --scan

# ================================
# PUBLISH JAVADOC
Expand Down
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ nexusPublishing {
}
}

if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}

/**
* Print project property by key
* - Usage: `./gradlew -q printProperty -Pkey=description`
Expand Down
8 changes: 0 additions & 8 deletions google-java-format.properties

This file was deleted.

8 changes: 5 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[versions]
assertj = "3.23.1"
google-java-format = "1.15.0"
google-java-format-jdk8 = "1.7"
jacoco = "0.8.8"
junit = "5.9.0"
junit = "5.9.1"
nexus-publish = "1.1.0"
sonarqube = "3.4.0.2513"
spotless = "6.11.0"
sonarqube = "3.5.0.2730"
spotless = "6.12.0"

[libraries]
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
6 changes: 6 additions & 0 deletions lib/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ jacoco {
}

jacocoTestReport {
dependsOn test
reports {
csv.required = false
xml.required = true
Expand All @@ -12,6 +13,7 @@ jacocoTestReport {
}

jacocoTestCoverageVerification {
dependsOn jacocoTestReport
violationRules {
rule {
limit {
Expand All @@ -33,3 +35,7 @@ jacocoTestCoverageVerification {
}
}
}

check {
finalizedBy jacocoTestCoverageVerification
}
8 changes: 8 additions & 0 deletions lib/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,11 @@ signing {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenRelease
}

publish {
finalizedBy publishToSonatype
}

publishToSonatype {
finalizedBy ':closeAndReleaseSonatypeStagingRepository'
}
5 changes: 5 additions & 0 deletions lib/spotless.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Configure source code formatting
spotless {
java {
def googleJavaFormatVersion = libs.versions.google.java.format.asProvider().get()
if (JavaVersion.current() <= JavaVersion.VERSION_1_8) {
googleJavaFormatVersion = libs.versions.google.java.format.jdk8.get()
}
googleJavaFormat(googleJavaFormatVersion)
eclipse().configFile rootProject.file('.formatting.xml')
importOrderFile rootProject.file('.importorder')
removeUnusedImports()
Expand Down
Loading

0 comments on commit c2081e3

Please sign in to comment.