-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 2.22 KB
/
Copy pathpowershell-ci.yml
File metadata and controls
59 lines (48 loc) · 2.22 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
name: PowerShell CI
on:
push:
branches:
- 'v1_specsdev'
- '001-create-a-powershell'
- 'feature/**'
pull_request:
branches:
- 'v1_specsdev'
- 'main'
jobs:
lint-and-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: List tests directory contents
run: |
ls -l tests
- name: Install PSScriptAnalyzer and Pester
run: |
Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser -AcceptLicense
Install-Module -Name Pester -MinimumVersion 5.0.0 -Force -Scope CurrentUser -AcceptLicense
- name: Enforce no absolute paths in scripts
run: |
pwsh -NoProfile -Command "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass; ./scripts/check-absolute-paths.ps1 -Path ."
- name: Run PSScriptAnalyzer on module
run: |
pwsh -NoProfile -Command "Invoke-ScriptAnalyzer -Path ./PSSpecKit -Recurse -Settings .psscriptanalyzer.psd1"
- name: Verify module can be imported
run: |
pwsh -NoProfile -Command "Import-Module ./PSSpecKit/PSSpecKit.psd1 -Force; Write-Host 'Module imported successfully'; Get-Command -Module PSSpecKit | Format-Table -AutoSize"
- name: Run Pester tests
run: |
pwsh -NoProfile -Command 'Import-Module Pester -MinimumVersion 5.0.0 -Force; $r = Pester\Invoke-Pester -Path .\tests -PassThru; if ($r.FailedCount -gt 0) { exit 1 }'
integration-tests:
runs-on: windows-latest
needs: lint-and-test
# Only run on pull_request events with the 'run-integration' label. This reduces CI minutes for branch pushes.
if: ${{ github.event_name == 'pull_request' && contains(join(',', github.event.pull_request.labels.*.name), 'run-integration') }}
steps:
- uses: actions/checkout@v4
- name: Install Pester
run: |
pwsh -Command "Install-Module -Name Pester -MinimumVersion 5.0.0 -Force -Scope CurrentUser -AcceptLicense"
- name: Run integration tests only
run: |
pwsh -NoProfile -Command "Import-Module Pester -MinimumVersion 5.0.0 -Force; $r = Pester\Invoke-Pester -Path .\tests\integration -PassThru; if ($r.FailedCount -gt 0) { exit 1 }"