Skip to content

Commit

Permalink
[AAE-28943] restore old action and create a specific one for sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
mavotto committed Dec 19, 2024
1 parent d99769b commit 1fef409
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 33 deletions.
49 changes: 16 additions & 33 deletions .github/actions/process-coverage-report/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: 'Process Coverage Report'
description: 'Process the generated coverage for further reporting, uses JaCoCo-report plugin'
inputs:
sonar_token:
description: 'SonarCloud token to upload the coverage report'
required: true
paths:
description: 'Comma separated paths of the generated JaCoCo xml files (supports wildcard glob pattern)'
required: true
Expand Down Expand Up @@ -57,33 +54,19 @@ outputs:
runs:
using: composite
steps:
- name: Load JaCoCo report on SonarCloud
env:
SONAR_TOKEN: ${{ inputs.sonar_token }}
shell: bash
run: |
mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=alfresco -Dsonar.projectKey=Alfresco_hxp-studio-services -Dsonar.coverage.jacoco.xmlReportPaths=${{ inputs.paths }}
# - name: SonarCloud Scan
# uses: sonarsource/[email protected]
# env:
# SONAR_TOKEN: ${{ inputs.sonar_token }}
# with:
# args: >
# -Dsonar.coverage.jacoco.xmlReportPaths=${{ inputs.paths }}
# - uses: madrapps/jacoco-report@7c362aca34caf958e7b1c03464bd8781db9f8da7 # v1.7.1
# id: jacoco-aggregate
# with:
# paths: ${{ inputs.paths }}
# token: ${{ inputs.token }}
# min-coverage-overall: ${{ inputs.min-coverage-overall }}
# min-coverage-changed-files: ${{ inputs.min-coverage-changed-files }}
# title: ${{ inputs.title }}
# update-comment: ${{ inputs.update-comment }}
# skip-if-no-changes: ${{ inputs.skip-if-no-changes }}
# pass-emoji: ${{ inputs.pass-emoji }}
# fail-emoji: ${{ inputs.fail-emoji }}
# continue-on-error: ${{ inputs.continue-on-error }}
# debug-mode: ${{ inputs.debug-mode }}
# coverage-overall: ${{ inputs.coverage-overall }}
# coverage-changed-files: ${{ inputs.coverage-changed-files }}
- uses: madrapps/jacoco-report@7c362aca34caf958e7b1c03464bd8781db9f8da7 # v1.7.1
id: jacoco-aggregate
with:
paths: ${{ inputs.paths }}
token: ${{ inputs.token }}
min-coverage-overall: ${{ inputs.min-coverage-overall }}
min-coverage-changed-files: ${{ inputs.min-coverage-changed-files }}
title: ${{ inputs.title }}
update-comment: ${{ inputs.update-comment }}
skip-if-no-changes: ${{ inputs.skip-if-no-changes }}
pass-emoji: ${{ inputs.pass-emoji }}
fail-emoji: ${{ inputs.fail-emoji }}
continue-on-error: ${{ inputs.continue-on-error }}
debug-mode: ${{ inputs.debug-mode }}
coverage-overall: ${{ inputs.coverage-overall }}
coverage-changed-files: ${{ inputs.coverage-changed-files }}
89 changes: 89 additions & 0 deletions .github/actions/sonar-scanner/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: 'Process Coverage Report'
description: 'Process the generated coverage for further reporting, uses JaCoCo-report plugin'
inputs:
sonar_token:
description: 'SonarCloud token to upload the coverage report'
required: true
paths:
description: 'Comma separated paths of the generated JaCoCo xml files (supports wildcard glob pattern)'
required: true
token:
description: 'Github personal token to add commits to Pull Request'
required: true
min-coverage-overall:
description: 'The minimum code coverage that is required to pass for overall project'
required: false
default: '80'
min-coverage-changed-files:
description: 'The minimum code coverage that is required to pass for changed files'
required: false
default: '80'
title:
description: 'Optional title for the Pull Request comment'
required: false
update-comment:
description: 'Update the coverage report comment instead of creating new ones. Requires title to works properly.'
required: false
default: 'false'
skip-if-no-changes:
description: "Comment won't be added if there is no coverage information present for the files changed"
required: false
default: 'false'
pass-emoji:
description: 'Github emoji to use for pass status shown when coverage greater than min coverage (should be a Github supported emoji)'
required: false
default: ':green_apple:'
fail-emoji:
description: 'Github emoji to use for fail status shown when coverage lesser than min coverage (should be a Github supported emoji)'
required: false
default: ':x:'
continue-on-error:
description: 'When there is an error do not fail the action, but log a warning'
required: false
default: 'true'
debug-mode:
description: 'Run the action in debug mode and get debug logs printed in console'
required: false
default: 'false'

outputs:
coverage-overall:
description: 'The overall coverage of the project'
value: ${{ steps.jacoco-aggregate.outputs.coverage-overall }}
coverage-changed-files:
description: 'The total coverage of all changed files'
value: ${{ steps.jacoco-aggregate.outputs.coverage-changed-files }}

runs:
using: composite
steps:
- name: Load JaCoCo report on SonarCloud
env:
SONAR_TOKEN: ${{ inputs.sonar_token }}
shell: bash
run: |
mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=alfresco -Dsonar.projectKey=Alfresco_hxp-studio-services -Dsonar.coverage.jacoco.xmlReportPaths=${{ inputs.paths }}
# - name: SonarCloud Scan
# uses: sonarsource/[email protected]
# env:
# SONAR_TOKEN: ${{ inputs.sonar_token }}
# with:
# args: >
# -Dsonar.coverage.jacoco.xmlReportPaths=${{ inputs.paths }}
# - uses: madrapps/jacoco-report@7c362aca34caf958e7b1c03464bd8781db9f8da7 # v1.7.1
# id: jacoco-aggregate
# with:
# paths: ${{ inputs.paths }}
# token: ${{ inputs.token }}
# min-coverage-overall: ${{ inputs.min-coverage-overall }}
# min-coverage-changed-files: ${{ inputs.min-coverage-changed-files }}
# title: ${{ inputs.title }}
# update-comment: ${{ inputs.update-comment }}
# skip-if-no-changes: ${{ inputs.skip-if-no-changes }}
# pass-emoji: ${{ inputs.pass-emoji }}
# fail-emoji: ${{ inputs.fail-emoji }}
# continue-on-error: ${{ inputs.continue-on-error }}
# debug-mode: ${{ inputs.debug-mode }}
# coverage-overall: ${{ inputs.coverage-overall }}
# coverage-changed-files: ${{ inputs.coverage-changed-files }}

0 comments on commit 1fef409

Please sign in to comment.