-
-
Notifications
You must be signed in to change notification settings - Fork 974
246 lines (213 loc) · 7.27 KB
/
build.yml
File metadata and controls
246 lines (213 loc) · 7.27 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: Build
on:
- push
- pull_request
- workflow_dispatch
jobs:
Linux:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # needed for Nerdbank.GitVersioning
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Build Unit Tests .NET
run: dotnet build -f net10.0 test/Renci.SshNet.Tests/
- name: Build IntegrationTests .NET
run: dotnet build -f net10.0 test/Renci.SshNet.IntegrationTests/
- name: Run Unit Tests .NET
run: |
dotnet test \
-f net10.0 \
--no-build \
--logger "console;verbosity=normal" \
--logger GitHubActions \
-p:CollectCoverage=true \
-p:CoverletOutputFormat=cobertura \
-p:CoverletOutput=../../coverlet/linux_unit_test_net_10_coverage.xml \
test/Renci.SshNet.Tests/
- name: Run Integration Tests .NET
run: |
dotnet test \
-f net10.0 \
--no-build \
--logger "console;verbosity=normal" \
--logger GitHubActions \
-p:CollectCoverage=true \
-p:CoverletOutputFormat=cobertura \
-p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage.xml \
test/Renci.SshNet.IntegrationTests/
- name: Archive Coverlet Results
uses: actions/upload-artifact@v6
with:
name: Coverlet Results Linux
path: coverlet
Windows:
runs-on: windows-2025
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # needed for Nerdbank.GitVersioning
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Build Solution
run: dotnet build Renci.SshNet.slnx
- name: Publish AOT Compatibility Test App
run: dotnet publish -r win-x64 /warnaserror test/Renci.SshNet.AotCompatibilityTestApp/
- name: Create NuGet Package
run: dotnet pack
- name: Archive NuGet Package
uses: actions/upload-artifact@v6
with:
name: NuGet Package
path: src/Renci.SshNet/bin/Release/*.*nupkg
- name: Run Unit Tests .NET
run: |
dotnet test `
-f net10.0 `
--no-build `
--logger "console;verbosity=normal" `
--logger GitHubActions `
-p:CollectCoverage=true `
-p:CoverletOutputFormat=cobertura `
-p:CoverletOutput=../../coverlet/windows_unit_test_net_10_coverage.xml `
test/Renci.SshNet.Tests/
- name: Run Unit Tests .NET Framework
run: |
dotnet test `
-f net462 `
--no-build `
--logger "console;verbosity=normal" `
--logger GitHubActions `
-p:CollectCoverage=true `
-p:CoverletOutputFormat=cobertura `
-p:CoverletOutput=../../coverlet/windows_unit_test_net_4_6_2_coverage.xml `
test/Renci.SshNet.Tests/
Windows-Integration-Tests-NetFramework:
name: Windows Integration Tests .NET Framework
runs-on: windows-2025
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # needed for Nerdbank.GitVersioning
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Setup WSL2
uses: Vampire/setup-wsl@6a8db447be7ed35f2f499c02c6e60ff77ef11278 # v6.0.0
with:
distribution: Ubuntu-24.04
- name: Setup SSH Server
shell: wsl-bash {0}
run: |
apt-get update && apt-get upgrade -y
apt-get install -y podman
podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/
podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image
- name: Run Integration Tests .NET Framework
run:
dotnet test `
-f net48 `
--logger "console;verbosity=normal" `
--logger GitHubActions `
-p:CollectCoverage=true `
-p:CoverletOutputFormat=cobertura `
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage.xml `
test\Renci.SshNet.IntegrationTests\
- name: Archive Coverlet Results
uses: actions/upload-artifact@v6
with:
name: Coverlet Results Windows .NET Framework
path: coverlet
Windows-Integration-Tests-Net:
name: Windows Integration Tests .NET
runs-on: windows-2025
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # needed for Nerdbank.GitVersioning
- name: Setup .NET
uses: actions/setup-dotnet@v5
- name: Setup WSL2
uses: Vampire/setup-wsl@6a8db447be7ed35f2f499c02c6e60ff77ef11278 # v6.0.0
with:
distribution: Ubuntu-24.04
- name: Setup SSH Server
shell: wsl-bash {0}
run: |
apt-get update && apt-get upgrade -y
apt-get install -y podman
podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/
podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image
- name: Run Integration Tests .NET
run:
dotnet test `
-f net10.0 `
--logger "console;verbosity=normal" `
--logger GitHubActions `
-p:CollectCoverage=true `
-p:CoverletOutputFormat=cobertura `
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_9_coverage.xml `
test\Renci.SshNet.IntegrationTests\
- name: Archive Coverlet Results
uses: actions/upload-artifact@v6
with:
name: Coverlet Results Windows .NET
path: coverlet
Publish-GitHub-Package:
name: Publish GitHub Package
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/develop'
permissions:
packages: write
needs:
- Windows
- Linux
- Windows-Integration-Tests-NetFramework
- Windows-Integration-Tests-Net
steps:
- name: Download NuGet Package
uses: actions/download-artifact@v7
with:
name: NuGet Package
- name: Publish to GitHub NuGet Registry
run: |
dotnet nuget add source \
--username $GITHUB_ACTOR \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text \
--name github \
"https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json"
dotnet nuget push "*.nupkg" \
--source github \
--api-key ${{ secrets.GITHUB_TOKEN }}
Publish-NuGet-Package:
name: Publish NuGet Package
runs-on: ubuntu-24.04
if: startsWith(github.event.ref, 'refs/tags/20')
permissions:
id-token: write
needs:
- Windows
- Linux
- Windows-Integration-Tests-NetFramework
- Windows-Integration-Tests-Net
steps:
- name: Download NuGet Package
uses: actions/download-artifact@v7
with:
name: NuGet Package
- name: NuGet login (OIDC → temp API key)
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish to NuGet Registry
run: |
dotnet nuget push "*.nupkg" \
--source https://api.nuget.org/v3/index.json \
--api-key ${{ steps.login.outputs.NUGET_API_KEY }}