-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.ps1
56 lines (41 loc) · 1.19 KB
/
entrypoint.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
56
Param(
[string]
[Parameter(Mandatory=$true)]
$Path,
[string[]]
$Files,
[string[]]
$Tests,
[string[]]
$Skips
)
Set-Location /arm-ttk/arm-ttk
# Get-ChildItem *.ps1, *.psd1, *.ps1xml, *.psm1 -Recurse | Unblock-File
Import-Module ./arm-ttk.psd1
Set-Location /
$command = "Test-AzTemplate -TemplatePath $env:GITHUB_WORKSPACE/$Path"
if (($Files -ne $null) -and ($Files.Length -gt 0))
{
$command += " -File $Files"
}
if (($Tests -ne $null) -and ($Tests.Length -gt 0))
{
$command += " -Test $Tests"
}
if (($Skips -ne $null) -and ($Skips.Length -gt 0))
{
$command += " -Skip $Skips"
}
$results = Invoke-Expression "& $command"
$results
$milliseconds = @{ Label = "Milliseconds"; Expression = { $_.Timespan.Milliseconds } }
$filepath = @{ Label = "Filepath"; Expression = { $_.File.FullPath.Replace("$env:GITHUB_WORKSPACE/", "") } }
$output = $results | `
Select-Object -Property Errors, Warnings, Output, AllOutput, Passed, Group, Name, $milliseconds, $filepath | `
ConvertTo-Json -Compress
$output
Write-Output "::set-output name=results::$output"
Remove-Variable output
Remove-Variable filepath
Remove-Variable milliseconds
Remove-Variable results