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