Skip to content

Commit af151e6

Browse files
committed
Enable SonarCloud
Signed-off-by: Victor Chang <[email protected]>
1 parent eef9c7e commit af151e6

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 2 deletions
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

@@ -59,14 +59,42 @@ jobs:
5959
language: [ 'csharp' ]
6060

6161
steps:
62+
- name: Set up JDK 11
63+
uses: actions/setup-java@v1
64+
with:
65+
java-version: 1.11
66+
6267
- name: Checkout repository
6368
uses: actions/checkout@v2
6469
with:
6570
fetch-depth: 0
71+
6672
- uses: actions/setup-dotnet@v1
6773
with:
6874
dotnet-version: "6.0.x"
6975

76+
- name: Cache SonarCloud packages
77+
uses: actions/cache@v1
78+
with:
79+
path: ~\sonar\cache
80+
key: ${{ runner.os }}-sonar
81+
restore-keys: ${{ runner.os }}-sonar
82+
83+
- name: Cache SonarCloud scanner
84+
id: cache-sonar-scanner
85+
uses: actions/cache@v1
86+
with:
87+
path: .\.sonar\scanner
88+
key: ${{ runner.os }}-sonar-scanner
89+
restore-keys: ${{ runner.os }}-sonar-scanner
90+
91+
- name: Install SonarCloud scanner
92+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
93+
shell: powershell
94+
run: |
95+
New-Item -Path .\.sonar\scanner -ItemType Directory
96+
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
97+
7098
- name: Enable NuGet cache
7199
uses: actions/[email protected]
72100
with:
@@ -85,7 +113,14 @@ jobs:
85113
working-directory: ./src
86114

87115
- name: Build Solution
88-
run: dotnet build -c ${{ env.BUILD_CONFIG }} --nologo ${{ env.SOLUTION }}
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
119+
shell: powershell
120+
run: |
121+
.\.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"
122+
dotnet build -c ${{ env.BUILD_CONFIG }} --nologo ${{ env.SOLUTION }}
123+
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
89124
working-directory: ./src
90125

91126
- name: Perform CodeQL Analysis

0 commit comments

Comments
 (0)