Skip to content

Commit

Permalink
chore: add springboot sonar support
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-capozza-zupit committed May 22, 2024
1 parent 398905a commit c2f7675
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/sonar-step-springboot-analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Sonar analyze with artifacts

on:
workflow_call:
inputs:
RUN_ON:
required: false
type: string
default: "zupit-agents"
RUNNERS_CONTAINER_GROUP:
required: false
type: string
default: "Container"
WORKING_DIRECTORY:
required: true
type: string
SONAR_IMAGE:
required: false
type: string
default: "sonarsource/sonar-scanner-cli"
CHECK_QUALITY_GATE:
required: false
type: boolean
default: false
DOWNLOAD_ARTIFACT:
required: false
type: boolean
default: true
ARTIFACT_FILENAME:
required: false
type: string
default: ""
ARTIFACT_PATH:
required: false
type: string
default: ".coverage-reports/"

env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

jobs:
sonar-analyze:
runs-on:
labels: ${{ inputs.RUN_ON }}
group: ${{ inputs.RUNNERS_CONTAINER_GROUP }}
container: ${{ inputs.SONAR_IMAGE }}
defaults:
run:
working-directory: ${{ inputs.WORKING_DIRECTORY }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download coverage artifact
if: ${{ inputs.DOWNLOAD_ARTIFACT }}
uses: actions/download-artifact@v3
with:
name: ${{inputs.ARTIFACT_FILENAME}}
path: ${{ inputs.WORKING_DIRECTORY }}/${{ inputs.ARTIFACT_PATH }}

- name: Run PRE_SCAN_COMMANDS commands
if: ${{ inputs.PRE_SCAN_COMMANDS != '' }}
run: ${{ inputs.PRE_SCAN_COMMANDS }}

- name: Run Sonar
run: sonar-scanner -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.qualitygate.wait=${{ inputs.CHECK_QUALITY_GATE }}

0 comments on commit c2f7675

Please sign in to comment.