This is an automated email from the ASF dual-hosted git repository.
lewismc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nutch.git
The following commit(s) were added to refs/heads/master by this push:
new 21fd780b9 NUTCH-3085 Augment CI by adding code coverage and code
quality reporting (#898)
21fd780b9 is described below
commit 21fd780b96fdcf0af5e56b78c2ab90d334f3305e
Author: Lewis John McGibbney <[email protected]>
AuthorDate: Sun Feb 22 09:12:45 2026 -0800
NUTCH-3085 Augment CI by adding code coverage and code quality reporting
(#898)
---
.github/workflows/junit-report.yml | 23 ++++++++++++++++++++---
.github/workflows/sonarcloud.yml | 34 ++++++++++++++++++++++++++++++++--
build.xml | 9 ++++++---
sonar-project.properties | 2 +-
4 files changed, 59 insertions(+), 9 deletions(-)
diff --git a/.github/workflows/junit-report.yml
b/.github/workflows/junit-report.yml
index e2359737b..6665ec664 100644
--- a/.github/workflows/junit-report.yml
+++ b/.github/workflows/junit-report.yml
@@ -32,6 +32,23 @@ jobs:
workflow: master-build.yml
run_id: ${{ github.event.workflow_run.id }}
continue-on-error: true
+ - name: Resolve PR number
+ id: pr
+ run: |
+ PR_NUMBER="${{ github.event.workflow_run.pull_requests[0].number }}"
+ if [ -z "$PR_NUMBER" ]; then
+ PR_NUMBER=$(gh api \
+ "repos/${{ github.repository }}/commits/${{
github.event.workflow_run.head_sha }}/pulls" \
+ --jq '.[0].number // empty')
+ fi
+ echo "number=${PR_NUMBER:-}" >> "$GITHUB_OUTPUT"
+ if [ -n "$PR_NUMBER" ]; then
+ echo "has_pr=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "has_pr=false" >> "$GITHUB_OUTPUT"
+ fi
+ env:
+ GH_TOKEN: ${{ github.token }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v6
with:
@@ -56,10 +73,10 @@ jobs:
skip_success_summary: true
include_time_in_summary: true
group_suite: true
- comment: true
- updateComment: true
+ comment: ${{ steps.pr.outputs.has_pr == 'true' }}
+ updateComment: ${{ steps.pr.outputs.has_pr == 'true' }}
skip_comment_without_tests: true
job_name: tests
truncate_stack_traces: false
annotations_limit: 50
- pr_id: ${{ github.event.workflow_run.pull_requests[0].number || '' }}
+ pr_id: ${{ steps.pr.outputs.number }}
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
index e591c11c5..552760b9b 100644
--- a/.github/workflows/sonarcloud.yml
+++ b/.github/workflows/sonarcloud.yml
@@ -61,7 +61,37 @@ jobs:
- name: Generate JaCoCo XML report
run: ant jacoco-report -buildfile build.xml
continue-on-error: true
- - name: SonarCloud Scan
- uses: SonarSource/sonarcloud-github-action@master
+ - name: Resolve PR number
+ id: pr
+ run: |
+ PR_NUMBER=$(gh api \
+ "repos/${{ github.repository }}/commits/${{
github.event.workflow_run.head_sha }}/pulls" \
+ --jq '.[0].number // empty')
+ echo "number=${PR_NUMBER:-}" >> "$GITHUB_OUTPUT"
+ if [ -n "$PR_NUMBER" ]; then
+ echo "is_pr=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "is_pr=false" >> "$GITHUB_OUTPUT"
+ fi
+ env:
+ GH_TOKEN: ${{ github.token }}
+ - name: SonarCloud Scan (PR)
+ if: steps.pr.outputs.is_pr == 'true'
+ uses: SonarSource/sonarqube-scan-action@v5
+ with:
+ args: >
+ -Dsonar.pullrequest.key=${{ steps.pr.outputs.number }}
+ -Dsonar.pullrequest.branch=${{
github.event.workflow_run.head_branch }}
+ -Dsonar.pullrequest.base=${{ github.event.workflow_run.event ==
'pull_request' && 'master' || 'master' }}
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: https://sonarcloud.io
+ - name: SonarCloud Scan (branch)
+ if: steps.pr.outputs.is_pr == 'false'
+ uses: SonarSource/sonarqube-scan-action@v5
+ with:
+ args: >
+ -Dsonar.branch.name=${{ github.event.workflow_run.head_branch }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: https://sonarcloud.io
diff --git a/build.xml b/build.xml
index 796f4bfc7..2dffdb769 100644
--- a/build.xml
+++ b/build.xml
@@ -1169,9 +1169,12 @@
</executiondata>
<structure name="Apache Nutch">
<classfiles>
- <fileset dir="${build.classes}"/>
- <fileset dir="${build.plugins}">
- <include name="**/*.jar"/>
+ <fileset dir="${build.classes}">
+ <include name="**/*.class"/>
+ </fileset>
+ <fileset dir="${build.dir}">
+ <include name="*/classes/**/*.class"/>
+ <exclude name="test/**"/>
</fileset>
</classfiles>
<sourcefiles encoding="${build.encoding}">
diff --git a/sonar-project.properties b/sonar-project.properties
index a128b8f24..e39a2b892 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -21,7 +21,7 @@ sonar.sources=src/java,src/plugin
sonar.tests=src/test,src/plugin
sonar.test.inclusions=**/src/test/**/*.java,**/Test*.java
sonar.source.encoding=UTF-8
-sonar.java.source=11
+sonar.java.source=17
sonar.java.binaries=build/classes,build/plugins
sonar.java.test.binaries=build/test/classes