diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e60d007..2abb8768 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,6 +67,31 @@ jobs: folder: pages/coverage target-folder: coverage + publish-delta-coverage: + runs-on: ubuntu-latest + + steps: + + - name: Checkout the repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'corretto' + + - name: Run delta coverage + run: ./gradlew test deltaCoverage + + - name: Publish summary + run: cat build/reports/coverage-reports/delta-coverage/report.md >> $GITHUB_STEP_SUMMARY + + - name: Add disclaimer + run: echo "The summary table will list class files and percent changes on each row, with totals at the bottom. If you have no class file changes, your totals will show NaN%. Run ./gradlew test deltaCoverage locally to view line-by-line changes. [Plugin Documentation](https://gw-kit.github.io/delta-coverage-plugin/stable/)" >> $GITHUB_STEP_SUMMARY + update-build-badges: if: ${{ always() && github.ref == 'refs/heads/main' }} diff --git a/build.gradle b/build.gradle index fdd0c541..92c00c5f 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id "jacoco" id "com.palantir.git-version" version "3.0.0" id "com.diffplug.spotless" version "6.25.0" + id "io.github.surpsg.delta-coverage" version "2.5.0" } version = "3.3.0" @@ -67,6 +68,18 @@ jacocoTestReport { } } +deltaCoverageReport { + diffSource { + diffSource.git.diffBase.set("refs/remotes/origin/main") + } + + reports { + html.set(true) + xml.set(true) + markdown.set(true) + } +} + spotless { java { removeUnusedImports()