Skip to content

Commit 3cdc86b

Browse files
committed
➕ Add new reusable GA workflow about triggering SonarQube cloud service to scan and analyse entire project.
1 parent 2569db7 commit 3cdc86b

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
###################################################################################################################################
2+
#
3+
# Workflow Description:
4+
# Trigger SonarQube cloud service to scan entire project to check code quality, security, etc.
5+
#
6+
# Workflow input parameters:
7+
# * General arguments:
8+
# * download_path: The path to download testing coverage reports via 'actions/download-artifact@v3'.
9+
#
10+
# * Secret arguments:
11+
# * github_token: The token for operating something with GitHub service.
12+
# * sonar_token: The API token for triggering SonarQube cloud service.
13+
#
14+
# Workflow running output:
15+
# No and do nothing.
16+
#
17+
###################################################################################################################################
18+
19+
name: Upload test report to Codecov
20+
21+
on:
22+
workflow_call:
23+
inputs:
24+
download_path:
25+
description: "The path to download testing coverage reports via 'actions/download-artifact@v3'."
26+
type: string
27+
required: false
28+
default: ./
29+
30+
secrets:
31+
github_token:
32+
description: "The API token for uploading testing coverage report to Codecov."
33+
required: true
34+
sonar_token:
35+
description: "The API token for uploading testing coverage report to Coveralls."
36+
required: true
37+
38+
39+
jobs:
40+
upload_test_cov_report:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
with:
45+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
46+
47+
- name: Download code coverage result files which has be handled by different test type process
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: test_coverage_xml_report
51+
path: ${{ inputs.download_path }}
52+
53+
- name: SonarCloud Scan
54+
uses: SonarSource/sonarcloud-github-action@master
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
57+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)