-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.ps1
54 lines (39 loc) · 1.14 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# This script originally (c) 2016 Serilog Contributors - license Apache 2.0
param(
[string] $suffix
)
If ($suffix -eq '') {
Write-Output "Please specify a suffix: E.g. 1.0"
exit
}
echo "build: Build started"
Push-Location $PSScriptRoot
if (Test-Path .\artifacts) {
echo "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}
& dotnet restore --no-cache
if ($LASTEXITCODE -ne 0) { exit 1 }
echo "build: Version suffix is $suffix"
foreach ($src in ls src/*) {
Push-Location $src
echo "build: Packaging project in $src"
if ($suffix) {
& dotnet publish -c Release -o ./obj/publish --version-suffix=$suffix
& dotnet pack -c Release -o ..\..\artifacts --no-build --version-suffix=$suffix
}
else {
& dotnet publish -c Release -o ./obj/publish
& dotnet pack -c Release -o ..\..\artifacts --no-build
}
if ($LASTEXITCODE -ne 0) { exit 1 }
Pop-Location
}
foreach ($test in ls test/*.Tests) {
Push-Location $test
echo "build: Testing project in $test"
& dotnet test -c Release
if ($LASTEXITCODE -ne 0) { exit 3 }
Pop-Location
}
Pop-Location