8
8
[Parameter (Mandatory = $false )][switch ] $SkipTests
9
9
)
10
10
11
- # These make CI builds faster
12
- $env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE = " true"
13
- $env: NUGET_XMLDOC_MODE = " skip"
14
-
15
11
$Configuration = " Release"
16
12
$ErrorActionPreference = " Stop"
17
13
$ProgressPreference = " SilentlyContinue"
@@ -21,8 +17,8 @@ $sdkFile = Join-Path $solutionPath "global.json"
21
17
22
18
$dotnetVersion = (Get-Content $sdkFile | Out-String | ConvertFrom-Json ).sdk.version
23
19
24
- if ($OutputPath -eq " " ) {
25
- $OutputPath = Join-Path $PSScriptRoot " artifacts"
20
+ if ([ string ]::IsNullOrEmpty( $OutputPath ) ) {
21
+ $OutputPath = Join-Path $solutionPath " artifacts"
26
22
}
27
23
28
24
$installDotNetSdk = $false ;
@@ -47,45 +43,45 @@ else {
47
43
48
44
if ($installDotNetSdk -eq $true ) {
49
45
50
- $env: DOTNET_INSTALL_DIR = Join-Path $PSScriptRoot " .dotnet"
51
- $sdkPath = Join-Path $env: DOTNET_INSTALL_DIR " sdk" " $dotnetVersion "
46
+ ${ env: DOTNET_INSTALL_DIR} = Join-Path $solutionPath " .dotnet"
47
+ $sdkPath = Join-Path ${ env: DOTNET_INSTALL_DIR} " sdk" $dotnetVersion
52
48
53
49
if (! (Test-Path $sdkPath )) {
54
- if (! (Test-Path $env: DOTNET_INSTALL_DIR )) {
55
- mkdir $env: DOTNET_INSTALL_DIR | Out-Null
50
+ if (-Not (Test-Path ${ env: DOTNET_INSTALL_DIR} )) {
51
+ mkdir ${ env: DOTNET_INSTALL_DIR} | Out-Null
56
52
}
57
53
[Net.ServicePointManager ]::SecurityProtocol = [Net.ServicePointManager ]::SecurityProtocol -bor " Tls12"
58
54
if (($PSVersionTable.PSVersion.Major -ge 6 ) -And ! $IsWindows ) {
59
- $installScript = Join-Path $env: DOTNET_INSTALL_DIR " install.sh"
55
+ $installScript = Join-Path ${ env: DOTNET_INSTALL_DIR} " install.sh"
60
56
Invoke-WebRequest " https://dot.net/v1/dotnet-install.sh" - OutFile $installScript - UseBasicParsing
61
57
chmod + x $installScript
62
- & $installScript -- version " $dotnetVersion " -- install-dir " $ env: DOTNET_INSTALL_DIR" -- no- path -- skip-non - versioned- files
58
+ & $installScript -- jsonfile $sdkFile -- install-dir ${ env: DOTNET_INSTALL_DIR} -- no- path -- skip-non - versioned- files
63
59
}
64
60
else {
65
- $installScript = Join-Path $env: DOTNET_INSTALL_DIR " install.ps1"
61
+ $installScript = Join-Path ${ env: DOTNET_INSTALL_DIR} " install.ps1"
66
62
Invoke-WebRequest " https://dot.net/v1/dotnet-install.ps1" - OutFile $installScript - UseBasicParsing
67
- & $installScript - Version " $dotnetVersion " - InstallDir " $ env: DOTNET_INSTALL_DIR" - NoPath - SkipNonVersionedFiles
63
+ & $installScript - JsonFile $sdkFile - InstallDir ${ env: DOTNET_INSTALL_DIR} - NoPath - SkipNonVersionedFiles
68
64
}
69
65
}
70
66
}
71
67
else {
72
- $env: DOTNET_INSTALL_DIR = Split-Path - Path (Get-Command dotnet).Path
68
+ ${ env: DOTNET_INSTALL_DIR} = Split-Path - Path (Get-Command dotnet).Path
73
69
}
74
70
75
- $dotnet = Join-Path " $ env: DOTNET_INSTALL_DIR" " dotnet"
71
+ $dotnet = Join-Path ${ env: DOTNET_INSTALL_DIR} " dotnet"
76
72
77
73
if ($installDotNetSdk -eq $true ) {
78
- $env: PATH = " $env: DOTNET_INSTALL_DIR ; $ env: PATH"
74
+ ${ env: PATH} = " ${ env: DOTNET_INSTALL_DIR} ; ${ env: PATH} "
79
75
}
80
76
81
77
function DotNetTest {
82
78
param ([string ]$Project )
83
79
84
80
$additionalArgs = @ ()
85
81
86
- if (! [string ]::IsNullOrEmpty($env: GITHUB_SHA )) {
87
- $additionalArgs += " --logger"
88
- $additionalArgs += " GitHubActions;report-warnings=false "
82
+ if (-Not [string ]::IsNullOrEmpty(${ env: GITHUB_SHA} )) {
83
+ $additionalArgs += " --logger:GitHubActions;report-warnings=false "
84
+ $additionalArgs += " --logger:junit;LogFilePath=junit.xml "
89
85
}
90
86
91
87
& $dotnet test $Project -- output $OutputPath -- configuration $Configuration $additionalArgs
0 commit comments