-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (51 loc) · 1.58 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
# Allow manually triggering of the workflow.
workflow_dispatch: {}
env:
MODULE_NAME: WinGet-Essentials
jobs:
test:
name: Run Tests
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PSScriptAnalyzer
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module PSScriptAnalyzer -ErrorAction Stop
- name: Lint with PSScriptAnalyzer
shell: pwsh
run: |
Invoke-ScriptAnalyzer -Path "$env:MODULE_NAME" -Recurse -OutVariable issues
$errors = $issues.Where({$_.Severity -eq 'Error'})
$warnings = $issues.Where({$_.Severity -eq 'Warning'})
if ($errors) {
Write-Error "There were $($errors.Count) errors and $($warnings.Count) warnings total." -ErrorAction Stop
} else {
Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total."
}
- name: Test Manifest
shell: pwsh
run: |
. .github/workflows/workaround.ps1
Push-Location
Set-Location $env:MODULE_NAME
Build-RequiredModuleFiles
Pop-Location
Test-ModuleManifest "$env:MODULE_NAME/$env:MODULE_NAME.psd1" -Verbose
if (-not($?)) {
Write-Error "Manifest validation failed." -ErrorAction Stop
}
- name: Test Module
shell: pwsh
run: |
Invoke-Pester