build: unbundle pester (#5623)

* remove pester module

* restore Pester as a module only in CI build from the git repo

* mark appveyor builds as CI builds

* remove pester exclusions

* mark travis builds as ci

* exclude publish folder from spell check

* do not run spell check on publish folder
This commit is contained in:
Travis Plunk 2017-12-04 17:16:53 -08:00 committed by Aditya Patwardhan
parent b039daf6f4
commit 25617f15c2
9 changed files with 66 additions and 194 deletions

5
.gitmodules vendored
View file

@ -1,8 +1,3 @@
[submodule "src/Modules/Pester"]
path = src/Modules/Shared/Pester
url = https://github.com/PowerShell/psl-pester.git
branch = develop
ignore = dirty
[submodule "src/libpsl-native/test/googletest"]
path = src/libpsl-native/test/googletest
url = https://github.com/google/googletest.git

178
.spelling
View file

@ -1032,184 +1032,6 @@ psd1
psm1
#endregion
#region src/Modules/Shared/Pester/CHANGELOG.md Overrides
- src/Modules/Shared/Pester/CHANGELOG.md
_be
AfterAll
AfterEach
ArgumentList
Assert-MockCalled
BeExactly
BeforeAll
BeforeEach
BeGreaterThan
BeLessThan
BeNullOrEmpty
BeOfType
beta2
cleanup
CodeCoverage
DisableOldStyleAssertions
dynamicparam
eg
EnableExit
EnableLegacyAssertions
EnableLegacyExpectations
ErrorAction
ExcludeTagFilter
ExclusiveFilter
ExecutionContext
ExecutionPolicy
FunctionName
fynctions
GetDynamicParameters
Get-MockDynamicParameters
Get-TestDriveItem
GH-100
GH-102
GH-107
GH-109
GH-113
GH-114
GH-123
GH-125
GH-126
GH-129
GH-13
GH-130
GH-134
GH-135
GH-136
GH-137
GH-139
GH-143
GH-144
GH-147
GH-148
GH-149
GH-150
GH-152
GH-155
GH-156
GH-158
GH-163
GH-164
GH-165
GH-166
GH-167
GH-168
GH-171
GH-172
GH-174
GH-176
GH-183
GH-185
GH-186
GH-187
GH-188
GH-19
GH-190
GH-192
GH-195
GH-200
GH-203
GH-209
GH-215
GH-223
GH-232
GH-234
GH-249
GH-254
GH-26
GH-266
GH-267
GH-27
GH-272
GH-274
GH-276
GH-278
GH-281
GH-290
GH-295
GH-304
GH-306
GH-307
GH-322
GH-323
GH-324
GH-326
GH-327
GH-333
GH-341
GH-346
GH-35
GH-354
GH-358
GH-362
GH-368
GH-37
GH-38
GH-39
GH-40
GH-42
GH-46
GH-49
GH-50
GH-52
GH-58
GH-61
GH-68
GH-69
GH-70
GH-71
GH-84
GH-86
GH-9
GH-90
GH-92
GH-94
GH-95
GH-98
GH-99
InModuleScope
Invoke-Pester's
ISESteroids
LegacyNUnitXml
ModuleName
MyInvocation
nuget.exe
OutputFile
OutputFormat
OutputXml
ParameterFilter
PassThru
Passthu
pester.bat
Pester.bat
PesterException
PesterThrowFailureMessage
PSCommandPath
PSv3
should.not
ShouldArgs
StrictMode
TestName
Tests.ps1.
v2
v3
v3.0
Validate-Xml
Write-UsageForNewFixture
#endregion
#region src/Modules/Shared/Pester/README.md Overrides
- src/Modules/Shared/Pester/README.md
hoc
pester-bdd-for-the-system-administrator
powershell-bdd-testing-pester-screencast
v1.0.
#endregion
#region src/powershell/README.md Overrides
- src/powershell/README.md
powershell-unix

View file

@ -39,8 +39,9 @@ install:
script:
- pwsh -File tools/travis.ps1
# spellcheck
# Ignore publish folders because they have 3rd party files
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
mdspell '**/*.md' '!powershell/**/*.md' --ignore-numbers --ignore-acronyms --report;
mdspell '**/*.md' '!**/publish/**/*.md' --ignore-numbers --ignore-acronyms --report;
fi
after_failure:

View file

@ -351,6 +351,7 @@ function Start-PSBuild {
[switch]$TypeGen,
[switch]$Clean,
[switch]$PSModuleRestore,
[switch]$CI,
# this switch will re-build only System.Management.Automation.dll
# it's useful for development, to do a quick changes in the engine
@ -590,7 +591,7 @@ Fix steps:
# - PowerShellGet, PackageManagement, Microsoft.PowerShell.Archive
if($PSModuleRestore)
{
Restore-PSModuleToBuild -PublishPath $publishPath
Restore-PSModuleToBuild -PublishPath $publishPath -CI:$CI.IsPresent
}
}
@ -599,7 +600,9 @@ function Restore-PSModuleToBuild
param(
[Parameter(Mandatory)]
[string]
$PublishPath
$PublishPath,
[Switch]
$CI
)
$ProgressPreference = "SilentlyContinue"
@ -613,8 +616,12 @@ function Restore-PSModuleToBuild
'PowerShellGet'
'Microsoft.PowerShell.Archive'
) -SourceLocation "https://www.powershellgallery.com/api/v2/"
}
if($CI.IsPresent)
{
Restore-GitModule -Destination $modulesDir -Uri 'https://github.com/PowerShell/psl-pester' -Name Pester -CommitSha 'aa243108e7da50a8cf82513b6dd649b653c70b0e'
}
}
function Compress-TestContent {
[CmdletBinding()]
param(
@ -2320,6 +2327,54 @@ function Clear-PSRepo
}
}
# Install PowerShell modules from a git Repo such as PSL-Pester
function Restore-GitModule
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Name,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Uri,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Destination,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$CommitSha
)
log 'Restoring module from git repo:'
log ("Name='{0}', Destination='{1}', Uri='{2}', CommitSha='{3}'" -f $Name, $Destination, $Uri, $CommitSha)
$clonePath = Join-Path -Path $Destination -ChildPath $Name
if(Test-Path $clonePath)
{
remove-Item -Path $clonePath -recurse -force
}
$null = Start-NativeExecution {git clone --quiet $uri $clonePath}
Push-location $clonePath
try {
$null = Start-NativeExecution {git checkout -b desiredCommit $CommitSha} -SuppressOutput
$gitItems = Join-Path -Path $clonePath -ChildPath '.git*'
$ymlItems = Join-Path -Path $clonePath -ChildPath '*.yml'
Get-ChildItem -Path $gitItems, $ymlItems | Remove-Item -Recurse -Force
}
finally
{
pop-location
}
}
# Install PowerShell modules such as PackageManagement, PowerShellGet
function Restore-PSModule
{

@ -1 +0,0 @@
Subproject commit aa243108e7da50a8cf82513b6dd649b653c70b0e

View file

@ -11,7 +11,7 @@
<ItemGroup>
<Compile Include="..\powershell\Program.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />
<Content Include="..\Modules\Unix\**\*;..\Modules\Shared\**\*" Exclude="..\Modules\Shared\Pester\.git*;..\Modules\Shared\Pester\*.yml">
<Content Include="..\Modules\Unix\**\*;..\Modules\Shared\**\*" >
<Link>Modules\%(RecursiveDir)\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>

View file

@ -14,7 +14,7 @@
<Link>PowerShellProperties.json</Link>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="..\Modules\Windows-Core\**\*;..\Modules\Windows-Core+Full\**\*;..\Modules\Shared\**\*" Exclude="..\Modules\Shared\Pester\.git*;..\Modules\Shared\Pester\*.yml">
<Content Include="..\Modules\Windows-Core\**\*;..\Modules\Windows-Core+Full\**\*;..\Modules\Shared\**\*">
<Link>Modules\%(RecursiveDir)\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>

View file

@ -178,10 +178,10 @@ function Invoke-AppVeyorBuild
if(Test-DailyBuild)
{
Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -ReleaseTag $releaseTag
Start-PSBuild -Configuration 'CodeCoverage' -PSModuleRestore -CI -ReleaseTag $releaseTag
}
Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -ReleaseTag $releaseTag
Start-PSBuild -CrossGen -PSModuleRestore -Configuration 'Release' -CI -ReleaseTag $releaseTag
}
# Implements the AppVeyor 'install' step

View file

@ -195,7 +195,7 @@ elseif($Stage -eq 'Build')
$ProgressPreference = 'SilentlyContinue'
try {
## We use CrossGen build to run tests only if it's the daily build.
Start-PSBuild -CrossGen -PSModuleRestore -ReleaseTag $releaseTag
Start-PSBuild -CrossGen -PSModuleRestore -CI -ReleaseTag $releaseTag
}
finally{
$ProgressPreference = $originalProgressPreference
@ -277,7 +277,7 @@ elseif($Stage -eq 'Build')
if ($IsLinux)
{
# Create and package Raspbian .tgz
Start-PSBuild -Clean -Runtime linux-arm
Start-PSBuild -PSModuleRestore -Clean -Runtime linux-arm
Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks
}
}