Skip to content

Commit 1cc7e60

Browse files
authored
Create ci.yml
1 parent 726b4ef commit 1cc7e60

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
Testing:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Install PSScriptAnalyzer module
13+
shell: pwsh
14+
run: |
15+
Set-PSRepository PSGallery -InstallationPolicy Trusted
16+
Install-Module PSScriptAnalyzer -ErrorAction Stop
17+
- name: Lint with PSScriptAnalyzer
18+
shell: pwsh
19+
run: |
20+
Invoke-ScriptAnalyzer -Path . -Recurse -Outvariable issues
21+
$issues | ConvertTo-Json -Depth 2 | Set-Content -Path '${{ github.workspace }}/pssa.json'
22+
$errors = $issues.Where({$_.Severity -eq 'Error'})
23+
$warnings = $issues.Where({$_.Severity -eq 'Warning'})
24+
if ($errors) {
25+
Write-Error "There were $($errors.Count) errors and $($warnings.Count) warnings total." -ErrorAction Stop
26+
} else {
27+
Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total."
28+
}
29+
- name: Upload test results
30+
uses: actions/upload-artifact@v2
31+
with:
32+
name: pssa-results
33+
path: ${{ github.workspace }}/pssa.json
34+
# - name: Test with Pester
35+
# shell: pwsh
36+
# run: Invoke-Pester Unit.Tests.ps1 -Passthru | Export-CliXml -Path Unit.Tests.xml

0 commit comments

Comments
 (0)