-
-
Notifications
You must be signed in to change notification settings - Fork 113
176 lines (151 loc) · 5.31 KB
/
ci.yml
File metadata and controls
176 lines (151 loc) · 5.31 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Test PowerShell
on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- '*.md'
- 'Docs/**'
- 'Examples/**'
- '.gitignore'
pull_request:
branches:
- master
env:
BUILD_CONFIGURATION: 'Debug'
jobs:
refresh-psd1:
name: 'Refresh PSD1'
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
- name: Setup PowerShell modules
run: |
Install-Module PSPublishModule -Force -Scope CurrentUser -AllowClobber
Install-Module PSWriteColor -Force -Scope CurrentUser -AllowClobber
Install-Module PSSharedGoods -Force -Scope CurrentUser -AllowClobber
shell: pwsh
- name: Refresh module manifest
env:
RefreshPSD1Only: 'true'
run: |
./Build/Build-Module.ps1
shell: pwsh
- name: Commit refreshed PSD1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add PSWriteHTML.psd1
git commit -m "chore: regenerate psd1" || echo "No changes to commit"
git push origin HEAD:$Env:HEAD_BRANCH
shell: pwsh
- name: Upload refreshed manifest
uses: actions/upload-artifact@v4
with:
name: psd1
path: PSWriteHTML.psd1
test-windows-ps5:
needs: refresh-psd1
name: 'Windows PowerShell 5.1'
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download manifest
uses: actions/download-artifact@v4
with:
name: psd1
path: .
- name: Install PowerShell modules
run: |
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSSharedGoods -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
shell: powershell
- name: Run PowerShell tests
run: ./PSWriteHTML.Tests.ps1
shell: powershell
test-windows-ps7:
needs: refresh-psd1
name: 'Windows PowerShell 7'
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download manifest
uses: actions/download-artifact@v4
with:
name: psd1
path: .
- name: Install PowerShell modules
run: |
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSSharedGoods -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
shell: pwsh
- name: Run PowerShell tests
run: ./PSWriteHTML.Tests.ps1
shell: pwsh
test-ubuntu:
needs: refresh-psd1
name: 'Ubuntu PowerShell 7'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download manifest
uses: actions/download-artifact@v4
with:
name: psd1
path: .
- name: Install PowerShell
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
sudo apt-get update
sudo apt-get install -y powershell
- name: Install PowerShell modules
run: |
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSSharedGoods -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
shell: pwsh
- name: Run PowerShell tests
run: ./PSWriteHTML.Tests.ps1
shell: pwsh
test-macos:
needs: refresh-psd1
name: 'macOS PowerShell 7'
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download manifest
uses: actions/download-artifact@v4
with:
name: psd1
path: .
- name: Install PowerShell
run: brew install --cask powershell
- name: Install PowerShell modules
run: |
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSSharedGoods -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
shell: pwsh
- name: Run PowerShell tests
run: ./PSWriteHTML.Tests.ps1
shell: pwsh