| 
 | 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 |  | -& dotnet restore  | 
 | 10 | +& dotnet restore --no-cache  | 
6 | 11 | 
 
  | 
7 |  | -$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];  | 
 | 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"]  | 
8 | 15 | 
 
  | 
9 |  | -Push-Location src/Serilog.Extensions.Logging  | 
 | 16 | +echo "build: Version suffix is $suffix"  | 
10 | 17 | 
 
  | 
11 |  | -& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision  | 
12 |  | -if($LASTEXITCODE -ne 0) { exit 1 }      | 
 | 18 | +foreach ($src in ls src/*) {  | 
 | 19 | +    Push-Location $src  | 
13 | 20 | 
 
  | 
14 |  | -Pop-Location  | 
15 |  | -Push-Location test/Serilog.Extensions.Logging.Tests  | 
 | 21 | +	echo "build: Packaging project in $src"  | 
16 | 22 | 
 
  | 
17 |  | -& dotnet test -c Release  | 
18 |  | -if($LASTEXITCODE -ne 0) { exit 2 }  | 
 | 23 | +    & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix  | 
 | 24 | +    if($LASTEXITCODE -ne 0) { exit 1 }      | 
 | 25 | + | 
 | 26 | +    Pop-Location  | 
 | 27 | +}  | 
 | 28 | + | 
 | 29 | +foreach ($test in ls test/*.PerformanceTests) {  | 
 | 30 | +    Push-Location $test  | 
 | 31 | + | 
 | 32 | +	echo "build: Building performance test project in $test"  | 
 | 33 | + | 
 | 34 | +    & dotnet build -c Release  | 
 | 35 | +    if($LASTEXITCODE -ne 0) { exit 2 }  | 
 | 36 | + | 
 | 37 | +    Pop-Location  | 
 | 38 | +}  | 
 | 39 | + | 
 | 40 | +foreach ($test in ls test/*.Tests) {  | 
 | 41 | +    Push-Location $test  | 
 | 42 | + | 
 | 43 | +	echo "build: Testing project in $test"  | 
 | 44 | + | 
 | 45 | +    & dotnet test -c Release  | 
 | 46 | +    if($LASTEXITCODE -ne 0) { exit 3 }  | 
 | 47 | + | 
 | 48 | +    Pop-Location  | 
 | 49 | +}  | 
19 | 50 | 
 
  | 
20 |  | -Pop-Location  | 
21 | 51 | Pop-Location  | 
0 commit comments