Skip to content

Commit 62f86da

Browse files
committed
update sonar
Signed-off-by: dikshagupta1 <dikshagupta1303@gmail.com>
1 parent 08af904 commit 62f86da

1 file changed

Lines changed: 85 additions & 13 deletions

File tree

.github/workflows/sonarqube.yml

Lines changed: 85 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,74 @@ on:
99
pull_request:
1010
types: [opened, synchronize, reopened]
1111

12+
on:
13+
workflow_call:
14+
inputs:
15+
perform-build:
16+
required: false
17+
type: boolean
18+
build-profile:
19+
required: false
20+
type: string
21+
language:
22+
required: false
23+
type: string
24+
report-unit-test-coverage:
25+
required: false
26+
type: boolean
27+
report-to-atlassian-dashboard:
28+
required: false
29+
type: boolean
30+
quality-product-name:
31+
required: false
32+
type: string
33+
quality-sonar-app-name:
34+
required: false
35+
type: string
36+
quality-testing-type:
37+
required: false
38+
type: string
39+
quality-service-name:
40+
required: false
41+
type: string
42+
quality-junit-report:
43+
required: false
44+
type: string
45+
visibility:
46+
required: false
47+
type: string
48+
udf1:
49+
required: false
50+
type: string
51+
udf2:
52+
required: false
53+
type: string
54+
udf3:
55+
required: false
56+
type: string
57+
58+
1259
jobs:
60+
echo-inputs:
61+
name: 'Echo inputs'
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Echo inputs
65+
run: |
66+
echo "Sonarqube scan for PRIVATE repositories, running on ubuntu-latest-4-cores runner"
67+
echo "Perform build set to ${{ inputs.perform-build }}"
68+
echo "Build profile set to ${{ inputs.build-profile }}"
69+
echo "Language set to ${{ inputs.language }} "
70+
echo "Visibility set to ${{ inputs.visibility }} [ ${{ github.event.repository.visibility }} ]"
71+
echo "Perform unit test coverage set to ${{ inputs.report-unit-test-coverage }}"
72+
echo "Report to Atlassian dashboard set to ${{ inputs.report-to-atlassian-dashboard }}"
73+
echo "Quality product name set to ${{ inputs.quality-product-name }}"
74+
echo "Quality sonar application name set to ${{ inputs.quality-sonar-app-name }}"
75+
echo "Quality testing type set to ${{ inputs.quality-testing-type }}"
76+
echo "Quality service name set to ${{ inputs.quality-service-name }}"
77+
echo "Quality JUnit report set to ${{ inputs.quality-junit-report }}"
78+
echo "Go private modules set to ${{ inputs.go-private-modules }}"
79+
1380
SonarQube:
1481
runs-on: ubuntu-latest
1582
permissions:
@@ -39,25 +106,30 @@ jobs:
39106
echo "##[warning]Waiting for 30 seconds to allow the firewall rule to take effect"
40107
sleep 30
41108
42-
- name: Install native deps for protobuf & ZeroMQ
43-
run: |
44-
sudo apt-get update
45-
sudo apt-get install -y protobuf-compiler pkg-config libzmq3-dev
46-
47-
- name: Install cargo-tarpaulin
48-
run: cargo install cargo-tarpaulin
49-
50-
- name: Run coverage with Tarpaulin
51-
run: |
52-
# produce an lcov report under ./coverage/
53-
cargo tarpaulin --out Lcov --output-dir coverage
54-
55109
- name: SonarQube Scan
110+
if: ${{ inputs.visibility == 'public' }}
56111
uses: sonarsource/sonarqube-scan-action@v5.1.0
57112
continue-on-error: true
58113
env:
59114
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
60115
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
116+
117+
- name: Run SonarQube report generation
118+
if: ${{ inputs.report-to-atlassian-dashboard == true }}
119+
uses: Progress-I360/github-action-reporting/sonarqube@main
120+
with:
121+
PRODUCT_NAME: ${{ inputs.quality-product-name }}
122+
SONAR_APP_NAME: ${{ inputs.quality-sonar-app-name }}
123+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
124+
125+
- name: Run report generation
126+
if: ${{ inputs.report-to-atlassian-dashboard == true && inputs.report-unit-test-coverage == true }}
127+
uses: Progress-I360/github-action-reporting/automation@main
128+
with:
129+
PRODUCT_NAME: ${{ inputs.quality-product-name }}
130+
TESTING_TYPE: ${{ inputs.quality-testing-type }}
131+
SERVICE_NAME: ${{ inputs.quality-service-name }}
132+
JUNIT_REPORT: ${{ inputs.quality-junit-report }}
61133

62134
- name: Remove Storage Firewall Rule
63135
if: always()

0 commit comments

Comments
 (0)