-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.ps1
49 lines (42 loc) · 1.58 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
44
45
46
47
48
49
$result = 0
if ($isLinux) {
Get-ChildItem -rec `
| Where-Object { $_.Name -like "*.Test.csproj" `
} `
| ForEach-Object {
Set-Location $_.DirectoryName
dotnet test
if ($LASTEXITCODE -ne 0) {
$result = $LASTEXITCODE
}
}
} 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"
}
dotnet sonarscanner begin /k:aguacongas_Identity.Firebase -o:aguafrommars -d:sonar.host.url=https://sonarcloud.io -d:sonar.login=$env:sonarqube -d:sonar.coverageReportPaths=coverage\SonarQube.xml $prArgs -v:$env:nextversion
dotnet build -c Release
Get-ChildItem -rec `
| Where-Object { $_.Name -like "*.Test.csproj" `
} `
| ForEach-Object {
&('dotnet') ('test', $_.FullName, '--logger', "trx;LogFileName=$_.trx", '--no-build', '-c', 'Release', '--collect:"XPlat Code Coverage"')
if ($LASTEXITCODE -ne 0) {
$result = $LASTEXITCODE
}
}
$merge = ""
Get-ChildItem -rec `
| Where-Object { $_.Name -like "coverage.cobertura.xml" } `
| ForEach-Object {
$path = $_.FullName
$merge = "$merge;$path"
}
Write-Host $merge
ReportGenerator\tools\net8.0\ReportGenerator.exe "-reports:$merge" "-targetdir:coverage" "-reporttypes:SonarQube"
dotnet sonarscanner end -d:sonar.login=$env:sonarqube
}
exit $result