diff --git a/.Build.ps1 b/.Build.ps1 new file mode 100644 index 0000000..87add76 --- /dev/null +++ b/.Build.ps1 @@ -0,0 +1,52 @@ +#Requires -Modules InvokeBuild + +task BuildModule { + Remove-Module Microsoft.PowerShell.PSResourceGet -ErrorAction SilentlyContinue + Import-Module Microsoft.PowerShell.PSResourceGet -ErrorAction Stop + + $Author = 'Tony Sathre' + $CompanyName = 'Tony Sathre' + $Description = 'This module is used to automate the deployment of Citrix virtual desktops in a Citrix Virtual Apps & Desktops environment.' + $ModuleVersion = '2.0.0.0' + $Copyright = "(c) {0} ${Author}. All rights reserved." -f (Get-Date -Format 'yyyy') + $ProjectUri = 'https://github.com/tonysathre/CitrixAutodeploy' + + $BasePath = "${PSScriptRoot}\module\CitrixAutodeploy" + $NestedModules = Get-ChildItem -Recurse ${BasePath}\functions\*.ps1 | ForEach-Object { ".\functions\$(Split-Path -Leaf $_.Directory)\$($_.Name)" } + $FunctionsToExport = (Get-ChildItem ${BasePath}\functions\public\*.ps1).Name -replace '\.ps1$' + $RequiredModules = @('PoShLog') + $ScriptsToProcess = @('.\functions\private\Initialize-InternalLogger.ps1') + $VariablesToExport = @('InternalLogger') + + $ModuleManifest = @{ + Author = $Author + CompanyName = $CompanyName + Description = $Description + Copyright = $Copyright + ProjectUri = $ProjectUri + ModuleVersion = $ModuleVersion + Path = "${BasePath}\CitrixAutodeploy.psd1" + FunctionsToExport = $FunctionsToExport + NestedModules = $NestedModules + RequiredModules = $RequiredModules + ScriptsToProcess = $ScriptsToProcess + VariablesToExport = $VariablesToExport + } + + Update-PSModuleManifest @ModuleManifest +} + +task Test { + $Pester = Get-Command -Name 'Invoke-Pester' -ErrorAction SilentlyContinue + if (-not $Pester) { + Install-Module -Name 'Pester' -RequiredVersion '5.5.0' -Force -Scope CurrentUser + } + + try { + $PesterResult = Invoke-Pester -Path "${PSScriptRoot}\tests" -CI + $PesterResult.FailedCount + } + catch { + throw $_ + } +}