forked from natemcmaster/dotnet-serve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
executable file
·36 lines (27 loc) · 884 Bytes
/
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
#!/usr/bin/env pwsh
[CmdletBinding(PositionalBinding = $false)]
param(
[ValidateSet('Debug', 'Release')]
$Configuration = $null,
[switch]
$ci
)
Set-StrictMode -Version 1
$ErrorActionPreference = 'Stop'
Import-Module -Force -Scope Local "$PSScriptRoot/src/common.psm1"
if (!$Configuration) {
$Configuration = if ($ci) { 'Release' } else { 'Debug' }
}
$artifacts = "$PSScriptRoot/artifacts/"
Remove-Item -Recurse $artifacts -ErrorAction Ignore
exec dotnet tool restore
[string[]] $formatArgs=@()
if ($ci) {
$formatArgs += '--check'
}
exec dotnet tool run dotnet-format -- -v detailed @formatArgs
exec dotnet build --configuration $Configuration
exec dotnet pack --no-build --configuration $Configuration -o $artifacts
exec dotnet test --no-build --configuration $Configuration `
--collect:"XPlat Code Coverage"
write-host -f green 'BUILD SUCCEEDED'