diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 06b9005..70bd4eb 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,41 +1,45 @@
-# This is a basic workflow to help you get started with Actions
+name: 🔨 CI
-name: CI
-
-# Controls when the action will run. Triggers the workflow on push or pull request
-# events but only for the master branch
on:
push:
branches: [main]
pull_request:
+ branches:
+ - '**'
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
- # This workflow contains a single job called "build"
build:
- # The type of runner that the job will run on
runs-on: ubuntu-latest
+ permissions:
+ issues: read
+ pull-requests: write
+ checks: write
- # Steps represent a sequence of tasks that will be executed as part of the job
steps:
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- - uses: actions/checkout@v6
+ - name: 📥 Checkout
+ uses: actions/checkout@v6
with:
fetch-depth: 0
-
- - name: Set up JDK
+
+ - name: ☕ Set up JDK
uses: actions/setup-java@v5
with:
distribution: temurin
- java-version: 17
+ java-version: 25
cache: maven
- - name: Build with Maven
+ - name: 🔨 Build with Maven
run: ./mvnw clean install --file pom.xml -Ddiff.source="refs/remotes/origin/$GITHUB_BASE_REF" -e
- - name: Expose Integration tests build logs
+ - name: 📈 Publish Delta Coverage Report
+ if: ${{ github.event_name == 'pull_request' }}
+ uses: gw-kit/delta-coverage-action@v1
+ with:
+ summary-report-base-path: target/site/
+
+ - name: 📦 Expose Integration Tests Build Logs
+ if: ${{ always() }}
uses: actions/upload-artifact@master
- if: always()
with:
name: int-tests-artifacts
path: |
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ab9535a..ac492be 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,36 +1,77 @@
-# This is a basic workflow to help you get started with Actions
+name: 🚀 Release
+run-name: 🚀 Release from ${{ github.ref_name }}
-name: Release
on:
- release:
- types: [prereleased, released]
+ workflow_dispatch:
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
- # This workflow contains a single job called "build"
release:
- # The type of runner that the job will run on
+ if: startsWith(github.ref_name, 'release/')
runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ environment:
+ name: maven-central
+ url: ${{ steps.gh-release.outputs.url }}
- # Steps represent a sequence of tasks that will be executed as part of the job
steps:
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- - uses: actions/checkout@v6
+ - name: 📥 Checkout
+ uses: actions/checkout@v6
with:
fetch-depth: 0
- - name: Set up JDK
+ - name: ☕ Set up JDK
uses: actions/setup-java@v5
with:
- distribution: 'adopt'
- java-version: '11'
- cache: 'maven'
-
- - name: Build with Maven
- run: mvn install --file pom.xml -e
-
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v5
+ distribution: temurin
+ java-version: 25
+ cache: maven
+ server-id: central
+ server-username: CENTRAL_USERNAME
+ server-password: CENTRAL_PASSWORD
+ gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
+ gpg-passphrase: MAVEN_GPG_PASSPHRASE
+
+ - name: 🏷️ Extract Version
+ id: version
+ run: |
+ VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+
+ - name: 📦 Publish to Maven Central
+ env:
+ CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
+ CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
+ MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+ run: ./mvnw clean deploy -Prelease -e
+
+ - name: 🏷️ Create GitHub Release
+ id: gh-release
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const version = 'v${{ steps.version.outputs.version }}';
+ const { data: release } = await github.rest.repos.createRelease({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ tag_name: version,
+ name: version,
+ generate_release_notes: true,
+ target_commitish: context.sha,
+ });
+ core.setOutput('url', release.html_url);
+ core.note(`Created release ${release.html_url}`);
+
+ - name: 🔀 Merge to master
+ uses: actions/github-script@v7
with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: target/site/jacoco-fullCoverage/jacoco.xml
+ script: |
+ const branch = context.ref.replace('refs/heads/', '');
+ const { data: commit } = await github.rest.repos.merge({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ base: 'master',
+ head: branch,
+ commit_message: `Merge ${branch}`,
+ });
+ core.info(`Merged ${branch} to master: ${commit.sha}`);
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9ab6401..71b8be3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Diff-Coverage Maven plugin
+## 1.1.0
+
+- Added Java 25 class files support
+
+### Dependencies updates
+- JaCoCo 0.8.14
+- delta-coverage-core 3.6.0
+
## 1.0.0
- Changed group id from `com.github.surpsg` to `io.github.surpsg`
diff --git a/pom.xml b/pom.xml
index 2940821..a0790b4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
diff-coverage-maven-plugin
${project.groupId}:${project.artifactId}
maven-plugin
- 1.0.0
+ 1.1.0
Diff coverage maven plugin builds code coverage report of new and modified code based on a provided diff
diff --git a/src/it/latest-java-class-support/diffFile.patch b/src/it/latest-java-class-support/diffFile.patch
new file mode 100644
index 0000000..1119d91
--- /dev/null
+++ b/src/it/latest-java-class-support/diffFile.patch
@@ -0,0 +1,14 @@
+===================================================================
+--- a/src/main/java/com/test/Example.java (revision 9e78667391946d3461759f5589b67d3a676d8ce7)
++++ b/src/main/java/com/test/Example.java (date 1593433398791)
+@@ -5,7 +5,10 @@
+ public void sayHello(boolean a) {
+ if (a) {
+ System.out.println("if");
++ } else {
++ System.out.println("else");
+ }
++ System.out.println("return");
+ }
+
+ }
diff --git a/src/it/latest-java-class-support/pom.xml b/src/it/latest-java-class-support/pom.xml
new file mode 100644
index 0000000..90581a6
--- /dev/null
+++ b/src/it/latest-java-class-support/pom.xml
@@ -0,0 +1,55 @@
+
+
+ 4.0.0
+
+ jacoco
+ latest-java-class-support
+ 1.0-SNAPSHOT
+
+
+ 25
+
+
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.14
+
+
+
+ prepare-agent
+
+
+
+
+
+ io.github.surpsg
+ diff-coverage-maven-plugin
+
+
+ diffFile.patch
+
+
+
+
+
+ diffCoverage
+
+
+
+
+
+
+
diff --git a/src/it/latest-java-class-support/src/main/java/com/test/Example.java b/src/it/latest-java-class-support/src/main/java/com/test/Example.java
new file mode 100644
index 0000000..439c90a
--- /dev/null
+++ b/src/it/latest-java-class-support/src/main/java/com/test/Example.java
@@ -0,0 +1,14 @@
+package com.test;
+
+public class Example {
+
+ public void sayHello(boolean a) {
+ if (a) {
+ System.out.println("if");
+ } else {
+ System.out.println("else");
+ }
+ System.out.println("return");
+ }
+
+}
diff --git a/src/it/latest-java-class-support/src/test/java/com/test/ExampleTest.java b/src/it/latest-java-class-support/src/test/java/com/test/ExampleTest.java
new file mode 100644
index 0000000..d64cc3c
--- /dev/null
+++ b/src/it/latest-java-class-support/src/test/java/com/test/ExampleTest.java
@@ -0,0 +1,11 @@
+package com.test;
+import org.junit.Test;
+
+public class ExampleTest {
+
+ @Test
+ public void test() {
+ new Example().sayHello(true);
+ }
+
+}
diff --git a/src/it/latest-java-class-support/verify.bsh b/src/it/latest-java-class-support/verify.bsh
new file mode 100644
index 0000000..459a77e
--- /dev/null
+++ b/src/it/latest-java-class-support/verify.bsh
@@ -0,0 +1,13 @@
+import java.io.*;
+import org.codehaus.plexus.util.*;
+
+File reportsDir = new File(basedir, "target/site/delta-coverage/aggregated");
+File htmlReportDir = new File( reportsDir, "/html" );
+if ( !htmlReportDir.exists() || !htmlReportDir.isDirectory() ) {
+ throw new RuntimeException( "Html report dir wasn't found: " + htmlReportDir.getAbsolutePath() );
+}
+
+File xmlReportFile = new File( reportsDir, "report.xml" );
+if ( !xmlReportFile.exists() || !xmlReportFile.isFile() ) {
+ throw new RuntimeException( "Xml report file wasn't found: " + xmlReportFile.getAbsolutePath() );
+}