Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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: |
Expand Down
85 changes: 63 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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}`);
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>diff-coverage-maven-plugin</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
<packaging>maven-plugin</packaging>
<version>1.0.0</version>
<version>1.1.0</version>
<description>
Diff coverage maven plugin builds code coverage report of new and modified code based on a provided diff
</description>
Expand Down
14 changes: 14 additions & 0 deletions src/it/latest-java-class-support/diffFile.patch
Original file line number Diff line number Diff line change
@@ -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");
}

}
55 changes: 55 additions & 0 deletions src/it/latest-java-class-support/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>jacoco</groupId>
<artifactId>latest-java-class-support</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.release>25</maven.compiler.release>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.14</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.surpsg</groupId>
<artifactId>diff-coverage-maven-plugin</artifactId>
<configuration>
<diffSource>
<file>diffFile.patch</file>
</diffSource>
</configuration>
<executions>
<execution>
<goals>
<goal>diffCoverage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -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");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.test;
import org.junit.Test;

public class ExampleTest {

@Test
public void test() {
new Example().sayHello(true);
}

}
13 changes: 13 additions & 0 deletions src/it/latest-java-class-support/verify.bsh
Original file line number Diff line number Diff line change
@@ -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() );
}