forked from OCram85/PSCredentialStore
Marco Blessing
afab3c870c
## About This pull request reflects all changes done in the `linuxsupport` branch. ## Content - Enable PowerShell 6 Core support - Use PFX Certificate for encryption ( fixes #32 ) - Updates CI / CD pipeline ( fixes #31 ) - uses portable libressl ( fixes #34 ) - adds `-PassThru` switch for returning current `VIServer` session in `Connect-To` ( fixes #34 ) - adds git lfs for embedded libressl files - restructured internal functions into `Private` dir - added certificate related functions - adds travis build pipeline for tests
67 lines
2.6 KiB
PowerShell
67 lines
2.6 KiB
PowerShell
$Global:ProgressPreference = 'SilentlyContinue'
|
|
|
|
$CALLSIGN = 'PSCredentialStore'
|
|
Write-Host ("Callsign is: {0}" -f $CALLSIGN) -ForegroundColor Black -BackgroundColor Yellow
|
|
|
|
function Invoke-InstallDependencies {
|
|
[CmdletBinding()]
|
|
Param()
|
|
|
|
process {
|
|
try {
|
|
Write-Host '===== Environment Vars: =====' -ForegroundColor Black -BackgroundColor Yellow
|
|
Get-ChildItem -Path Env:
|
|
|
|
Write-Host -Message '===== Existing Variables: =====' -ForegroundColor Black -BackgroundColor Yellow
|
|
Get-Variable -Name * | Format-Table -AutoSize
|
|
|
|
Get-PackageProvider -ListAvailable
|
|
Import-PackageProvider -Name 'NuGet' -MinimumVersion '2.8.5.208' -Verbose -Force
|
|
|
|
Install-Module -Name 'Pester' -Scope CurrentUser -RequiredVersion '4.4.2' -Force -SkipPublisherCheck -AllowClobber -Verbose
|
|
Install-Module -Name 'posh-git' -Scope CurrentUser -RequiredVersion '1.0.0-beta2' -Force -SkipPublisherCheck -AllowClobber -AllowPrerelease -Verbose
|
|
|
|
Import-Module -Name 'Pester', 'posh-git' -Verbose
|
|
}
|
|
catch {
|
|
$_.Exception.Message | Write-Error
|
|
throw 'Could not install the required dependencies!'
|
|
}
|
|
}
|
|
}
|
|
|
|
function Invoke-UnitTests {
|
|
[CmdletBinding()]
|
|
Param()
|
|
|
|
process {
|
|
|
|
try {
|
|
Write-Host '===== Preload internal private functions =====' -ForegroundColor Black -BackgroundColor Yellow
|
|
|
|
$Privates = Get-ChildItem -Path (Join-Path -Path $Env:TRAVIS_BUILD_DIR -ChildPath '/src/Private/*') -Include "*.ps1" -Recurse -ErrorAction Stop
|
|
foreach ($File in $Privates) {
|
|
if (Test-Path -Path $File.FullName) {
|
|
. $File.FullName
|
|
Write-Verbose -Message ('Private function dot-sourced: {0}' -f $File.FullName) -Verbose
|
|
}
|
|
else {
|
|
Write-Warning -Message ('Could not find file: {0} !' -f $File.FullName)
|
|
}
|
|
}
|
|
}
|
|
catch {
|
|
$_.Exception.Message | Write-Error
|
|
throw 'Could not load required private functions!'
|
|
}
|
|
|
|
Write-Host '===== Running Pester =====' -ForegroundColor Black -BackgroundColor Yellow
|
|
$TestFiles = Get-ChildItem -Path (Join-Path -Path '.' -ChildPath './tests/*.Tests.ps1') -Recurse| Sort-Object -Property Name
|
|
$TestResults = Invoke-Pester -Script $TestFiles -ExcludeTag 'Disabled' -PassThru
|
|
|
|
if ($TestResults.FailedCount -gt 0) {
|
|
throw ('{0} tests failed!' -f $TestResults.FailedCount)
|
|
}
|
|
}
|
|
}
|