Skip to content

Commit 02e3e10

Browse files
committed
ci: share one Windows cross-build between unit tests and session e2e
Combine the two Windows cross-builds into a single zig cross-build job in windows.yaml that produces lk.exe plus a test binary per package. Both the unit-test run (windows-tests) and the session e2e run (windows-session-e2e) depend on it, so the expensive cgo compile happens once. Move the Windows jobs out of session-e2e.yaml (now Linux/macOS only) and fold the standalone test-windows.yaml in.
1 parent f1ec486 commit 02e3e10

3 files changed

Lines changed: 198 additions & 259 deletions

File tree

.github/workflows/session-e2e.yaml

Lines changed: 5 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Session E2E
22

33
# Drives the real `lk agent daemon` start/say/stop lifecycle against the minimal
4-
# one-file echo agent in cmd/lk/testdata/echo-agent, on Linux, macOS, and
5-
# Windows. This exercises the detached daemon, the readiness handshake, the
6-
# console IPC transport, and the model round-trip end to end -- runtime behavior
7-
# that `go test` alone never covers.
4+
# one-file echo agent in cmd/lk/testdata/echo-agent, on Linux and macOS (the
5+
# Windows arm lives in windows.yaml, which cross-compiles with zig). This
6+
# exercises the detached daemon, the readiness handshake, the console IPC
7+
# transport, and the model round-trip end to end -- runtime behavior that
8+
# `go test` alone never covers.
89
#
910
# Runs on manual dispatch and on pushes to any repo branch (forks can't trigger
1011
# `push`, so secrets are only exposed to trusted collaborators). It needs live
@@ -19,15 +20,6 @@ name: Session E2E
1920
# console mode to the TCP console directly to bridge the daemon's
2021
# `python <entry> console --connect-addr` launch.
2122
#
22-
# Windows is split into two jobs: pkg/apm/webrtc's C++ uses MSVC SEH
23-
# (__try/__except) that the runner's mingw GCC can't compile, so we build with
24-
# zig (clang) exactly as .goreleaser.yaml does. zig-as-CC must run on Linux: on
25-
# native Windows the cgo link of ~560 webrtc/portaudio objects overflows the
26-
# ~32KB command-line limit. So `cross-build-windows` cross-compiles lk.exe AND
27-
# the e2e test binary on Linux and uploads them; `e2e-windows` downloads them
28-
# and runs the test natively (LK_SESSION_E2E_BIN points the test at the
29-
# prebuilt lk, so nothing is rebuilt on the Windows runner).
30-
#
3123
# Node is intentionally not in the matrix yet: this branch's session daemon only
3224
# supports Python agents (`detectProject` rejects non-Python), and Node console
3325
# support depends on the brian/agent-session-node-support CLI line (#868/#878)
@@ -95,113 +87,3 @@ jobs:
9587
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
9688
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
9789
run: go test ./cmd/lk -run TestSessionE2E -count=1 -v -timeout 600s
98-
99-
# Cross-compile the Windows artifacts on Linux with zig, mirroring
100-
# .goreleaser.yaml's lk-windows-amd64 build. Produces lk.exe (the binary under
101-
# test) and the compiled e2e test binary, both shipped to e2e-windows.
102-
cross-build-windows:
103-
runs-on: ubuntu-latest
104-
name: Cross-build Windows artifacts (zig)
105-
106-
permissions:
107-
contents: read
108-
109-
steps:
110-
- name: Checkout livekit-cli
111-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
112-
with:
113-
submodules: true
114-
115-
- name: Set up Zig
116-
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
117-
with:
118-
version: 0.14.1
119-
120-
- name: Set up Go
121-
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
122-
with:
123-
go-version-file: go.mod
124-
cache: true
125-
126-
# Generate the MinGW import libs lld needs for Go's /DEFAULTLIB references
127-
# (dbghelp, bcrypt, ...), exactly as goreleaser's before-hook does.
128-
- name: Generate MinGW import libs
129-
run: scripts/setup-cross.sh windows/amd64
130-
131-
- name: Cross-compile lk.exe and the e2e test binary
132-
env:
133-
GOOS: windows
134-
GOARCH: amd64
135-
CGO_ENABLED: "1"
136-
# zig cc/c++ as the cgo toolchain, matching .goreleaser.yaml's Windows
137-
# build. -fms-extensions (SEH) isn't on cgo's allowlist; -fno-sanitize
138-
# is a zig UBSan-under-lld workaround -- both copied from goreleaser.
139-
CC: zig cc -target x86_64-windows-gnu
140-
CXX: zig c++ -target x86_64-windows-gnu
141-
CGO_CXXFLAGS_ALLOW: -fms-extensions
142-
CGO_CXXFLAGS: -fno-sanitize=all
143-
run: |
144-
ldflags="-extldflags=-L$PWD/.cross/windows_amd64/mingw_lib"
145-
mkdir -p dist
146-
go build -ldflags="$ldflags" -o dist/lk.exe ./cmd/lk
147-
go test -c -ldflags="$ldflags" -o dist/session-e2e.test.exe ./cmd/lk
148-
149-
- name: Upload Windows artifacts
150-
uses: actions/upload-artifact@v4
151-
with:
152-
name: windows-e2e
153-
path: dist/*.exe
154-
retention-days: 1
155-
if-no-files-found: error
156-
157-
# Run the prebuilt Windows artifacts natively. No Go/zig/cgo here: the test
158-
# binary just drives lk.exe (via LK_SESSION_E2E_BIN) against the echo agent.
159-
e2e-windows:
160-
needs: cross-build-windows
161-
runs-on: windows-latest
162-
name: Agent Session with Python Agent on windows-latest
163-
164-
permissions:
165-
contents: read
166-
167-
steps:
168-
- name: Checkout livekit-cli
169-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
170-
# No submodules: the prebuilt binaries already contain the cgo code;
171-
# only the echo-agent fixture (plain repo files) is needed at runtime.
172-
173-
- name: Download Windows artifacts
174-
uses: actions/download-artifact@v4
175-
with:
176-
name: windows-e2e
177-
path: dist
178-
179-
- name: Set up Python
180-
uses: actions/setup-python@v5
181-
with:
182-
python-version: "3.12"
183-
184-
- name: Set up uv
185-
uses: astral-sh/setup-uv@v5
186-
with:
187-
enable-cache: true
188-
189-
- name: Sync echo agent deps
190-
working-directory: cmd/lk/testdata/echo-agent
191-
run: uv sync
192-
193-
- name: Run session e2e
194-
# Run from cmd/lk so the test's default testdata/echo-agent/agent.py
195-
# path resolves; point it at the cross-built lk.exe so nothing rebuilds.
196-
shell: bash
197-
working-directory: cmd/lk
198-
env:
199-
# Relative to cmd/lk; Go's filepath.Abs resolves it. Forward slashes
200-
# keep bash happy (GITHUB_WORKSPACE would carry Windows backslashes).
201-
LK_SESSION_E2E_BIN: ../../dist/lk.exe
202-
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
203-
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
204-
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
205-
run: |
206-
../../dist/session-e2e.test.exe \
207-
-test.run TestSessionE2E -test.count=1 -test.v -test.timeout 600s

.github/workflows/test-windows.yaml

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)