Apache Nutch is an extensible and scalable web crawler
NUTCH-3085 Augment CI by adding code coverage and code quality reporting (#898)
Lewis John McGibbney21fd780b96fd
diff --git a/.github/workflows/junit-report.yml b/.github/workflows/junit-report.ymlindex e2359737b..6665ec664 100644--- a/.github/workflows/junit-report.yml+++ b/.github/workflows/junit-report.yml@@ -32,6 +32,23 @@ jobs:workflow: master-build.ymlrun_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 Reportuses: mikepenz/action-junit-report@v6with:@@ -56,10 +73,10 @@ jobs:skip_success_summary: trueinclude_time_in_summary: truegroup_suite: true- comment: true- updateComment: true+ comment: ${{ steps.pr.outputs.has_pr == 'true' }}+ updateComment: ${{ steps.pr.outputs.has_pr == 'true' }}skip_comment_without_tests: truejob_name: teststruncate_stack_traces: falseannotations_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.ymlindex e591c11c5..552760b9b 100644--- a/.github/workflows/sonarcloud.yml+++ b/.github/workflows/sonarcloud.yml@@ -61,7 +61,37 @@ jobs:- name: Generate JaCoCo XML reportrun: ant jacoco-report -buildfile build.xmlcontinue-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.iodiff --git a/build.xml b/build.xmlindex 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.propertiesindex a128b8f24..e39a2b892 100644--- a/sonar-project.properties+++ b/sonar-project.properties@@ -21,7 +21,7 @@ sonar.sources=src/java,src/pluginsonar.tests=src/test,src/pluginsonar.test.inclusions=**/src/test/**/*.java,**/Test*.javasonar.source.encoding=UTF-8-sonar.java.source=11+sonar.java.source=17sonar.java.binaries=build/classes,build/pluginssonar.java.test.binaries=build/test/classes