-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.ps1
55 lines (45 loc) · 1.18 KB
/
build.ps1
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
[CmdletBinding()]
param($Task = 'Default')
$ProgressPreference = 'SilentlyContinue'
$Script:Modules = @(
'BuildHelpers',
'InvokeBuild',
'Pester',
'platyPS',
'PSScriptAnalyzer',
'DependsOn'
)
$Script:ModuleInstallScope = 'CurrentUser'
'Starting build...'
'Installing module dependencies...'
Get-PackageProvider -Name 'NuGet' -ForceBootstrap | Out-Null
foreach ( $module in $Modules )
{
" Installing [$module]"
$install = Find-Module $module -ErrorAction Stop | Sort-Object Repository | Select-Object -First 1
$installed = $install | Install-Module -Force -SkipPublisherCheck -AllowClobber -AcceptLicense -Scope $Script:ModuleInstallScope -ErrorAction Stop
$installed | Import-Module -ErrorAction Stop
$installed
}
Set-BuildEnvironment
Get-ChildItem Env:BH*
Get-ChildItem Env:APPVEYOR*
$Error.Clear()
'Invoking build'
try
{
Invoke-Build $Task -Result 'Result'
}
catch
{
if ($Result.Error)
{
"Exception Details"
$Error[-1] | Format-List -Force
}
"Attempting module import to get better error message for common issues"
$path = Resolve-Path './Output/*/*.psd1'
Import-Module $path -Verbose -Force
exit 1
}
exit 0