@@ -9,34 +9,52 @@ function Get-Version-Suffix-From-Tag
9
9
return $final
10
10
}
11
11
12
+ function CheckLastExitCode {
13
+ param ([int []]$SuccessCodes = @ (0 ), [scriptblock ]$CleanupScript = $null )
14
+
15
+ if ($SuccessCodes -notcontains $LastExitCode ) {
16
+ $msg = " EXE RETURNED EXIT CODE $LastExitCode "
17
+ throw $msg
18
+ }
19
+ }
20
+
12
21
$revision = @ { $true = $env: APPVEYOR_BUILD_NUMBER ; $false = 1 }[$env: APPVEYOR_BUILD_NUMBER -ne $NULL ];
13
22
$revision = " {0:D4}" -f [convert ]::ToInt32($revision , 10 )
14
23
15
24
dotnet restore
16
25
17
26
dotnet test ./ test/ UnitTests/ UnitTests.csproj
27
+ CheckLastExitCode
28
+
18
29
dotnet test ./ test/ JsonApiDotNetCoreExampleTests/ JsonApiDotNetCoreExampleTests.csproj
30
+ CheckLastExitCode
31
+
19
32
dotnet test ./ test/ NoEntityFrameworkTests/ NoEntityFrameworkTests.csproj
33
+ CheckLastExitCode
20
34
21
35
dotnet build .\src\JsonApiDotNetCore - c Release
36
+ CheckLastExitCode
22
37
23
- echo " APPVEYOR_REPO_TAG: $env: APPVEYOR_REPO_TAG "
38
+ Write-Output " APPVEYOR_REPO_TAG: $env: APPVEYOR_REPO_TAG "
24
39
25
40
If ($env: APPVEYOR_REPO_TAG -eq $true ) {
26
41
$revision = Get-Version - Suffix- From- Tag
27
- echo " VERSION-SUFFIX: $revision "
42
+ Write-Output " VERSION-SUFFIX: $revision "
28
43
29
44
IF ([string ]::IsNullOrWhitespace($revision )){
30
- echo " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts"
45
+ Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts"
31
46
dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts
47
+ CheckLastExitCode
32
48
}
33
49
Else {
34
- echo " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision "
50
+ Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision "
35
51
dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts -- version- suffix= $revision
52
+ CheckLastExitCode
36
53
}
37
54
}
38
55
Else {
39
- echo " VERSION-SUFFIX: alpha1-$revision "
40
- echo " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=alpha1-$revision "
56
+ Write-Output " VERSION-SUFFIX: alpha1-$revision "
57
+ Write-Output " RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=alpha1-$revision "
41
58
dotnet pack .\src\JsonApiDotNetCore - c Release - o .\artifacts -- version- suffix= alpha1- $revision
59
+ CheckLastExitCode
42
60
}
0 commit comments