-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.ps1
43 lines (34 loc) · 1.59 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$result = 0
if ($isLinux) {
dotnet build -c Release
dotnet test -c Release --no-build
} else {
$prNumber = $env:APPVEYOR_PULL_REQUEST_NUMBER
if ($prNumber) {
$prArgs = "-d:sonar.pullrequest.key=$prNumber"
} elseif ($env:APPVEYOR_REPO_BRANCH) {
$prArgs = "-d:sonar.branch.name=$env:APPVEYOR_REPO_BRANCH"
}
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
dotnet sonarscanner begin /k:aguacongas_DymamicAuthProviders -o:aguacongas -d:sonar.host.url=https://sonarcloud.io -d:sonar.login=$env:sonarqube -d:sonar.coverageReportPaths=coverage\SonarQube.xml $prArgs -v:$env:Version
} elseif ($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -eq $env:APPVEYOR_REPO_NAME) {
dotnet sonarscanner begin /k:aguacongas_DymamicAuthProviders -o:aguacongas -d:sonar.host.url=https://sonarcloud.io -d:sonar.login=$env:sonarqube -d:sonar.coverageReportPaths=coverage\SonarQube.xml $prArgs -v:$env:Version
}
dotnet build -c Release
dotnet test -c Release --no-build --collect:"XPlat Code Coverage" --settings coverletArgs.runsettings -v q
$merge = ""
Get-ChildItem -rec `
| Where-Object { $_.Name -like "coverage.cobertura.xml" } `
| ForEach-Object {
$path = $_.FullName
$merge = "$merge;$path"
}
Write-Host $merge
ReportGenerator\tools\net9.0\ReportGenerator.exe "-reports:$merge" "-targetdir:coverage" "-reporttypes:SonarQube"
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
dotnet sonarscanner end -d:sonar.login=$env:sonarqube
} elseif ($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -eq $env:APPVEYOR_REPO_NAME) {
dotnet sonarscanner end -d:sonar.login=$env:sonarqube
}
}
exit $result