@@ -128,53 +128,18 @@ jobs:
128
128
129
129
sonarCloud :
130
130
name : Run SonarCloud analysis
131
- runs-on : windows-latest
131
+ runs-on : ubuntu-latest
132
+ if : github.ref == 'refs/heads/main'
132
133
steps :
133
- - name : Set up JDK 11
134
- uses : actions/setup-java@v1
135
- with :
136
- java-version : 1.11
137
- - uses : actions/checkout@v3
138
- with :
139
- fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
140
- - name : Install .NET 7 SDK
141
-
134
+ - name : Run Sonarcloud test
135
+ uses :
samsmithnz/[email protected]
142
136
with :
143
- dotnet-version : 7.0.x
144
- - name : Cache SonarCloud packages
145
- uses : actions/cache@v3
146
- with :
147
- path : ~\sonar\cache
148
- key : ${{ runner.os }}-sonar
149
- restore-keys : ${{ runner.os }}-sonar
150
- - name : Cache SonarCloud scanner
151
- id : cache-sonar-scanner
152
- uses : actions/cache@v3
153
- with :
154
- path : .\.sonar\scanner
155
- key : ${{ runner.os }}-sonar-scanner
156
- restore-keys : ${{ runner.os }}-sonar-scanner
157
- - name : Install SonarCloud scanner
158
- if : steps.cache-sonar-scanner.outputs.cache-hit != 'true'
159
- shell : powershell
160
- run : |
161
- New-Item -Path .\.sonar\scanner -ItemType Directory
162
- dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
163
- - name : Build and analyze
164
- env :
165
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
137
+ projects : ' src/DevOpsMetrics.Core/DevOpsMetrics.Core.csproj,src/DevOpsMetrics.Function/DevOpsMetrics.Function.csproj,src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj,src/DevOpsMetrics.Service/DevOpsMetrics.Service.csproj,src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj,src/DevOpsMetrics.Web/DevOpsMetrics.Web.csproj'
138
+ dotnet-version : ' 7.0.x'
139
+ sonarcloud-organization : samsmithnz-github
140
+ sonarcloud-project : samsmithnz_DevOpsMetrics
166
141
SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
167
- shell : powershell
168
- run : |
169
- .\.sonar\scanner\dotnet-sonarscanner begin /k:"samsmithnz_DevOpsMetrics" /o:"samsmithnz-github" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
170
- dotnet build src/DevOpsMetrics.Core/DevOpsMetrics.Core.csproj
171
- dotnet build src/DevOpsMetrics.Function/DevOpsMetrics.Function.csproj
172
- dotnet build src/DevOpsMetrics.FunctionalTests/DevOpsMetrics.FunctionalTests.csproj
173
- dotnet build src/DevOpsMetrics.Service/DevOpsMetrics.Service.csproj
174
- dotnet build src/DevOpsMetrics.Tests/DevOpsMetrics.Tests.csproj
175
- dotnet build src/DevOpsMetrics.Web/DevOpsMetrics.Web.csproj
176
- .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
177
-
142
+
178
143
179
144
# Disabling PROBOT for 2021 reboot to focus on website
180
145
# Deploy the probot artifacts to Azure
0 commit comments