-
Notifications
You must be signed in to change notification settings - Fork 38
39 lines (37 loc) · 1.3 KB
/
sonarcloud-scan.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
on:
workflow_call:
inputs:
project-dir:
required: true
type: string
test-report-artifact:
required: false
type: string
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Download test report
if: "${{ inputs.test-report-artifact != '' }}"
uses: actions/download-artifact@v4
with:
name: ${{ inputs.test-report-artifact }}
path: ${{ inputs.project-dir }}
- name: Fix test lcov paths
if: "${{ inputs.test-report-artifact != '' }}"
run: |
sed -i 's/SF\:services/\/SF\:\/github\/workspace\/services/g' ${{ inputs.project-dir }}/coverage/lcov.info
sed -i 's/home\/runner\/work\/mds\/mds/github\/workspace/g' ${{ inputs.project-dir }}/reports/test-reporter.xml
- name: SonarCloud Scan
uses: SonarSource/[email protected]
with:
projectBaseDir: ${{ inputs.project-dir }}
args: >
-Dsonar.verbose=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}