Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PSKoans/PSKoans.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
@{
ModuleName = 'Pester'
ModuleVersion = '5.0.2'
MaximumVersion = '5.999.999'
}
)

Expand Down
17 changes: 13 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[ArgumentCompleter( {
param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams)
try {
Get-PSakeScriptTasks -BuildFile (Join-Path $PSScriptRoot 'psakeFile.ps1') -ErrorAction 'Stop' |

Check warning on line 27 in build.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (psake) Suggestions: (spake, sake, pase, spae, passe)
Where-Object { $_.Name -like "$WordToComplete*" } |
Select-Object -ExpandProperty 'Name'
}
Expand All @@ -40,8 +40,12 @@

$ErrorActionPreference = 'Stop'
$requirementsFile = Join-Path $PSScriptRoot 'requirements.psd1'
$psakeFile = Join-Path $PSScriptRoot 'psakeFile.ps1'

Check warning on line 43 in build.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (psake) Suggestions: (spake, sake, pase, spae, passe)

Check warning on line 43 in build.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (psake) Suggestions: (spake, sake, pase, spae, passe)

$requirements = Import-PowerShellDataFile -Path $requirementsFile
$pesterRequirement = $requirements.Pester
$requirements.Remove('Pester')

if ($Bootstrap) {
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser | Out-Null
Expand All @@ -50,19 +54,24 @@
if (-not (Get-Module -Name PSDepend -ListAvailable)) {
Install-Module -Name PSDepend -Repository PSGallery -Scope CurrentUser -Force -RequiredVersion '0.3.8'
}
Import-Module -Name PSDepend -Verbose:$false
Invoke-PSDepend -Path $requirementsFile -Install -Import -Force -WarningAction SilentlyContinue
}
else {
Invoke-PSDepend -Path $requirementsFile -Import -Force -WarningAction SilentlyContinue

Import-Module -Name PSDepend -Verbose:$false
if ($Bootstrap) {
Invoke-PSDepend -Path $requirementsFile -Install -Force -WarningAction SilentlyContinue
}

# PowerShellBuild requires Pester without an upper bound. Load the pinned version
# first, then import the remaining dependencies without re-importing Pester.
Import-Module -Name Pester -RequiredVersion $pesterRequirement.Version
Invoke-PSDepend -InputObject $requirements -Import -Force -WarningAction SilentlyContinue

if ($PSCmdlet.ParameterSetName -eq 'Help') {
Get-PSakeScriptTasks -BuildFile $psakeFile |

Check warning on line 70 in build.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (psake) Suggestions: (spake, sake, pase, spae, passe)
Format-Table -Property Name, Description, Alias, DependsOn
}
else {
Set-BuildEnvironment -Force
Invoke-Psake -BuildFile $psakeFile -TaskList $Task -NoLogo

Check warning on line 75 in build.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (psake) Suggestions: (spake, sake, pase, spae, passe)

Check warning on line 75 in build.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (Psake) Suggestions: (spake, sake, pase, spae, passe)
exit ([int](-not $psake.build_success))
}
26 changes: 26 additions & 0 deletions psakeFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,44 @@
$PSBPreference.Test.ScriptAnalysis.FailBuildOnSeverityLevel = 'Error'
$PSBPreference.Test.CodeCoverage.Enabled = $false

$PSBPreference.Publish.PSRepositoryApiKey = $env:PSGALLERY_API_KEY

Check warning on line 18 in psakeFile.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (PSGALLERY) Suggestions: (psaltery, spaller, psaltry, psalter, psalters)
}

# The module manifest's FormatsToProcess entry (PSKoans.format.ps1xml) is generated
# from ./formatting via EZOut and is gitignored -- it must exist before the module
# can be imported at all, so generate it ahead of staging.
Task GenerateFormatData -Depends Clean {
& (Join-Path $PSBPreference.General.ProjectRoot 'PSKoans.ezformat.ps1')

Check warning on line 25 in psakeFile.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (ezformat) Suggestions: (format, effort)
} -Description 'Generates PSKoans.format.ps1xml from ./formatting'

$PSBStageFilesDependency = @('Clean', 'GenerateFormatData')
$PSBBuildDependency = @('StageFiles')
$PSBTestDependency = @('Pester5', 'Analyze')

Task Pester5 -Depends $PSBBuildDependency {
$moduleManifest = Join-Path $PSBPreference.Build.ModuleOutDir "$($PSBPreference.General.ModuleName).psd1"

Import-Module -Name $moduleManifest -Force
Push-Location -LiteralPath $PSBPreference.Test.RootDir
try {
$configuration = [PesterConfiguration]::Default
$configuration.Output.Verbosity = 'Detailed'
$configuration.Run.PassThru = $true
$configuration.TestResult.Enabled = $true
$configuration.TestResult.OutputPath = $PSBPreference.Test.OutputFile
$configuration.TestResult.OutputFormat = $PSBPreference.Test.OutputFormat

$testResult = Invoke-Pester -Configuration $configuration
if ($testResult.Result -eq 'Failed') {
throw 'One or more Pester tests failed.'
}
}
finally {
Pop-Location
Remove-Module -Name $PSBPreference.General.ModuleName -ErrorAction SilentlyContinue
}
} -Description 'Executes Pester 5 tests'


Task Default -Depends Test

Expand All @@ -40,7 +66,7 @@
# - Test
# - BuildHelp
# - GenerateMarkdown
# - GenerateMAML

Check warning on line 69 in psakeFile.ps1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (MAML) Suggestions: (malm, mail, mall, mama, mams)
# - GenerateUpdatableHelp
# - Publish
Task Test -FromModule PowerShellBuild -MinimumVersion '0.7.3'
7 changes: 4 additions & 3 deletions requirements.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
PSDependOptions = @{
Target = 'CurrentUser'
}
'psake' = @{

Check warning on line 5 in requirements.psd1

View workflow job for this annotation

GitHub Actions / ci / Run Linters

Unknown word (psake) Suggestions: (spake, sake, pase, spae, passe)
Version = '4.9.1'
}
'PowerShellBuild' = @{
Version = '0.7.3'
}
'Pester' = @{
Version = '5.9.0'
Parameters = @{
SkipPublisherCheck = $true
}
}
'PowerShellBuild' = @{
Version = '0.8.2'
}
'PSScriptAnalyzer' = @{
Version = '1.19.1'
}
Expand Down
Loading