From 7d9061d8730267ef934272d1ecead4b8fc11f6e0 Mon Sep 17 00:00:00 2001 From: Eric Rizzo Date: Tue, 2 Jun 2026 13:08:57 -0400 Subject: [PATCH 1/5] Added build and coverage badges to README --- .github/workflows/build-and-test.yml | 36 ++++++++++++++++++++++++++++ README.md | 3 +++ pom.xml | 20 ++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index cabadde..ce6ca28 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -90,3 +90,39 @@ jobs: - name: Run Oracle tests run: ./mvnw -B --no-transfer-progress clean test -Psb4,tc,oracle -Dtest=OracleSpecificationTests + + # Generates a JaCoCo coverage badge and publishes it to GitHub Pages. + # Only runs on pushes to main so PRs don't overwrite the badge. + coverage: + name: Coverage badge + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: temurin + cache: maven + + - name: Generate coverage report + run: ./mvnw -B --no-transfer-progress verify -Psb4 + + - name: Generate coverage badge + uses: cicirello/jacoco-badge-generator@v2 + with: + jacoco-csv-file: target/site/jacoco/jacoco.csv + badges-directory: badges + generate-coverage-badge: true + + - name: Publish to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: . + include_only: badges/jacoco.svg,target/site/jacoco + destination_dir: . diff --git a/README.md b/README.md index fecc245..124b986 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Spring Data ExpresSpecs +[![Build](https://github.com/erizzo/spring-data-expresspecs/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/erizzo/spring-data-expresspecs/actions/workflows/build-and-test.yml) +[![Coverage](https://erizzo.github.io/spring-data-expresspecs/badges/jacoco.svg)](https://erizzo.github.io/spring-data-expresspecs/target/site/jacoco/) + > The name is a mashup of *express* and *specs*, capturing two ideas at once: the specs are > *expressive* (readable, intent-revealing factory methods instead of raw `CriteriaBuilder` noise), > and they're like an *express* train (fast, direct) to Specification/Criteria queries without boilerplate. diff --git a/pom.xml b/pom.xml index 342c792..6d9871e 100755 --- a/pom.xml +++ b/pom.xml @@ -159,6 +159,26 @@ + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + prepare-agent + + prepare-agent + + + + report + verify + + report + + + + From 15d51f71ec6b9428270e1bfb2aac3383ce9b84b1 Mon Sep 17 00:00:00 2001 From: Eric Rizzo Date: Tue, 2 Jun 2026 13:14:35 -0400 Subject: [PATCH 2/5] Repositioned badges --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 124b986..016fcee 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # Spring Data ExpresSpecs -[![Build](https://github.com/erizzo/spring-data-expresspecs/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/erizzo/spring-data-expresspecs/actions/workflows/build-and-test.yml) -[![Coverage](https://erizzo.github.io/spring-data-expresspecs/badges/jacoco.svg)](https://erizzo.github.io/spring-data-expresspecs/target/site/jacoco/) - > The name is a mashup of *express* and *specs*, capturing two ideas at once: the specs are > *expressive* (readable, intent-revealing factory methods instead of raw `CriteriaBuilder` noise), > and they're like an *express* train (fast, direct) to Specification/Criteria queries without boilerplate. @@ -11,6 +8,9 @@ This library provides a set of highly expressive, composable factory methods tha To be clear: this is a convenience library, not a framework. The patterns it encodes are not new or revolutionary, but having them pre-built, tested, and composable keeps application code focused on business logic rather than Criteria API mechanics. The resulting code reads like *intent* rather than plumbing. +[![Build](https://github.com/erizzo/spring-data-expresspecs/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/erizzo/spring-data-expresspecs/actions/workflows/build-and-test.yml) +[![Coverage](https://erizzo.github.io/spring-data-expresspecs/badges/jacoco.svg)](https://erizzo.github.io/spring-data-expresspecs/target/site/jacoco/) + ## The Status Quo The typical way to use Spring Data JPA is to define query methods derived from the method name, or by writing custom `@Query` JPQL statements: From 34d58e890920793b3912eb20be71f47061f07cce Mon Sep 17 00:00:00 2001 From: Eric Rizzo Date: Tue, 2 Jun 2026 14:29:17 -0400 Subject: [PATCH 3/5] Adjustments to the badge publishing --- .github/workflows/build-and-test.yml | 13 +++++++++---- README.md | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ce6ca28..ed393be 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -96,7 +96,7 @@ jobs: coverage: name: Coverage badge runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + if: github.ref == 'refs/heads/main' && github.event_name == 'push' || github.event_name == 'workflow_dispatch' permissions: contents: write steps: @@ -119,10 +119,15 @@ jobs: badges-directory: badges generate-coverage-badge: true + - name: Stage files for GitHub Pages + run: | + mkdir -p gh-pages/badges + mkdir -p gh-pages/coverage + cp badges/jacoco.svg gh-pages/badges/jacoco.svg + cp -r target/site/jacoco/. gh-pages/coverage/ + - name: Publish to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: . - include_only: badges/jacoco.svg,target/site/jacoco - destination_dir: . + publish_dir: gh-pages diff --git a/README.md b/README.md index 016fcee..421b9f1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This library provides a set of highly expressive, composable factory methods tha To be clear: this is a convenience library, not a framework. The patterns it encodes are not new or revolutionary, but having them pre-built, tested, and composable keeps application code focused on business logic rather than Criteria API mechanics. The resulting code reads like *intent* rather than plumbing. [![Build](https://github.com/erizzo/spring-data-expresspecs/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/erizzo/spring-data-expresspecs/actions/workflows/build-and-test.yml) -[![Coverage](https://erizzo.github.io/spring-data-expresspecs/badges/jacoco.svg)](https://erizzo.github.io/spring-data-expresspecs/target/site/jacoco/) +[![Coverage](https://erizzo.github.io/spring-data-expresspecs/badges/jacoco.svg)](https://erizzo.github.io/spring-data-expresspecs/coverage/) ## The Status Quo From 166599304bf75a24f4a83401f154b78020b4c3fe Mon Sep 17 00:00:00 2001 From: Eric Rizzo Date: Tue, 2 Jun 2026 14:57:51 -0400 Subject: [PATCH 4/5] Include tc tests when generating coverage report. --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ed393be..4e06748 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -110,7 +110,7 @@ jobs: cache: maven - name: Generate coverage report - run: ./mvnw -B --no-transfer-progress verify -Psb4 + run: ./mvnw -B --no-transfer-progress verify -Psb4,tc - name: Generate coverage badge uses: cicirello/jacoco-badge-generator@v2 From 0e4d35bc35559f194bc30d287cabc6f0b488d5e5 Mon Sep 17 00:00:00 2001 From: Eric Rizzo Date: Tue, 2 Jun 2026 15:43:03 -0400 Subject: [PATCH 5/5] Revereted small change --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4e06748..ed393be 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -110,7 +110,7 @@ jobs: cache: maven - name: Generate coverage report - run: ./mvnw -B --no-transfer-progress verify -Psb4,tc + run: ./mvnw -B --no-transfer-progress verify -Psb4 - name: Generate coverage badge uses: cicirello/jacoco-badge-generator@v2