Skip to content

Commit 062a760

Browse files
committed
Update Build.ps1
1 parent 8ebb9e2 commit 062a760

File tree

1 file changed

+10
-35
lines changed

1 file changed

+10
-35
lines changed

Build.ps1

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ if(Test-Path .\artifacts) {
77
Remove-Item .\artifacts -Force -Recurse
88
}
99

10-
& dotnet restore --no-cache
11-
1210
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
1311
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
1412
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"]
@@ -18,43 +16,20 @@ $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($c
1816
echo "build: Package version suffix is $suffix"
1917
echo "build: Build version suffix is $buildSuffix"
2018

21-
foreach ($src in gci src/*) {
22-
Push-Location $src
23-
24-
echo "build: Packaging project in $src"
25-
26-
& dotnet build -c Release --version-suffix=$buildSuffix
27-
28-
if($suffix) {
29-
& dotnet pack -c Release --include-source --no-build -o ../../artifacts --version-suffix=$suffix -p:ContinuousIntegrationBuild=true
30-
} else {
31-
& dotnet pack -c Release --include-source --no-build -o ../../artifacts -p:ContinuousIntegrationBuild=true
32-
}
33-
if($LASTEXITCODE -ne 0) { exit 1 }
34-
35-
Pop-Location
36-
}
37-
38-
foreach ($test in gci test/*.Tests) {
39-
Push-Location $test
40-
41-
echo "build: Testing project in $test"
19+
& dotnet build --configuration Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
4220

43-
& dotnet test -c Release
44-
if($LASTEXITCODE -ne 0) { exit 3 }
21+
if($LASTEXITCODE -ne 0) { exit 1 }
4522

46-
Pop-Location
23+
if($suffix) {
24+
& dotnet pack src\Serilog --configuration Release --no-build --no-restore -o artifacts --version-suffix=$suffix
25+
} else {
26+
& dotnet pack src\Serilog --configuration Release --no-build --no-restore -o artifacts
4727
}
4828

49-
foreach ($test in gci test/*.PerformanceTests) {
50-
Push-Location $test
29+
if($LASTEXITCODE -ne 0) { exit 2 }
5130

52-
echo "build: Building performance test project in $test"
31+
Write-Output "build: Testing"
5332

54-
& dotnet build -c Release
55-
if($LASTEXITCODE -ne 0) { exit 2 }
56-
57-
Pop-Location
58-
}
33+
& dotnet test test\Serilog.Tests --configuration Release --no-build --no-restore
5934

60-
Pop-Location
35+
if($LASTEXITCODE -ne 0) { exit 3 }

0 commit comments

Comments
 (0)