-
Notifications
You must be signed in to change notification settings - Fork 42
456 lines (443 loc) · 17.9 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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
name: CI
on:
push:
branches:
- main
- release/*
- prerelease/*
pull_request:
branches:
- main
- release/*
- prerelease/*
schedule:
- cron: '37 12 * * 2'
concurrency:
# Cancel any workflow currently in progress for the same PR.
# Allow running concurrently with any other commits.
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions: read-all
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
# Some driver developers are building for WS2022 LTSC targets using VS2019 +
# the Windows Server 2022 WDK, so validate our project still builds in that
# environment, in addition to the default WS 2022.
os: [2019, 2022]
configuration: [Release, Debug]
platform: [x64]
runs-on: windows-${{ matrix.os }}
permissions:
actions: read
contents: read
security-events: write # For CodeQL
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
submodules: recursive
- name: Initialize CodeQL
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/init@v2
with:
languages: c-cpp
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@ab534842b4bdf384b8aaf93765dc6f721d9f5fab
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForBuild -Verbose
- name: Install LLVM 11.0
run: |
choco install -y llvm --version 11.0.1 --allow-downgrade
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Nuget Restore
run: nuget.exe restore xdp.sln -ConfigFile src/nuget.config
- name: Prepare for compiling eBPF programs
run: tools/prepare-machine.ps1 -ForEbpfBuild -Verbose
- name: Build
run: msbuild xdp.sln /m /p:configuration=${{ matrix.configuration }} /p:platform=${{ matrix.platform }}
- name: Sign Binaries
shell: PowerShell
run: tools/sign.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }}
- name: Build Installer
shell: PowerShell
run: tools/create-installer.ps1 -Config ${{ matrix.configuration }} -Platform ${{ matrix.platform }}
- name: Upload Artifacts
if: matrix.os == 2022
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: bin_${{ matrix.configuration }}_${{ matrix.platform }}
path: |
artifacts/bin
!artifacts/bin/**/*.ilk
!artifacts/bin/**/*.exp
!artifacts/bin/**/*.lastcodeanalysissucceeded
- name: Publish Symbols
uses: microsoft/action-publish-symbols@719c40b80e38bca806f3e01e1e3dd3a67554cd68
if: github.event_name != 'pull_request' && matrix.os == 2022
with:
accountName: mscodehub
symbolServiceUrl: 'https://artifacts.dev.azure.com'
personalAccessToken: ${{ secrets.AZDO_PAT }}
- name: Perform CodeQL Analysis
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/analyze@v2
with:
category: "/language:c-cpp"
functional_tests:
name: Functional Tests
needs: build
env:
# For 'main' commits
fullRuntime: 120 # minutes. Update timeout-minutes with any changes.
fullIters: 10
# For PRs
prRuntime: 15 # minutes. Update timeout-minutes with any changes.
prIters: 1
strategy:
fail-fast: false
matrix:
windows: [2019, 2022, Prerelease]
configuration: [Release, Debug]
platform: [x64]
runs-on:
- self-hosted
- "1ES.Pool=xdp-ci-functional-gh"
- "1ES.ImageOverride=WS${{ matrix.windows }}-Functional"
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
sparse-checkout: tools
- name: Check Drivers
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForFunctionalTest -NoReboot -Verbose
- name: Download Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: bin_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/bin
- name: Run Tests (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: PowerShell
timeout-minutes: 15
run: tools/functional.ps1 -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Iterations ${{ env.prIters }} -Timeout ${{ env.fullRuntime }}
- name: Run Tests (main)
if: ${{ github.event_name != 'pull_request' }}
shell: PowerShell
timeout-minutes: 120
run: tools/functional.ps1 -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Iterations ${{ env.fullIters }} -Timeout ${{ env.fullRuntime }}
- name: Convert Logs
if: ${{ always() }}
timeout-minutes: 5
shell: PowerShell
run: tools/log.ps1 -Convert -Name xdpfunc* -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }}
- name: Upload Logs
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ always() }}
with:
name: logs_func_win${{ matrix.windows }}_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/logs
- name: Check Drivers
if: ${{ always() }}
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
stress_tests:
name: Stress Tests
needs: build
env:
successThresholdPercent: 1
xdpmpPollProvider: 'FNDIS'
# For 'main' commits
fullRuntime: 60 # minutes. Update timeout-minutes with any changes.
# For PRs
prRuntime: 10 # minutes. Update timeout-minutes with any changes.
strategy:
fail-fast: false
matrix:
windows: [2019, 2022]
configuration: [Release, Debug]
platform: [x64]
timeout-minutes: 75 # Ideally this would be only 25 min for PR runs, but GitHub Actions don't support that.
runs-on:
- self-hosted
- "1ES.Pool=xdp-ci-spinxsk-gh"
- "1ES.ImageOverride=WS${{ matrix.windows }}-Spinxsk"
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
sparse-checkout: tools
- name: Check Drivers
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForSpinxskTest -NoReboot -Verbose
- name: Download Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: bin_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/bin
- name: Run spinxsk (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: PowerShell
timeout-minutes: 15
run: tools/spinxsk.ps1 -Verbose -Stats -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Minutes ${{ env.prRuntime }} -XdpmpPollProvider ${{ env.xdpmpPollProvider }} -SuccessThresholdPercent ${{ env.successThresholdPercent }} -EnableEbpf
- name: Run spinxsk (main)
if: ${{ github.event_name != 'pull_request' }}
shell: PowerShell
timeout-minutes: 65
run: tools/spinxsk.ps1 -Verbose -Stats -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Minutes ${{ env.fullRuntime }} -XdpmpPollProvider ${{ env.xdpmpPollProvider }} -SuccessThresholdPercent ${{ env.successThresholdPercent }} -EnableEbpf
- name: Convert Logs
if: ${{ always() }}
timeout-minutes: 5
shell: PowerShell
run: tools/log.ps1 -Convert -Name spinxsk -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }}
- name: Upload Logs
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ always() }}
with:
name: logs_stress_win${{ matrix.windows }}_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/logs
- name: Check Drivers
if: ${{ always() }}
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
pktfuzz_tests:
name: Fuzz Packet Parsing
needs: build
strategy:
fail-fast: false
matrix:
windows: [2022] # ASAN is currently buggy on Prerelease and 2019.
configuration: [Release, Debug]
platform: [x64]
runs-on:
- self-hosted
- "1ES.Pool=xdp-ci-fuzz-gh"
- "1ES.ImageOverride=WS${{ matrix.windows }}"
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
sparse-checkout: tools
- name: Download Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: bin_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/bin
- name: Run pktfuzz
shell: PowerShell
run: tools/pktfuzz.ps1 -Minutes 10 -Workers 8 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Upload Logs
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ always() }}
with:
name: logs_pktfuzz_win${{ matrix.windows }}_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/logs
perf_tests:
name: Perf Tests
needs: build
strategy:
fail-fast: false
matrix:
windows: [2019, 2022, Prerelease]
configuration: [Release]
platform: [x64]
timeout-minutes: 75 # Ideally this would be only 25 min for PR runs, but GitHub Actions don't support that.
runs-on:
- self-hosted
- "1ES.Pool=xdp-ci-perf-gh"
- "1ES.ImageOverride=WS${{ matrix.windows }}"
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
sparse-checkout: tools
- name: Check Drivers
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForPerfTest -NoReboot -Verbose
- name: Download Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: bin_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/bin
- name: Run xskperfsuite (Generic, Native)
shell: PowerShell
run: tools/xskperfsuite.ps1 -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Fndis -RawResultsFile "artifacts/logs/xskperfsuite.csv" -XperfDirectory "artifacts/logs" -CommitHash ${{ github.sha }}
- name: Run xskperfsuite (TX-inspect, RX-inject)
shell: PowerShell
run: tools/xskperfsuite.ps1 -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Fndis -XdpModes "Generic" -TxInspect -RxInject -RawResultsFile "artifacts/logs/xskperfsuite.csv" -XperfDirectory "artifacts/logs" -CommitHash ${{ github.sha }}
- name: Run xskperfsuite (Winsock, RIO)
shell: PowerShell
run: tools/xskperfsuite.ps1 -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Fndis -XdpModes "Winsock", "RIO" -Modes "RX", "TX" -RawResultsFile "artifacts/logs/xskperfsuite.csv" -XperfDirectory "artifacts/logs" -CommitHash ${{ github.sha }}
- name: Upload results
shell: PowerShell
env:
SAS_TOKEN: ${{ secrets.PERF_DATA_SAS }}
run: tools/upload-perfdata.ps1 -Verbose -FileName "artifacts/logs/xskperfsuite.csv" -ContainerName "cidata" -BlobName "xskperf-ws${{ matrix.windows }}.csv"
- name: Upload Logs
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ always() }}
with:
name: logs_perf_win${{ matrix.windows }}_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/logs
- name: Check Drivers
if: ${{ always() }}
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
downlevel_functional_tests:
name: Downlevel Functional Tests
needs: build
env:
Runtime: 15 # minutes. Update timeout-minutes with any changes.
Iters: 1
strategy:
fail-fast: false
matrix:
downlevel_release: [1.0.0]
windows: [2019, 2022, Prerelease]
configuration: [Release]
platform: [x64]
runs-on:
- self-hosted
- "1ES.Pool=xdp-ci-functional-gh"
- "1ES.ImageOverride=WS${{ matrix.windows }}-Functional"
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
sparse-checkout: tools
- name: Check Drivers
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForFunctionalTest -NoReboot -Verbose
- name: Download Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: bin_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/bin
- name: Download Downlevel Tests
shell: PowerShell
run: |
Invoke-WebRequest -Uri "https://github.com/microsoft/xdp-for-windows/releases/download/v${{ matrix.downlevel_release }}/xdp-tests-${{ matrix.platform }}-${{ matrix.downlevel_release }}.zip" -OutFile "artifacts/downlevel-test.zip"
Expand-Archive -Path artifacts/downlevel-test.zip -DestinationPath artifacts/downlevel-test/${{ matrix.platform }}
Copy-Item -Path artifacts/downlevel-test/${{ matrix.platform }}/bin/* -Destination artifacts/bin/${{ matrix.platform }}_${{ matrix.configuration }}
- name: Run Tests
shell: PowerShell
timeout-minutes: 15
run: tools/functional.ps1 -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Iterations ${{ env.Iters }} -Timeout ${{ env.Runtime }}
- name: Convert Logs
if: ${{ always() }}
timeout-minutes: 5
shell: PowerShell
run: tools/log.ps1 -Convert -Name xdpfunc* -Verbose -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }}
- name: Upload Logs
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ always() }}
with:
name: logs_func_win${{ matrix.windows }}_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/logs
- name: Check Drivers
if: ${{ always() }}
shell: PowerShell
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
create_artifacts:
name: Create Release Artifacts
needs: build
strategy:
fail-fast: false
matrix:
configuration: [Release]
platform: [x64]
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Download Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: bin_${{ matrix.configuration }}_${{ matrix.platform }}
path: artifacts/bin
- name: Create Dev Kit
shell: PowerShell
run: tools/create-devkit.ps1 -Config ${{ matrix.configuration }} -Platform ${{ matrix.platform }}
- name: Create Test Archive
shell: PowerShell
run: tools/create-test-archive.ps1 -Config ${{ matrix.configuration }} -Platform ${{ matrix.platform }}
- name: Upload Release Artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: release_artifacts_${{ matrix.configuration }}_${{ matrix.platform }}
path: |
artifacts/kit/**/*.zip
artifacts/tests/**/*.zip
etw:
name: ETW Plugin
needs: []
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
configuration: [Release, Debug]
permissions:
security-events: write # For CodeQL
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Initialize CodeQL
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/init@v2
with:
languages: csharp
- name: Setup .NET
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2
with:
dotnet-version: 6.0.x
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForBuild -Verbose
- name: Build
run: dotnet build src\xdpetwplugin\xdpetwplugin.sln -c ${{ matrix.configuration }}
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: etw_${{ matrix.configuration }}
path: artifacts/bin
- name: Perform CodeQL Analysis
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/analyze@v2
with:
category: "/language:csharp"
netperf:
name: Run Perf
needs: []
runs-on: windows-latest
steps:
- name: Run NetPerf Workflow
shell: pwsh
run: |
$url = "https://raw.githubusercontent.com/microsoft/netperf/main/run-workflow.ps1"
if ('${{ secrets.NET_PERF_TRIGGER }}' -eq '') {
Write-Host "Not able to run because no secrets are available!"
return
}
iex "& { $(irm $url) } ${{ secrets.NET_PERF_TRIGGER }} xdp ${{ github.sha }} ${{ github.ref }} ${{ github.event.pull_request.number }}"
Complete:
name: Complete
needs: [build, functional_tests, stress_tests, pktfuzz_tests, perf_tests, downlevel_functional_tests, create_artifacts, etw, netperf]
runs-on: windows-latest
steps:
- run: echo "CI succeeded"