forked from giraffe-fsharp/Giraffe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
90 lines (68 loc) · 2.26 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# ----------------------------------------------
# Build script
# ----------------------------------------------
param
(
[switch] $Release,
[switch] $ExcludeTests,
[switch] $ExcludeSamples,
[switch] $Pack,
[switch] $Run,
[switch] $ClearOnly
)
# ----------------------------------------------
# Main
# ----------------------------------------------
$ErrorActionPreference = "Stop"
Import-module "$PSScriptRoot/.psscripts/build-functions.ps1" -Force
Write-BuildHeader "Starting Giraffe build script"
if ($ClearOnly.IsPresent)
{
Remove-OldBuildArtifacts
return
}
$giraffe = "./src/Giraffe/Giraffe.fsproj"
$giraffeTests = "./tests/Giraffe.Tests/Giraffe.Tests.fsproj"
$identityApp = "./samples/IdentityApp/IdentityApp/IdentityApp.fsproj"
$jwtApp = "./samples/JwtApp/JwtApp/JwtApp.fsproj"
$sampleApp = "./samples/SampleApp/SampleApp/SampleApp.fsproj"
$sampleAppTests = "./samples/SampleApp/SampleApp.Tests/SampleApp.Tests.fsproj"
$version = Get-ProjectVersion $giraffe
Update-AppVeyorBuildVersion $version
if (Test-IsAppVeyorBuildTriggeredByGitTag)
{
$gitTag = Get-AppVeyorGitTag
Test-CompareVersions $version $gitTag
}
Write-DotnetCoreVersions
Remove-OldBuildArtifacts
$configuration = if ($Release.IsPresent) { "Release" } else { "Debug" }
Write-Host "Building Giraffe..." -ForegroundColor Magenta
dotnet-build $giraffe "-c $configuration"
if (!$ExcludeTests.IsPresent -and !$Run.IsPresent)
{
Write-Host "Building and running tests..." -ForegroundColor Magenta
dotnet-build $giraffeTests
dotnet-test $giraffeTests
}
if (!$ExcludeSamples.IsPresent -and !$Run.IsPresent)
{
Write-Host "Building and testing samples..." -ForegroundColor Magenta
dotnet-build $identityApp
dotnet-build $jwtApp
dotnet-build $sampleApp
dotnet-build $sampleAppTests
dotnet-test $sampleAppTests
}
if ($Run.IsPresent)
{
Write-Host "Launching sample application..." -ForegroundColor Magenta
dotnet-build $sampleApp
dotnet-run $sampleApp
}
if ($Pack.IsPresent)
{
Write-Host "Packaging Giraffe NuGet package..." -ForegroundColor Magenta
dotnet-pack $giraffe "-c $configuration"
}
Write-SuccessFooter "Giraffe build completed successfully!"