@@ -3,47 +3,56 @@ echo "build: Build started"
3
3
Push-Location $PSScriptRoot
4
4
5
5
if (Test-Path .\artifacts) {
6
- echo " build: Cleaning .\ artifacts"
7
- Remove-Item .\ artifacts - Force - Recurse
6
+ echo " build: Cleaning ./ artifacts"
7
+ Remove-Item ./ artifacts - Force - Recurse
8
8
}
9
9
10
10
& dotnet restore -- no- cache
11
11
12
12
$branch = @ { $true = $env: APPVEYOR_REPO_BRANCH ; $false = $ (git symbolic- ref -- short - q HEAD) }[$env: APPVEYOR_REPO_BRANCH -ne $NULL ];
13
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" ]
14
+ $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 " " ]
15
17
16
- echo " build: Version suffix is $suffix "
18
+ echo " build: Package version suffix is $suffix "
19
+ echo " build: Build version suffix is $buildSuffix "
17
20
18
- foreach ($src in ls src/* ) {
21
+ foreach ($src in gci src/* ) {
19
22
Push-Location $src
20
23
21
24
echo " build: Packaging project in $src "
22
25
23
- & dotnet pack - c Release - o ..\..\artifacts -- version- suffix= $suffix
24
- if ($LASTEXITCODE -ne 0 ) { exit 1 }
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
30
+ } else {
31
+ & dotnet pack - c Release -- include- source -- no- build - o ../ ../ artifacts
32
+ }
33
+ if ($LASTEXITCODE -ne 0 ) { exit 1 }
25
34
26
35
Pop-Location
27
36
}
28
37
29
- foreach ($test in ls test/* .PerformanceTests ) {
38
+ foreach ($test in gci test/* .Tests ) {
30
39
Push-Location $test
31
40
32
- echo " build: Building performance test project in $test "
41
+ echo " build: Testing project in $test "
33
42
34
- & dotnet build - c Release
35
- if ($LASTEXITCODE -ne 0 ) { exit 2 }
43
+ & dotnet test - c Release
44
+ if ($LASTEXITCODE -ne 0 ) { exit 3 }
36
45
37
46
Pop-Location
38
47
}
39
48
40
- foreach ($test in ls test/* .Tests ) {
49
+ foreach ($test in ls test/* .PerformanceTests ) {
41
50
Push-Location $test
42
51
43
- echo " build: Testing project in $test "
52
+ echo " build: Building performance test project in $test "
44
53
45
- & dotnet test - c Release
46
- if ($LASTEXITCODE -ne 0 ) { exit 3 }
54
+ & dotnet build - c Release
55
+ if ($LASTEXITCODE -ne 0 ) { exit 2 }
47
56
48
57
Pop-Location
49
58
}
0 commit comments