@@ -56,7 +56,7 @@ echo "Build entire solution"
5656exec { & dotnet build - c Release }
5757
5858echo " Tests Core version"
59- dotnet test - c Release -- test-adapter - path:. -- logger:" nunit;LogFilePath=$ ( $env: APPVEYOR_BUILD_FOLDER ) \TestResults\core-results.xml"
59+ dotnet test - c Release -- test-adapter - path:. -- logger:" nunit;LogFilePath=$ ( $env: APPVEYOR_BUILD_FOLDER ) \TestResults\core-results.xml" - s " $ ( $ env: APPVEYOR_BUILD_FOLDER ) \coverletArgs.runsettings " - r " $ ( $ env: APPVEYOR_BUILD_FOLDER ) \TestResults\ "
6060
6161$corePassed = $lastexitcode
6262
@@ -111,25 +111,6 @@ Catch
111111 else { echo " sonarscanner already installed" }
112112}
113113
114- echo " Installing reportgenerator"
115- Try
116- {
117- exec { & dotnet tool install - g dotnet- reportgenerator- globaltool }
118- }
119- Catch
120- {
121- $needInstallSonar = dotnet tool list - g | Select-String - Pattern " dotnet-reportgenerator-globaltool" | % { $_.Matches.Value -eq $NULL }
122- if ($needInstallSonar -eq $true )
123- {
124- $ErrorMessage = $_.Exception.Message
125- $FailedItem = $_.Exception.ItemName
126- echo $FailedItem
127- echo $ErrorMessage
128- return -1
129- }
130- else { echo " reportgenerator already installed" }
131- }
132-
133114echo " Starting Sonar for Library"
134115
135116if ($env: APPVEYOR_PULL_REQUEST_NUMBER -ne $null )
@@ -146,7 +127,6 @@ if ($env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null)
146127 / d:sonar.pullrequest.provider= " GitHub" `
147128 / d:sonar.pullrequest.github.repository= " $env: APPVEYOR_REPO_NAME " `
148129 }
149- # /d:sonar.coverageReportPaths="$($env:APPVEYOR_BUILD_FOLDER)\testresults\SonarQube.xml" }
150130}
151131else
152132{
@@ -158,16 +138,68 @@ else
158138 / d:sonar.host.url= " https://sonarcloud.io" `
159139 / version:" $completeVersion " `
160140 }
161- # /d:sonar.coverageReportPaths="$($env:APPVEYOR_BUILD_FOLDER)\testresults\SonarQube.xml" }
162141}
163142
164143exec { & dotnet build $libraryOnlySolutionPath - c Release }
165144
166- # dotnet test -c Release -s "$($env:APPVEYOR_BUILD_FOLDER)\coverletArgs.runsettings" -r "$($ env:APPVEYOR_BUILD_FOLDER)\TestResults\"
145+ exec { & dotnet sonarscanner end / d:sonar.login = " $ env: sonartoken " }
167146
168- # exec { & reportgenerator "-reports:$($env:APPVEYOR_BUILD_FOLDER)\TestResults\*\*.xml" "-targetdir:$($env:APPVEYOR_BUILD_FOLDER)\TestResults\" "-reporttypes:SonarQube" }
147+ echo " Code Coverage information "
169148
170- exec { & dotnet sonarscanner end / d:sonar.login= " $env: sonartoken " }
149+ $opencoverFile = Get-ChildItem - Path " $ ( $env: APPVEYOR_BUILD_FOLDER ) \TestResults" - Filter coverage.opencover.xml - Recurse - ErrorAction SilentlyContinue - Force
150+
151+ Copy-Item $opencoverFile.FullName - Destination " $ ( $env: APPVEYOR_BUILD_FOLDER ) \TestResults"
152+
153+ echo " Installing coverralls"
154+ Try
155+ {
156+ exec { & dotnet tool install - g coveralls.net }
157+ }
158+ Catch
159+ {
160+ $needInstallSonar = dotnet tool list - g | Select-String - Pattern " coveralls.net" | % { $_.Matches.Value -eq $NULL }
161+ if ($needInstallSonar -eq $true )
162+ {
163+ $ErrorMessage = $_.Exception.Message
164+ $FailedItem = $_.Exception.ItemName
165+ echo $FailedItem
166+ echo $ErrorMessage
167+ return -1
168+ }
169+ else { echo " coveralls already installed" }
170+ }
171+ if ($env: APPVEYOR_PULL_REQUEST_NUMBER -ne $null )
172+ {
173+ exec { & csmacnz.Coveralls `
174+ -- opencover `
175+ - i " $ ( $env: APPVEYOR_BUILD_FOLDER ) \TestResults\coverage.opencover.xml" `
176+ -- repoToken $env: coverallstoken `
177+ -- useRelativePaths `
178+ -- commitId $env: APPVEYOR_REPO_COMMIT `
179+ -- commitBranch $env: APPVEYOR_REPO_BRANCH `
180+ -- commitAuthor $env: APPVEYOR_REPO_COMMIT_AUTHOR `
181+ -- commitEmail $env: APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL `
182+ -- commitMessage $env: APPVEYOR_REPO_COMMIT_MESSAGE `
183+ -- jobId $env: APPVEYOR_BUILD_NUMBER `
184+ -- serviceName appveyor `
185+ -- pullRequest $env: APPVEYOR_PULL_REQUEST_NUMBER
186+ }
187+ }
188+ else {
189+ exec { & csmacnz.Coveralls `
190+ -- opencover `
191+ - i " $ ( $env: APPVEYOR_BUILD_FOLDER ) \TestResults\coverage.opencover.xml" `
192+ -- repoToken $env: coverallstoken `
193+ -- useRelativePaths `
194+ -- commitId $env: APPVEYOR_REPO_COMMIT `
195+ -- commitBranch $env: APPVEYOR_REPO_BRANCH `
196+ -- commitAuthor $env: APPVEYOR_REPO_COMMIT_AUTHOR `
197+ -- commitEmail $env: APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL `
198+ -- commitMessage $env: APPVEYOR_REPO_COMMIT_MESSAGE `
199+ -- jobId $env: APPVEYOR_BUILD_NUMBER `
200+ -- serviceName appveyor
201+ }
202+ }
171203
172204echo " Packing the library"
173205exec { & dotnet pack $projectPath - c Release - o " $ ( $env: APPVEYOR_BUILD_FOLDER ) \artifacts" -- version- suffix= $revision }
0 commit comments