-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpsakeBuild.ps1
More file actions
29 lines (25 loc) · 1019 Bytes
/
Copy pathpsakeBuild.ps1
File metadata and controls
29 lines (25 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
properties {
$script = "$PSScriptRoot\PoshCiphers\PoshCiphers.psm1"
}
# Default task includes Analyzing and Testing of script
task default -depends Analyze, Test
# Analyze by running Invoke-ScriptAnalyzer. Check script against best known practices
task Analyze {
$saResults = Invoke-ScriptAnalyzer -Path $script -Severity @('Error', 'Warning') -Recurse -Verbose:$false
if ($saResults) {
$saResults | Format-Table
Write-Error -Message 'One or more Script Analyzer errors/warnings where found. Build cannot continue!'
}
}
# Run our test to make sure everything is in line
task Test {
$testResults = Invoke-Pester -Path $PSScriptRoot\Tests -PassThru
if ($testResults.FailedCount -gt 0) {
$testResults | Format-List
Write-Error -Message 'One or more Pester tests failed. Build cannot continue!'
}
}
# Run a deployment script after appropriate tests are passed
task Deploy -depends Analyze, Test {
Invoke-PSDeploy -Path '.\PoshCiphers.psdeploy.ps1' -Force -Verbose:$VerbosePreference
}