This repository was archived by the owner on Aug 20, 2026. It is now read-only.
forked from emmekappa/BrakePedal
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.ps1
More file actions
56 lines (46 loc) · 1.81 KB
/
Copy pathbuild.ps1
File metadata and controls
56 lines (46 loc) · 1.81 KB
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
param(
[Parameter(Position = 0, ValueFromPipeline)]
[string] $Version = "0.0.0",
[Parameter(Position = 1, ValueFromPipeline)]
[ValidateSet("Debug", "Release")]
[string] $Configuration = "Release",
[Parameter(Position = 2, ValueFromPipeline)]
[switch] $RunTests,
[Parameter(Position = 3, ValueFromPipeline)]
[switch] $Nupkg
)
$ErrorActionPreference = "Stop";
$ConfirmPreference = "None";
$WorkingDirectory = Split-Path -parent $MyInvocation.MyCommand.Definition
. $WorkingDirectory\common.ps1
$BuildOutputDirectory = Join-Path $WorkingDirectory build\$Version
$TestResultsOutputDirectory = Join-Path $WorkingDirectory build\$Version\TestResults
Resolve-Shell-Dependency dotnet
Invoke-Command-Colored dotnet @(
("build {0}" -f (Join-Path $WorkingDirectory src\BrakePedal.NETStandard.sln))
"/p:Version=$Version",
"/p:GeneratePackageOnBuild=$Nupkg"
"--output $BuildOutputDirectory"
"--configuration $Configuration"
)
if($RunTests) {
$TestProjects = Get-ChildItem -Path $BuildOutputDirectory -filter *.tests.dll | Select-Object -Expand FullName
$TestProjectsCount = $TestProjects.Length
Write-Output-Header ("Running tests. Projects: {0}" -f ($TestProjectsCount))
foreach ($TestProject in $TestProjects)
{
$TestProjectName = Split-Path $TestProject -LeafBase
$TestResultOutputDirectory = Join-Path $TestResultsOutputDirectory $TestProjectName
Write-Output "Project: $TestProject"
Write-Output "Test result directory: $TestResultOutputDirectory"
Write-Output ""
Invoke-Command-Colored dotnet @(
"test"
"$TestProject"
"--test-adapter-path:."
"--logger:xunit"
"--verbosity normal"
"--results-directory $TestResultOutputDirectory"
)
}
}