@@ -2,68 +2,59 @@ echo "build: Build started"
22
33Push-Location $PSScriptRoot
44
5- if (Test-Path .\artifacts) {
6- echo " build: Cleaning .\artifacts"
7- Remove-Item .\artifacts - Force - Recurse
5+ if (Test-Path .\artifacts) {
6+ echo " build: Cleaning .\artifacts"
7+ Remove-Item .\artifacts - Force - Recurse
88}
99
1010& dotnet restore -- no- cache
1111
1212$branch = @ { $true = $env: APPVEYOR_REPO_BRANCH ; $false = $ (git symbolic- ref -- short - q HEAD) }[$env: APPVEYOR_REPO_BRANCH -ne $NULL ];
1313$revision = @ { $true = " {0:00000}" -f [convert ]::ToInt32(" 0" + $env: APPVEYOR_BUILD_NUMBER , 10 ); $false = " local" }[$env: APPVEYOR_BUILD_NUMBER -ne $NULL ];
1414$suffix = @ { $true = " " ; $false = " $ ( $branch.Substring (0 , [math ]::Min(10 , $branch.Length ))) -$revision " }[$branch -eq " main" -and $revision -ne " local" ]
15+ $commitHash = $ (git rev- parse -- short HEAD)
16+ $buildSuffix = @ { $true = " $ ( $suffix ) -$ ( $commitHash ) " ; $false = " $ ( $branch ) -$ ( $commitHash ) " }[$suffix -ne " " ]
1517
16- echo " build: Version suffix is $suffix "
18+ echo " build: Package version suffix is $suffix "
19+ echo " build: Build version suffix is $buildSuffix "
1720
18- foreach ($src in dir src/* ) {
21+ foreach ($src in gci src/* ) {
1922 Push-Location $src
2023
21- echo " build: Packaging project in $src "
24+ echo " build: Packaging project in $src "
2225
23- & dotnet pack - c Release - o ..\..\artifacts -- version- suffix= $suffix - p:ContinuousIntegrationBuild= true
24- if ($LASTEXITCODE -ne 0 ) { exit 1 }
26+ & dotnet build - c Release -- version- suffix= $buildSuffix
2527
26- Pop-Location
27- }
28-
29- foreach ($test in dir 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 }
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 }
3634
3735 Pop-Location
3836}
3937
40- foreach ($test in dir test/* .Tests) {
38+ foreach ($test in gci test/* .Tests) {
4139 Push-Location $test
4240
43- echo " build: Testing project in $test "
41+ echo " build: Testing project in $test "
4442
45- if ($PSVersionTable.Platform -eq " Unix" ) {
46- & dotnet test - c Release -f netcoreapp3.1
47- & dotnet test - c Release -f net6.0
48- } else {
49- & dotnet test - c Release
50- }
51-
52- if ($LASTEXITCODE -ne 0 ) { exit 3 }
43+ & dotnet test - c Release
44+ if ($LASTEXITCODE -ne 0 ) { exit 3 }
5345
5446 Pop-Location
5547}
5648
57- if ($PSVersionTable .Platform -eq " Unix " ) {
58- Push-Location sample / Sample
49+ foreach ($test in gci test /* .PerformanceTests ) {
50+ Push-Location $test
5951
60- & dotnet run -f netcoreapp3.1 - c Release -- run- once
61- if ($LASTEXITCODE -ne 0 ) { exit 4 }
52+ echo " build: Building performance test project in $test "
6253
63- & dotnet run -f net6. 0 - c Release -- run - once
64- if ($LASTEXITCODE -ne 0 ) { exit 4 }
54+ & dotnet build - c Release
55+ if ($LASTEXITCODE -ne 0 ) { exit 2 }
6556
6657 Pop-Location
6758}
6859
69- Pop-Location
60+ Pop-Location
0 commit comments