From 5aeb7f60d3761d7ff5ccfe5456e345762dba1679 Mon Sep 17 00:00:00 2001 From: Simon Oberzier Date: Wed, 12 Aug 2026 10:41:32 +0200 Subject: [PATCH] Added test coverage to actions pipeline --- .github/workflows/maven.yml | 34 ++++++++++++++++++++++------------ pom.xml | 22 +++++----------------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 581d45f..9f354e4 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,11 +1,3 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - name: Java CI with Maven on: @@ -14,16 +6,34 @@ on: pull_request: branches: [ "master" ] +permissions: + contents: read + pull-requests: write + jobs: test: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Set up JDK 21 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '21' distribution: 'temurin' cache: maven - - name: Test with Maven - run: mvn -B test --file pom.xml + + - name: Build and Test with Maven + run: mvn -B test + + - name: Add JaCoCo PR Comment + uses: madrapps/jacoco-report@v1.6.1 + if: github.event_name == 'pull_request' + with: + paths: ${{ github.workspace }}/target/site/jacoco/jacoco.xml + token: ${{ secrets.GITHUB_TOKEN }} + min-coverage-overall: 80 + min-coverage-changed-files: 80 + title: 'Code Coverage Report' + update-comment: true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 129aa6f..6c702be 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 @@ -40,11 +40,6 @@ 5.7.0 test - - org.jacoco - jacoco-maven-plugin - 0.8.11 - @@ -52,15 +47,9 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M9 - - - org.junit.jupiter - junit-jupiter-engine - 5.9.2 - - + 3.2.5 + org.jacoco jacoco-maven-plugin @@ -73,7 +62,7 @@ report - prepare-package + test report @@ -82,5 +71,4 @@ - \ No newline at end of file