Skip to content

Commit 1dc2cf1

Browse files
committed
Reduce verbosity of build script
Update to use Pester version 4.1.1 Change logic in appveyor to invoke pester only once
1 parent 878d0f6 commit 1dc2cf1

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

appveyor.yml

+7-11
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ cache:
1919
install:
2020
- ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion
2121
- ps: |
22-
$requiredPesterVersion = '3.4.0'
22+
$requiredPesterVersion = '4.1.1'
2323
$pester = Get-Module Pester -ListAvailable | Where-Object { $_.Version -eq $requiredPesterVersion }
2424
$pester
2525
if ($null -eq $pester) # WMF 4 build does not have pester
2626
{
27-
cinst -y pester --version $requiredPesterVersion
27+
nuget install Pester -Version 4.1.1 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion
2828
}
2929
- ps: |
3030
# the legacy WMF4 image only has the old preview SDKs of dotnet
@@ -57,19 +57,15 @@ branches:
5757
test_script:
5858
- SET PATH=c:\Program Files\WindowsPowerShell\Modules\;%PATH%;
5959
- ps: |
60-
copy "C:\projects\psscriptanalyzer\out\PSScriptAnalyzer" "$Env:ProgramFiles\WindowsPowerShell\Modules\" -Recurse -Force
61-
$engineTestResultsFile = ".\EngineTestResults.xml"
60+
copy-item "C:\projects\psscriptanalyzer\out\PSScriptAnalyzer" "$Env:ProgramFiles\WindowsPowerShell\Modules\" -Recurse -Force
61+
$testResultsFile = ".\TestResults.xml"
6262
$ruleTestResultsFile = ".\RuleTestResults.xml"
63-
$engineTestResults = Invoke-Pester -Script "C:\projects\psscriptanalyzer\Tests\Engine" -OutputFormat NUnitXml -OutputFile $engineTestResultsFile -PassThru
64-
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $engineTestResultsFile))
63+
$testScripts = "C:\projects\psscriptanalyzer\Tests\Engine","C:\projects\psscriptanalyzer\Tests\Rules"
64+
$testResults = Invoke-Pester -Script $testScripts -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru
65+
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
6566
if ($engineTestResults.FailedCount -gt 0) {
6667
throw "$($engineTestResults.FailedCount) tests failed."
6768
}
68-
$ruleTestResults = Invoke-Pester -Script "C:\projects\psscriptanalyzer\Tests\Rules" -OutputFormat NUnitXml -OutputFile $ruleTestResultsFile -PassThru
69-
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $ruleTestResultsFile))
70-
if ($ruleTestResults.FailedCount -gt 0) {
71-
throw "$($ruleTestResults.FailedCount) tests failed."
72-
}
7369
7470
# Upload the project along with TestResults as a zip archive
7571
on_finish:

build.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ if ($Install)
132132

133133
if ($Test)
134134
{
135-
Import-Module -Name Pester -MinimumVersion 3.4.0 -ErrorAction Stop
135+
Import-Module -Name Pester -MinimumVersion 4.1.1 -ErrorAction Stop
136136
Function GetTestRunnerScriptContent($testPath)
137137
{
138138
$x = @"
@@ -202,4 +202,4 @@ if ($Test)
202202
if ($Uninstall)
203203
{
204204
Remove-Item -Path $modulePSSAPath -Force -Verbose:$verbosity -Recurse
205-
}
205+
}

buildCoreClr.ps1

+14-7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function Invoke-RestoreSolution
3131
dotnet restore (Join-Path $PSScriptRoot .\PSScriptAnalyzer.sln)
3232
}
3333

34+
Write-Progress "Building ScriptAnalyzer"
3435
$solutionDir = Split-Path $MyInvocation.InvocationName
3536
if (-not (Test-Path "$solutionDir/global.json"))
3637
{
@@ -63,6 +64,7 @@ if ($Restore.IsPresent)
6364
if ($build)
6465
{
6566

67+
Write-Progress "Building Engine"
6668
if (-not (Test-DotNetRestore((Join-Path $solutionDir Engine))))
6769
{
6870
Invoke-RestoreSolution
@@ -76,6 +78,7 @@ if ($build)
7678
{
7779
Invoke-RestoreSolution
7880
}
81+
Write-Progress "Building for framework $Framework, configuration $Configuration"
7982
Push-Location Rules\
8083
dotnet build Rules.csproj --framework $Framework --configuration $Configuration
8184
Pop-Location
@@ -84,23 +87,26 @@ if ($build)
8487
{
8588
if (-not (Test-Path $destination))
8689
{
87-
New-Item -ItemType Directory $destination -Force
90+
$null = New-Item -ItemType Directory $destination -Force
8891
}
8992
foreach ($file in $itemsToCopy)
9093
{
91-
Copy-Item -Path $file -Destination (Join-Path $destination (Split-Path $file -Leaf)) -Verbose -Force
94+
Copy-Item -Path $file -Destination (Join-Path $destination (Split-Path $file -Leaf)) -Force
9295
}
9396
}
97+
98+
99+
Write-Progress "Copying files to $destinationDir"
94100
CopyToDestinationDir $itemsToCopyCommon $destinationDir
95101
CopyToDestinationDir $itemsToCopyBinaries $destinationDirBinaries
96102

97103
# Copy Settings File
98-
Copy-Item -Path "$solutionDir\Engine\Settings" -Destination $destinationDir -Force -Recurse -Verbose
104+
Copy-Item -Path "$solutionDir\Engine\Settings" -Destination $destinationDir -Force -Recurse
99105

100106
# copy newtonsoft dll if net451 framework
101107
if ($Framework -eq "net451")
102108
{
103-
copy-item -path "$solutionDir\Rules\bin\$Configuration\$Framework\Newtonsoft.Json.dll" -Destination $destinationDirBinaries -Verbose
109+
copy-item -path "$solutionDir\Rules\bin\$Configuration\$Framework\Newtonsoft.Json.dll" -Destination $destinationDirBinaries
104110
}
105111
}
106112

@@ -112,11 +118,12 @@ if ($uninstall)
112118
{
113119
if ((Test-Path $pssaModulePath))
114120
{
115-
Remove-Item -Recurse $pssaModulePath -Verbose
121+
Remove-Item -Recurse $pssaModulePath
116122
}
117123
}
118124

119125
if ($install)
120126
{
121-
Copy-Item -Recurse -Path "$destinationDir" -Destination "$modulePath\." -Verbose -Force
122-
}
127+
Write-Progress "Installing to $modulePath"
128+
Copy-Item -Recurse -Path "$destinationDir" -Destination "$modulePath\." -Force
129+
}

0 commit comments

Comments
 (0)