Building Out Build Items

This commit is contained in:
Wes Carroll
2019-03-28 09:13:38 -04:00
parent dbc6086fee
commit 830f5633b5
3 changed files with 102 additions and 6 deletions
+50
View File
@@ -0,0 +1,50 @@
@{
psake = @{
Name = 'InvokeBuild'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '5.4.3'
Tags = 'Bootstrap'
}
Pester = @{
Name = 'Pester'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '4.6.0'
Tags = 'Test'
}
PSScriptAnalyzer = @{
Name = 'PSScriptAnalyzer'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '1.17.1'
Tags = 'Test'
}
Platyps = @{
Name = 'Platyps'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '0.12.0'
Tags = 'Build'
}
}
+36 -6
View File
@@ -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
}
+16
View File
@@ -0,0 +1,16 @@
# Bootstrap the environment
$null = Get-PackageProvider -Name NuGet -ForceBootstrap
if (-not (Get-Module -Name PSDepend -ListAvailable)) {
Install-Module -Name PSDepend -Scope CurrentUser -Force -Confirm:$false
}
Import-Module -Name PSDepend
Invoke-PSDepend `
-Path $PSScriptRoot `
-Force `
-Import `
-Install `
-Tags 'Bootstrap'
Invoke-Build .