|
1 |
| -echo "build: Build started" |
| 1 | +Write-Output "build: Build started" |
2 | 2 |
|
3 | 3 | Push-Location $PSScriptRoot
|
4 | 4 |
|
5 | 5 | if(Test-Path .\artifacts) {
|
6 |
| - echo "build: Cleaning .\artifacts" |
7 |
| - Remove-Item .\artifacts -Force -Recurse |
| 6 | + Write-Output "build: Cleaning ./artifacts" |
| 7 | + Remove-Item ./artifacts -Force -Recurse |
8 | 8 | }
|
9 | 9 |
|
10 | 10 | & dotnet restore --no-cache
|
11 | 11 |
|
12 |
| -$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; |
13 |
| -$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; |
| 12 | +$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:APPVEYOR_REPO_BRANCH]; |
| 13 | +$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:APPVEYOR_BUILD_NUMBER]; |
14 | 14 | $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
|
15 |
| -$commitHash = $(git rev-parse --short HEAD) |
16 |
| -$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] |
17 | 15 |
|
18 |
| -echo "build: Package version suffix is $suffix" |
19 |
| -echo "build: Build version suffix is $buildSuffix" |
| 16 | +Write-Output "build: Package version suffix is $suffix" |
20 | 17 |
|
21 |
| -foreach ($src in ls src/*) { |
| 18 | +foreach ($src in Get-ChildItem src/*) { |
22 | 19 | Push-Location $src
|
23 | 20 |
|
24 |
| - echo "build: Packaging project in $src" |
| 21 | + Write-Output "build: Packaging project in $src" |
25 | 22 |
|
26 |
| - & dotnet build -c Release --version-suffix=$buildSuffix -p:EnableSourceLink=true |
27 | 23 | if ($suffix) {
|
28 |
| - & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build |
| 24 | + & dotnet pack -c Release --include-source -o ../../artifacts --version-suffix=$suffix |
29 | 25 | } else {
|
30 |
| - & dotnet pack -c Release -o ..\..\artifacts --no-build |
| 26 | + & dotnet pack -c Release --include-source -o ../../artifacts |
31 | 27 | }
|
32 |
| - if($LASTEXITCODE -ne 0) { exit 1 } |
| 28 | + if($LASTEXITCODE -ne 0) { throw "Packaging failed" } |
33 | 29 |
|
34 | 30 | Pop-Location
|
35 | 31 | }
|
36 | 32 |
|
37 |
| -foreach ($test in ls test/*.Tests) { |
| 33 | +foreach ($test in Get-ChildItem test/*.Tests) { |
38 | 34 | Push-Location $test
|
39 | 35 |
|
40 |
| - echo "build: Testing project in $test" |
| 36 | + Write-Output "build: Testing project in $test" |
41 | 37 |
|
42 | 38 | & dotnet test -c Release
|
43 |
| - if($LASTEXITCODE -ne 0) { exit 3 } |
| 39 | + if($LASTEXITCODE -ne 0) { throw "Testing failed" } |
44 | 40 |
|
45 | 41 | Pop-Location
|
46 | 42 | }
|
|
0 commit comments