-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.31 KB
/
test.yml
File metadata and controls
51 lines (43 loc) · 1.31 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
name: Test
on:
push:
branches: [root]
pull_request:
branches: [root]
workflow_dispatch:
defaults:
run:
shell: pwsh
jobs:
test:
name: Validate
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Install
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module -Name Pester -Scope CurrentUser
Install-Module -Name PSScriptAnalyzer -Scope CurrentUser
- name: Lint
run: |
$excludedRules = @(
'PSAvoidUsingConvertToSecureStringWithPlainText'
)
$results = Invoke-ScriptAnalyzer -ExcludeRule $excludedRules -Path .\rcgmsa.ps1 -Severity Error
if ($results) {
$results | Format-Table
Write-Error 'PSScriptAnalyzer found issues. Please fix them.' -ErrorAction Stop
} else {
Write-Host 'PSScriptAnalyzer passed.'
}
- name: Test
run: |
$config = New-PesterConfiguration
$config.Output.Verbosity = 'Detailed'
$config.Run.Exit = $true
$config.Run.Path = '.\tests'
$config.Should.ErrorAction = 'Continue'
$config.TestResult.Enabled = $true
Invoke-Pester -Configuration $config