|
1 | 1 | # Originally based on https://github.com/serilog/serilog/blob/dev/Build.ps1 - (c) Serilog Contributors
|
2 | 2 |
|
3 |
| -echo "build: Build started" |
4 |
| - |
5 | 3 | Push-Location $PSScriptRoot
|
6 | 4 |
|
7 |
| -$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; |
8 |
| -$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; |
9 |
| -$suffix = @{ |
10 |
| - $true = "$revision"; |
11 |
| - $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] |
12 |
| - |
13 | 5 | if(Test-Path .\artifacts) {
|
14 | 6 | echo "build: Cleaning .\artifacts"
|
15 | 7 | Remove-Item .\artifacts -Force -Recurse
|
16 | 8 | }
|
17 | 9 |
|
18 |
| -& dotnet msbuild "/t:Restore" /p:VersionSuffix=$suffix /p:Configuration=Release |
| 10 | +& dotnet restore --no-cache |
19 | 11 |
|
20 |
| -echo "build: Version suffix is $suffix" |
| 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]; |
| 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" |
21 | 20 |
|
22 | 21 | foreach ($src in ls src/*) {
|
23 |
| - Push-Location $src |
| 22 | + Push-Location $src |
24 | 23 |
|
25 | 24 | echo "build: Packaging project in $src"
|
26 | 25 |
|
27 |
| - & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix |
28 |
| - if($LASTEXITCODE -ne 0) { exit 1 } |
| 26 | + & dotnet build -c Release --version-suffix=$buildSuffix |
| 27 | + & dotnet pack -c Release --include-symbols -o ..\..\artifacts --version-suffix=$suffix --no-build |
| 28 | + if($LASTEXITCODE -ne 0) { exit 1 } |
29 | 29 |
|
30 |
| - Pop-Location |
| 30 | + Pop-Location |
31 | 31 | }
|
32 | 32 |
|
33 |
| -foreach ($test in ls test/*.PerformanceTests) { |
34 |
| - Push-Location $test |
| 33 | +foreach ($test in ls test/*.Tests) { |
| 34 | + Push-Location $test |
35 | 35 |
|
36 |
| - echo "build: Building performance test project in $test" |
| 36 | + echo "build: Testing project in $test" |
37 | 37 |
|
38 |
| - & dotnet build -c Release |
39 |
| - if($LASTEXITCODE -ne 0) { exit 2 } |
| 38 | + & dotnet test -c Release |
| 39 | + if($LASTEXITCODE -ne 0) { exit 3 } |
40 | 40 |
|
41 |
| - Pop-Location |
| 41 | + Pop-Location |
42 | 42 | }
|
43 | 43 |
|
44 |
| -foreach ($test in ls test/*.Tests) { |
45 |
| - Push-Location $test |
| 44 | +foreach ($test in ls test/*.PerformanceTests) { |
| 45 | + Push-Location $test |
46 | 46 |
|
47 |
| - echo "build: Testing project in $test" |
| 47 | + echo "build: Building performance test project in $test" |
48 | 48 |
|
49 |
| - & dotnet test -c Release |
50 |
| - if($LASTEXITCODE -ne 0) { exit 3 } |
| 49 | + & dotnet build -c Release |
| 50 | + if($LASTEXITCODE -ne 0) { exit 2 } |
51 | 51 |
|
52 |
| - Pop-Location |
| 52 | + Pop-Location |
53 | 53 | }
|
54 | 54 |
|
55 | 55 | Pop-Location
|
0 commit comments