-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (58 loc) · 1.92 KB
/
Copy pathpowershell-checks.yml
File metadata and controls
66 lines (58 loc) · 1.92 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
62
63
64
65
66
name: Check PowerShell scripts
on:
workflow_call:
jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
shell: pwsh
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run code quality tests
uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f
with:
path: ./scripts
recurse: true
enableExit: true
severity: '"Error", "Warning"'
settings: ./.config/PSScriptAnalyzerSettings.psd1
output: powershell-checks.sarif
- name: Upload code quality results
uses: github/codeql-action/upload-sarif@v3
if: ${{ !cancelled() }}
with:
sarif_file: powershell-checks.sarif
category: powershell-checks
- name: Run unit tests
if: ${{ !cancelled() }}
run: |
Invoke-Pester -Configuration $(New-PesterConfiguration -Hashtable $(
Import-PowerShellDataFile ./.config/PesterSettings.psd1
))
- name: Report unit test results
uses: dorny/test-reporter@dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3
if: ${{ !cancelled() }}
with:
name: Powershell unit test results
path: ./scripts/TestResults.xml
reporter: jest-junit
- name: Summarise code coverage
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95
if: ${{ !cancelled() }}
with:
filename: ./scripts/Coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: "80 80"
- name: Report code coverage
if: ${{ !cancelled() }}
run: |
$content = Get-Content code-coverage-results.md
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $content