mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-06 17:08:53 +00:00
The previous fix added /client/ui-wails to the grep -v / Where-Object filter, but go list aborts at the first broken package and emits an empty stdout when client/ui-wails/main.go's //go:embed all:frontend/dist fails to resolve. The command substitution then expands to nothing, and `go test` falls back to the repo root — which has no Go files and fails the job. `go list -e` keeps listing remaining packages after a parse error, so the existing path-based filter now actually does its job. Touches all three test workflows (Linux native + docker, Darwin, Windows).
85 lines
3.5 KiB
YAML
85 lines
3.5 KiB
YAML
name: "Windows"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
env:
|
|
downloadPath: '${{ github.workspace }}\temp'
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: "Client / Unit"
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v5
|
|
id: go
|
|
with:
|
|
go-version-file: "go.mod"
|
|
cache: false
|
|
|
|
- name: Get Go environment
|
|
run: |
|
|
echo "cache=$(go env GOCACHE)" >> $env:GITHUB_ENV
|
|
echo "modcache=$(go env GOMODCACHE)" >> $env:GITHUB_ENV
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
${{ env.cache }}
|
|
${{ env.modcache }}
|
|
key: ${{ runner.os }}-gotest-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gotest-
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Download wintun
|
|
uses: carlosperate/download-file-action@v2
|
|
id: download-wintun
|
|
with:
|
|
file-url: https://pkgs.netbird.io/wintun/wintun-0.14.1.zip
|
|
file-name: wintun.zip
|
|
location: ${{ env.downloadPath }}
|
|
sha256: '07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51'
|
|
|
|
- name: Decompressing wintun files
|
|
run: tar -zvxf "${{ steps.download-wintun.outputs.file-path }}" -C ${{ env.downloadPath }}
|
|
|
|
- run: mv ${{ env.downloadPath }}/wintun/bin/amd64/wintun.dll 'C:\Windows\System32\'
|
|
|
|
- run: choco install -y sysinternals --ignore-checksums
|
|
- run: choco install -y mingw
|
|
|
|
- run: PsExec64 -s -w ${{ github.workspace }} C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe env -w GOMODCACHE=${{ env.cache }}
|
|
- run: PsExec64 -s -w ${{ github.workspace }} C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe env -w GOCACHE=${{ env.modcache }}
|
|
- run: PsExec64 -s -w ${{ github.workspace }} C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe mod tidy
|
|
- name: Generate test script
|
|
# Exclude client/ui-wails: its main.go uses //go:embed all:frontend/dist,
|
|
# which fails to compile until the frontend has been built. The Wails UI
|
|
# has no Go-side unit tests, and its release pipeline runs `pnpm build`
|
|
# before goreleaser.
|
|
# `go list -e` lets the listing succeed even though the embed fails to
|
|
# resolve; the Where-Object pipeline then drops the broken package by
|
|
# path. Without -e, go list aborts with empty stdout.
|
|
run: |
|
|
$packages = go list -e ./... | Where-Object { $_ -notmatch '/management' } | Where-Object { $_ -notmatch '/relay' } | Where-Object { $_ -notmatch '/signal' } | Where-Object { $_ -notmatch '/proxy' } | Where-Object { $_ -notmatch '/combined' } | Where-Object { $_ -notmatch '/client/ui-wails' }
|
|
$goExe = "C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe"
|
|
$cmd = "$goExe test -tags=devcert -timeout 10m -p 1 $($packages -join ' ') > test-out.txt 2>&1"
|
|
Set-Content -Path "${{ github.workspace }}\run-tests.cmd" -Value $cmd
|
|
|
|
- name: test
|
|
run: PsExec64 -s -w ${{ github.workspace }} cmd.exe /c "${{ github.workspace }}\run-tests.cmd"
|
|
- name: test output
|
|
if: ${{ always() }}
|
|
run: Get-Content test-out.txt
|