Skip to content

Commit 0c9b358

Browse files
authored
Enable SonarCloud (#64)
Signed-off-by: Victor Chang <[email protected]>
1 parent eef9c7e commit 0c9b358

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: © 2021-2022 MONAI Consortium
1+
# SPDX-FileCopyrightText: © 2021-2022 MONAI Consortium
22
# SPDX-License-Identifier: Apache License 2.0
33

44

@@ -138,6 +138,45 @@ jobs:
138138
fail_ci_if_error: true
139139
verbose: true
140140

141+
sonar-qube:
142+
runs-on: windows-latest
143+
steps:
144+
- name: Set up JDK 11
145+
uses: actions/setup-java@v1
146+
with:
147+
java-version: 1.11
148+
- uses: actions/checkout@v2
149+
with:
150+
fetch-depth: 0
151+
- name: Cache SonarCloud packages
152+
uses: actions/cache@v1
153+
with:
154+
path: ~\sonar\cache
155+
key: ${{ runner.os }}-sonar
156+
restore-keys: ${{ runner.os }}-sonar
157+
- name: Cache SonarCloud scanner
158+
id: cache-sonar-scanner
159+
uses: actions/cache@v1
160+
with:
161+
path: .\.sonar\scanner
162+
key: ${{ runner.os }}-sonar-scanner
163+
restore-keys: ${{ runner.os }}-sonar-scanner
164+
- name: Install SonarCloud scanner
165+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
166+
shell: powershell
167+
run: |
168+
New-Item -Path .\.sonar\scanner -ItemType Directory
169+
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
170+
- name: Build and analyze
171+
env:
172+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
174+
shell: powershell
175+
run: |
176+
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Project-MONAI_monai-deploy-informatics-gateway" /o:"project-monai" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
177+
dotnet build -c ${{ env.BUILD_CONFIG }} --nologo "src\${{ env.SOLUTION }}"
178+
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
179+
141180
build:
142181
runs-on: ${{ matrix.os }}
143182
needs: [calc-version]

0 commit comments

Comments
 (0)