diff --git a/.gitmodules b/.gitmodules index 17765f6837..c677d18caf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/.spelling b/.spelling index c988a22694..2f27db0e95 100644 --- a/.spelling +++ b/.spelling @@ -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 diff --git a/.travis.yml b/.travis.yml index 389e2c5209..81cc91c7f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/build.psm1 b/build.psm1 index a51eb6d47b..9a4b93cc45 100644 --- a/build.psm1 +++ b/build.psm1 @@ -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 { diff --git a/src/Modules/Shared/Pester b/src/Modules/Shared/Pester deleted file mode 160000 index aa243108e7..0000000000 --- a/src/Modules/Shared/Pester +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aa243108e7da50a8cf82513b6dd649b653c70b0e diff --git a/src/powershell-unix/powershell-unix.csproj b/src/powershell-unix/powershell-unix.csproj index 38116a8200..947af70723 100644 --- a/src/powershell-unix/powershell-unix.csproj +++ b/src/powershell-unix/powershell-unix.csproj @@ -11,7 +11,7 @@ - + Modules\%(RecursiveDir)\%(FileName)%(Extension) PreserveNewest PreserveNewest diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index 95313f35da..f6c2d9c5c2 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -14,7 +14,7 @@ PowerShellProperties.json PreserveNewest - + Modules\%(RecursiveDir)\%(FileName)%(Extension) PreserveNewest PreserveNewest diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index dd7b069e2c..aae4c4510e 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -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 diff --git a/tools/travis.ps1 b/tools/travis.ps1 index 5e4ecf0a43..d94d3403bc 100644 --- a/tools/travis.ps1 +++ b/tools/travis.ps1 @@ -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 } }