From 7a30d8805eac7b8e07ec82beaf3ae359fb4d39c3 Mon Sep 17 00:00:00 2001 From: Andy Coates <8012398+big-andy-coates@users.noreply.github.com> Date: Sun, 23 Jun 2024 16:25:08 +0100 Subject: [PATCH] Capture reports from build as artefacts (#563) * Capture reports from build as artefacts --- .github/workflows/build.yml | 44 ++++++++++++++++++- .../kotlin/creek-common-convention.gradle.kts | 27 +++++++++--- 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 446a1c8a..a6c1e7cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,6 +55,27 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} CREEK_KAFKA_VERSION: ${{ matrix.kafka_version }} run: ./gradlew build coveralls + - name: Upload Checkstyle reports + if: failure() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: checkstyle-reports-linux-${{ matrix.kafka_version }} + path: '**/build/reports/checkstyle/*.xml' + retention-days: 5 + - name: Upload Spotbugs reports + if: failure() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: spotbugs-reports-linux-${{ matrix.kafka_version }} + path: '**/build/reports/spotbugs/*.xml' + retention-days: 5 + - name: Upload Test Results + if: failure() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: test-results-linux-${{ matrix.kafka_version }} + path: '**/build/test-results/**/*.xml' + retention-days: 5 - name: Publish if: matrix.publish && (github.event_name == 'push' || github.event.inputs.publish_artifacts == 'true') env: @@ -105,4 +126,25 @@ jobs: - name: Create GitHut Release uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # v0.1.15 with: - generate_release_notes: true \ No newline at end of file + generate_release_notes: true + - name: Upload Checkstyle reports + if: failure() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: checkstyle-reports-win + path: '**/build/reports/checkstyle/*.xml' + retention-days: 5 + - name: Upload Spotbugs reports + if: failure() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: spotbugs-reports-win + path: '**/build/reports/spotbugs/*.xml' + retention-days: 5 + - name: Upload Test Results + if: failure() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: test-results-win + path: '**/build/test-results/**/*.xml' + retention-days: 5 diff --git a/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts b/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts index 3da813e8..c69fe510 100644 --- a/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/creek-common-convention.gradle.kts @@ -20,6 +20,7 @@ *

Apply to all java modules, usually excluding the root project in multi-module sets. * *

Versions: + * - 1.12: XML reporting for spotbugs * - 1.11: Add explicit checkstyle tool version * - 1.10: Add ability to exclude containerised tests * - 1.9: Add `allDeps` task. @@ -59,7 +60,7 @@ repositories { dependencies { spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0") - checkstyle("com.puppycrawl.tools:checkstyle:10.12.5") + checkstyle("com.puppycrawl.tools:checkstyle:10.17.0") } configurations.all { @@ -107,15 +108,27 @@ spotbugs { excludeFilter.set(rootProject.file("config/spotbugs/suppressions.xml")) tasks.spotbugsMain { - reports.create("html") { - required.set(true) - setStylesheet("fancy-hist.xsl") + reports { + create("html") { + required.set(true) + setStylesheet("fancy-hist.xsl") + } + + create("xml") { + required.set(true) + } } } tasks.spotbugsTest { - reports.create("html") { - required.set(true) - setStylesheet("fancy-hist.xsl") + reports { + create("html") { + required.set(true) + setStylesheet("fancy-hist.xsl") + } + + create("xml") { + required.set(true) + } } } }