Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed May 8, 2024
2 parents 7d4b3ec + 85a390a commit ec79f79
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 41 deletions.
File renamed without changes.
28 changes: 13 additions & 15 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,46 +59,47 @@ jobs:
# SHALLOW CLONE
# ================================
- name: Shallow clone
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
java-version: 21

# ================================
# SETUP GRADLE
# SET UP GRADLE
# ================================
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"
cache-read-only: ${{ github.ref_name != github.event.repository.default_branch && github.ref_name != 'develop' }}

# ================================
# BENCHMARK
# ================================
- name: Benchmark
uses: gradle/gradle-build-action@v2
env:
JMH_VERSION: ${{ inputs.jmhVersion }}
JMH_BENCHMARK_MODE: ${{ inputs.benchmarkMode }}
JMH_WARMUP_ITERATIONS: ${{ inputs.warmupIterations }}
JMH_ITERATIONS: ${{ inputs.iterations }}
JMH_FORK: ${{ inputs.fork }}
JMH_THREADS: ${{ inputs.threads }}
with:
arguments: jmh -x jmhReport --info --scan
run: ./gradlew jmh -x jmhReport

# ================================
# UPLOAD RESULTS
# ================================
- name: Upload Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: results.json
path: ./benchmark/build/reports/jmh/results.json
Expand All @@ -108,23 +109,20 @@ jobs:
# ================================
- name: Generate Report
if: ${{ inputs.publish }}
uses: gradle/gradle-build-action@v2
with:
arguments: jmhReport --info --scan
run: ./gradlew jmhReport

# ================================
# MAKE BADGE
# ================================
- name: Make Badge
if: ${{ inputs.publish }}
shell: bash
run: |
SCENARIO="com.leakyabstractions.result.benchmark.SimpleFailureScenario"
SCORE_RESULTS=`jq ".[] | select(.benchmark == \"$SCENARIO.results\").primaryMetric.score" ./benchmark/build/reports/jmh/results.json`
SCORE_EXCEPTIONS=`jq ".[] | select(.benchmark == \"$SCENARIO.exceptions\").primaryMetric.score" ./benchmark/build/reports/jmh/results.json`
TIMES_FASTER=`printf "%.0f\n" $(jq -n "$SCORE_RESULTS / $SCORE_EXCEPTIONS")`
LOGO_CONTENTS=`cat ./benchmark/build/reports/jmh/badge-logo.svg`
echo "According to the benchmark, returning a failed result is $TIMES_FASTER times faster than throwing an exception"
echo "According to the benchmark, returning a failed result is $TIMES_FASTER times faster than throwing an exception" >> $GITHUB_STEP_SUMMARY
jq -n ".schemaVersion |= 1 |
.style |= \"for-the-badge\" |
.labelColor |= \"eee\" |
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ jobs:
# SHALLOW CLONE
# ================================
- name: Shallow clone
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 @@ -39,20 +39,21 @@ jobs:
# VALIDATE GRADLE WRAPPER
# ================================
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v3

# ================================
# SETUP GRADLE
# SET UP GRADLE
# ================================
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"
cache-read-only: ${{ github.ref_name != github.event.repository.default_branch && github.ref_name != 'develop' }}

# ================================
# CHECK
# ================================
- name: Check
uses: gradle/gradle-build-action@v2
with:
arguments: check --info --scan
run: ./gradlew check
41 changes: 41 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

# Submit dependencies
name: Dependencies

on:
push:
branches:
- main

permissions:
contents: write

jobs:
dependencies:

name: Submit dependencies
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

# ================================
# SUBMIT DEPENDENCIES
# ================================
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3
4 changes: 2 additions & 2 deletions .github/workflows/update-gradle-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# SHALLOW CLONE
# ================================
- name: Shallow clone
uses: actions/checkout@v3
uses: actions/checkout@v4

# ================================
# UPDATE GRADLE WRAPPER
Expand All @@ -27,5 +27,5 @@ jobs:
uses: gradle-update/update-gradle-wrapper-action@v1
with:
release-channel: stable
base-branch: main
base-branch: develop
target-branch: develop
4 changes: 2 additions & 2 deletions benchmark/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
id 'java-library'
id "me.champeau.jmh" version "0.7.2"
id "io.morethan.jmhreport" version "0.9.0"
id "io.morethan.jmhreport" version "0.9.6"
}

repositories {
mavenCentral()
}

dependencies {
implementation platform("com.leakyabstractions:result-bom:0.2.0.1")
implementation platform("com.leakyabstractions:result-bom:0.3.2.0")
implementation "com.leakyabstractions:result"
}

Expand Down
Binary file modified buildSrc/src/main/resources/jmh-visualizer.zip
Binary file not shown.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down

0 comments on commit ec79f79

Please sign in to comment.