Repository navigation
126 lines (106 loc) · 3.56 KB
/
Copy pathtest-powershell.yml
File metadata and controls
126 lines (106 loc) · 3.56 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Test PowerShell Module
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- 'Docs/**'
pull_request:
workflow_dispatch: # 👈 enables manual triggering
env:
DOTNET_VERSION: '10.0.112'
BUILD_CONFIGURATION: 'Debug'
jobs:
refresh-psd1:
name: 'Refresh PSD1'
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup PowerShell modules
run: |
Install-Module PSPublishModule -Force -Scope CurrentUser -AllowClobber
shell: pwsh
- name: Test release selection
run: |
.\Build\Test-ReleaseConfiguration.ps1
.\Build\Test-ReleasePlans.ps1
shell: pwsh
- name: Refresh module manifest
run: |
.\Build\Build-Module.ps1 -ConfigurationGateMode Manifest
shell: pwsh
- name: Upload refreshed manifest
uses: actions/upload-artifact@v7
with:
name: psd1
path: PSEventViewer.psd1
test-windows-ps5:
needs: refresh-psd1
name: 'Windows PowerShell 5.1'
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Download manifest
uses: actions/download-artifact@v8
with:
name: psd1
path: .
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install PowerShell modules
shell: powershell
run: |
Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)"
if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) {
Register-PSRepository -Default
}
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSSharedGoods -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
- name: Build .NET solution
run: |
dotnet restore Sources/EventViewerX.sln
dotnet build Sources/EventViewerX.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore
- name: Run PowerShell tests
shell: powershell
run: .\PSEventViewer.Tests.ps1
test-windows-ps7:
needs: refresh-psd1
name: 'Windows PowerShell 7'
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Download manifest
uses: actions/download-artifact@v8
with:
name: psd1
path: .
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install PowerShell modules
shell: pwsh
run: |
Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)"
if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) {
Register-PSRepository -Default
}
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSSharedGoods -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
- name: Build .NET solution
run: |
dotnet restore Sources/EventViewerX.sln
dotnet build Sources/EventViewerX.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore
- name: Run PowerShell tests
shell: pwsh
run: .\PSEventViewer.Tests.ps1