Building Out Build Items
This commit is contained in:
@@ -1,17 +1,44 @@
|
||||
task . InstallDependencies, Analyze
|
||||
#Requires -Modules 'InvokeBuild'
|
||||
|
||||
task InstallDependencies {
|
||||
Install-Module Pester -Force
|
||||
Install-Module PSScriptAnalyzer -Force
|
||||
. '.\ZertoApiWrapper.settings.ps1'
|
||||
# import-module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -Verbose -Force
|
||||
|
||||
<# [CmdletBinding()]
|
||||
param([switch]$Install,
|
||||
[string]$Configuration = (property Configuration Release))
|
||||
$targetDir = "temp/$Configuration/ZertoApiWrapper" #>
|
||||
|
||||
task . Analyze, FileTests
|
||||
|
||||
<# Synopsis: Ensure platyPS is installed #>
|
||||
task CheckPlatyPSInstalled {
|
||||
if ($null -eq (Get-Module -List platyPS)) {
|
||||
Install-Module -Scope CurrentUser -Repository PSGallery -Name platyPS
|
||||
}
|
||||
}
|
||||
|
||||
task Analyze {
|
||||
<# Synopsis: Ensure Pester is installed #>
|
||||
task CheckPesterInstalled {
|
||||
if ($null -eq (Get-Module -List Pester)) {
|
||||
Install-Module -Scope CurrentUser -Repository PSGallery -Name Pester
|
||||
}
|
||||
}
|
||||
|
||||
<# Synopsis: Ensure PSScriptAnalyzer is installed #>
|
||||
task CheckPSScriptAnalyzerInstalled {
|
||||
if ($null -eq (Get-Module -List PSScriptAnalyzer)) {
|
||||
Install-Module -Scope CurrentUser -Repository PSGallery -Name PSScriptAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
<# Synopsis: Analyze ZertoApiWrapper functions for Code Violations #>
|
||||
task Analyze CheckPSScriptAnalyzerInstalled, CheckPesterInstalled, CheckPlatyPSInstalled, {
|
||||
$scriptAnalyzerParams = @{
|
||||
Path = "$BuildRoot\ZertoApiWrapper\"
|
||||
Severity = @('Error', 'Warning')
|
||||
Recurse = $true
|
||||
Verbose = $false
|
||||
ExcludeRule = 'PSUseDeclaredVarsMoreThanAssignments'
|
||||
ExcludeRule = @('PSUseDeclaredVarsMoreThanAssignments', 'PSUseShouldProcessForStateChangingFunctions')
|
||||
}
|
||||
$saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams
|
||||
|
||||
@@ -21,3 +48,6 @@ task Analyze {
|
||||
}
|
||||
}
|
||||
|
||||
task FileTests CheckPesterInstalled, {
|
||||
Invoke-Pester "$BuildRoot\Tests\Public\ZertoApiWrapper.Tests.ps1" -Show Fails
|
||||
}
|
||||
Reference in New Issue
Block a user