Repository navigation
Expand file tree
/
Copy pathpsakeBuild.ps1
More file actions
61 lines (42 loc) · 1.64 KB
/
Copy pathpsakeBuild.ps1
File metadata and controls
61 lines (42 loc) · 1.64 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Properties {
$me = ($PSScriptRoot | Split-Path -leaf) -replace '^Module_'
$manifest = Join-Path $PSScriptRoot "$me/$me.psd1" | Convert-Path
$files = Get-ChildItem (Join-Path $PSScriptRoot $me) -recurse -file
$simpleTestFiles = Get-ChildItem -path (
Join-Path $PSScriptRoot $me/_test/Test-*
) -file -errorAction SilentlyContinue
}
task default -depends Deploy
task Deploy -depends Clean, Bump `
-description 'Deploys module to run-time locations' {
Invoke-PSDeploy -path (Join-Path $PSScriptRoot Module.psdeploy.ps1) `
-force -verbose:$VerbosePreference
}
task Clean -description 'Helper to clean build artifacts' {
# Clean only build artefacts
# Deployment artifacts should be cleaned in module.psdeploy.ps1
}
task Bump -description 'Bumps build version of module' {
Step-ModuleVersion -path $manifest
}
task Analyze {
foreach( $1file in $files.FullName ) {
$saResults = Invoke-ScriptAnalyzer -path $1file `
-severity 'Error','Warning' -recurse -verbose:$False
if ($saResults) {
$saResults | Format-Table
'One or more Script Analyzer errors/warnings where found.
Build cannot continue!' -replace '\n\s*',' ' | Write-Error
}
}
}
task Test -description 'Helper to run Pester tests' {
$testResults = Invoke-Pester -path $PSScriptRoot -passThru
if ($testResults.FailedCount -gt 0) {
$testResults | Format-List
'One or more Pester tests failed. Build cannot continue!' | Write-Error
}
}
task ? -description "Helper to display task info" {
Write-Documentation
}