Skip to content

Commit 86e158f

Browse files
committed
CI: add windows job
Add a windows job wich installs a debug version of eBPF for Windows, the go toolchain and gotestsum. For some reason, drive C: is exceedingly slow on the hosted Windows runners. Moving cache and temporary directories cuts down the build time of gotestsum from 2 minutes to 20ish seconds. For now we only test packages which already pass. Signed-off-by: Lorenz Bauer <[email protected]>
1 parent df6c610 commit 86e158f

File tree

1 file changed

+69
-3
lines changed

1 file changed

+69
-3
lines changed

.github/workflows/ci.yml

+69-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
env:
99
TMPDIR: /tmp
1010
CI_MAX_KERNEL_VERSION: '6.11'
11+
CI_MAX_EFW_VERSION: '0.20.0'
1112
CI_MIN_CLANG_VERSION: '11'
1213
go_version: '~1.23'
1314
prev_go_version: '~1.22'
@@ -185,8 +186,8 @@ jobs:
185186
run: |
186187
sudo dmesg
187188
188-
vm-test:
189-
name: Run tests
189+
linux-test:
190+
name: Run tests (Linux)
190191
runs-on: ubuntu-latest
191192
needs: build-and-lint
192193
timeout-minutes: 15
@@ -223,5 +224,70 @@ jobs:
223224
if: always()
224225
uses: actions/upload-artifact@v4
225226
with:
226-
name: Test Results (${{ matrix.tag }})
227+
name: Test Results (linux ${{ matrix.tag }})
227228
path: junit.xml
229+
230+
windows-test:
231+
name: Run tests (Windows)
232+
runs-on: windows-2022
233+
needs: build-and-lint
234+
timeout-minutes: 15
235+
strategy:
236+
matrix:
237+
version:
238+
- "0.20.0"
239+
env:
240+
# Fix slow Go compile and cache restore
241+
# See https://github.com/actions/setup-go/pull/515
242+
GOCACHE: D:\gocache
243+
GOMODCACHE: D:\gomodcache
244+
GOTMPDIR: D:\gotmp
245+
246+
steps:
247+
# Go requires gotmp to be present
248+
- run: mkdir D:\gotmp
249+
shell: pwsh
250+
251+
- name: Download and Install eBPF for Windows
252+
shell: pwsh
253+
run: |
254+
Invoke-WebRequest -Uri "https://github.com/microsoft/ebpf-for-windows/releases/download/Release-v${{ matrix.version }}/Build-x64.Debug.zip" -OutFile "$env:TEMP\efw.zip"
255+
Expand-Archive -Path "$env:TEMP\efw.zip" -DestinationPath "$env:TEMP\ebpf"
256+
Set-Location "$env:TEMP\ebpf"
257+
# setup-ebpf.ps1 can't handle spaces in the path to the MSI.
258+
mv "Build-x64 Debug" "debug"
259+
$setupScript = Get-ChildItem -Path . -Filter "setup-ebpf.ps1" -Recurse | Select-Object -First 1
260+
if ($setupScript) {
261+
Write-Host "Found setup script: $($setupScript.FullName)"
262+
Set-Location -Path $setupScript.DirectoryName
263+
Write-Host "Changed directory to: $(Get-Location)"
264+
& $setupScript.FullName
265+
266+
# Change service account to SYSTEM, until https://github.com/microsoft/ebpf-for-windows/pull/4095 is in a release.
267+
Write-Host "Changing ebpfsvc to run as SYSTEM"
268+
sc.exe config ebpfsvc obj= "LocalSystem"
269+
sc.exe start ebpfsvc
270+
} else {
271+
Write-Error "Setup script not found in the extracted package"
272+
exit 1
273+
}
274+
275+
- uses: actions/checkout@v4
276+
277+
- name: Set up Go
278+
uses: actions/setup-go@v5
279+
with:
280+
go-version: '${{ env.go_version }}'
281+
282+
- run: go install gotest.tools/[email protected]
283+
284+
- name: Test
285+
run: gotestsum --raw-command --ignore-non-json-output-lines --junitfile junit.xml -- go test -short -count 1 -json ./asm ./internal ./internal/kallsyms ./internal/kconfig ./internal/sysenc ./internal/testutils ./internal/tracefs
286+
287+
- name: Upload Test Results
288+
if: always()
289+
uses: actions/upload-artifact@v4
290+
with:
291+
name: Test Results (windows ${{ matrix.tag }})
292+
path: junit.xml
293+

0 commit comments

Comments
 (0)