diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 19f3a63..3b4dbf9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,28 +19,32 @@ jobs: - uses: actions/checkout@v2 # https://github.com/marketplace/actions/setup-java-jdk#publishing-using-apache-maven - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v4 with: - java-version: '8' - server-id: ossrh - server-username: OSSRH_USERNAME - server-password: OSSRH_PASSWORD + java-version: '17' + distribution: zulu + server-id: central + server-username: CENTRAL_USERNAME + server-password: CENTRAL_PASSWORD gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} gpg-passphrase: GPG_PASSPHRASE - - name: Build (and publish to Sonatype OSSRH when on master) + - name: Build (and publish to Maven Central when on master) run: | + MAVEN_TASK="verify" # only use -P release when on master branch - if [ ${GITHUB_REF#refs/heads/} == "master" ]; then MAVEN_PROFILE="deploy -P release"; fi - mvn -V -B clean install $MAVEN_PROFILE + if [ ${GITHUB_REF#refs/heads/} == "master" ]; then MAVEN_TASK="deploy -P release"; fi + mvn -V -B $MAVEN_TASK env: - OSSRH_USERNAME: qqilihq - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v5 with: file: ./target/site/jacoco/jacoco.xml fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true # TODO parse surefire reports diff --git a/.gitignore b/.gitignore index 520e0b1..8ad8df2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ target/ .settings/ .classpath .project +settings.xml diff --git a/README.md b/README.md index d6cd095..8452ffc 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ About This [Maven][3] plugin solves the following issue which I described in [this][2] Stack Overflow question: > I'm running a Maven build workflow which involves running a 3rd party tool for integration testing, which produces multiple XML files in JUnit style (however, those files are **not** created by JUnit and I have no control over the testing procedure). -> +> > Is there a Maven plugin, which allows me to parse those files? Especially, I would like the build to fail, in case those XML files list a failure. -> +> > My exact problem has been described [here][1] some years ago, and the proposed solutions were: -> +> > 1. *"Write your own plugin to call your external test and report failures, either by parsing the xml or some other approach"* -- potential solution, however I hope that some years later maybe there is something ready-to-use? > 2. *"Adjust your external test tool so it returns "false" (1) when it has a @@ -34,8 +34,8 @@ Add it to your `pom.xml` within the `` section as follows and specify the - de.philippkatz.maven.plugins - test-parser-plugin + de.philippkatz + test-parser-maven-plugin 3.1.0 ${project.build.directory}/testflow-reports @@ -70,7 +70,7 @@ opening a new [issue][2]. - - - -Copyright (c) 2017 – 2020, Philipp Katz +Copyright (c) 2017 – 2025, Philipp Katz [1]: http://maven.40175.n5.nabble.com/How-to-parse-JUnit-report-xml-that-causes-build-to-pass-fail-td5433750.html diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..a94c5df --- /dev/null +++ b/changelog.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## unreleased + +### Changed +* Change Maven group ID to `de.philippkatz` and artifact ID to `test-parser-maven-plugin`. + +### Fixed +* Update `jacoco-maven-plugin` to `0.8.12` for Java 17 compatibility. + +## 3.1.0 – 2018-08-23 diff --git a/pom.xml b/pom.xml index a047a0b..4622162 100644 --- a/pom.xml +++ b/pom.xml @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - de.philippkatz.maven.plugins - test-parser-plugin + de.philippkatz + test-parser-maven-plugin maven-plugin 3.1.1-SNAPSHOT @@ -32,18 +32,8 @@ http://github.com/qqilihq/maven-test-parser-plugin/tree/master - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - + 11 UTF-8 @@ -51,7 +41,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.4 + 3.13.1 true @@ -66,28 +56,20 @@ - maven-compiler-plugin - 3.3 - - 1.7 - 1.7 - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 + org.sonatype.central + central-publishing-maven-plugin + 0.9.0 true - ossrh - https://oss.sonatype.org/ - true + central + true + published org.jacoco jacoco-maven-plugin - 0.7.9 + 0.8.12 default-prepare-agent @@ -115,7 +97,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.3.1 attach-sources @@ -128,7 +110,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 + 3.7.0 attach-javadocs @@ -141,7 +123,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.2.4 sign-artifacts @@ -155,7 +137,9 @@ --pinentry-mode loopback - + ${gpg.keyname} + ${gpg.keyname} + diff --git a/src/main/java/de/philippkatz/maven/plugins/TestParserMojo.java b/src/main/java/de/philippkatz/maven/plugins/TestParserMojo.java index de4d0fb..325a52f 100644 --- a/src/main/java/de/philippkatz/maven/plugins/TestParserMojo.java +++ b/src/main/java/de/philippkatz/maven/plugins/TestParserMojo.java @@ -17,12 +17,12 @@ /** * Goal to parse JUnit-style XML results. - * + * * @author Philipp Katz */ @Mojo(name = "testparser", requiresProject = false) public class TestParserMojo extends AbstractMojo { - + private static final String SKIPPED = "skipped"; /** Directory which contains the reports. */ @@ -71,8 +71,8 @@ public void execute() throws MojoExecutionException { } Map summary = parser.getSummary(parsedReports); getLog().info(String.format("Tests run: %s, Failures: %s, Errors: %s, Skipped: %s", - summary.get("totalTests"), - summary.get("totalFailures"), + summary.get("totalTests"), + summary.get("totalFailures"), summary.get("totalErrors"), summary.get("totalSkipped"))); if (!errors.isEmpty() && !failures.isEmpty()) { @@ -88,10 +88,10 @@ public void execute() throws MojoExecutionException { /** * Walks over a tree of directories and recursively adds all these directories to a list of File objects. - * + * * @param rootDirectory The root directory from where to start the search for sub directories. * @return A List of the directory provided as root and all its sub directories. - * @throws MojoExecutionException + * @throws MojoExecutionException */ static List collectReportDirectoriesRecursively(final File rootDirectory) throws MojoExecutionException { if (rootDirectory == null) { @@ -103,16 +103,16 @@ static List collectReportDirectoriesRecursively(final File rootDirectory) if (!rootDirectory.isDirectory()) { throw new MojoExecutionException("Directory " + rootDirectory + " is no directory"); } - + List ret = new ArrayList<>(); ret.add(rootDirectory); - + for (File child : rootDirectory.listFiles()) { if (child.isDirectory()) { ret.addAll(collectReportDirectoriesRecursively(child)); } } - + return ret; } diff --git a/src/test/java/de/philippkatz/maven/plugins/TestParserMojoTest.java b/src/test/java/de/philippkatz/maven/plugins/TestParserMojoTest.java index d8e04f0..6a4aaf6 100644 --- a/src/test/java/de/philippkatz/maven/plugins/TestParserMojoTest.java +++ b/src/test/java/de/philippkatz/maven/plugins/TestParserMojoTest.java @@ -47,7 +47,7 @@ public void testTestParserMojoWithoutFailures() { assertEquals(2, logResult.split("\n").length); assertTrue(logResult.contains("Tests run: 9, Failures: 0, Errors: 0, Skipped: 0")); } - + @Test public void testTestParserMojoWithSkipsShouldNotBeTreatedAsFailures() { TestParserMojo mojo = new TestParserMojo(); @@ -66,7 +66,7 @@ public void testTestParserMojoWithSkipsShouldNotBeTreatedAsFailures() { /** * Tests whether recursive collection of result folders works correctly. - * + * * @throws MojoExecutionException * Fails the test if anything unexpected goes wrong. */