feat(agent): lk agent debugger, a text-mode test harness for coding agents
#1665
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| # No windows-latest: its native MinGW GCC can't compile the WebRTC APM | |
| # C++ (clang-only SEH __try/__except). Windows is built+validated by the | |
| # zig cross-build in build.yaml; the audio packages have no unit tests. | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| packages: read | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| # pkg/portaudio/pa_src is a submodule with the vendored PortAudio C | |
| # source; needed now that console (cgo) builds unconditionally. | |
| submodules: true | |
| - name: Install ALSA headers (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: sudo apt-get update && sudo apt-get install -y libasound2-dev | |
| - name: Set up Go | |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Download Go modules | |
| run: go mod download | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9 | |
| with: | |
| version: v2.11.4 | |
| - name: Test | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| go test -race -json -v ./... 2>&1 | tee test.log | |
| - name: Verify fish_autocomplete is up to date | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: | | |
| go build -o /tmp/lk ./cmd/lk | |
| /tmp/lk generate-fish-completion -o /tmp/fish_autocomplete.fresh | |
| if ! diff -u autocomplete/fish_autocomplete /tmp/fish_autocomplete.fresh; then | |
| echo "::error::autocomplete/fish_autocomplete is stale; regenerate with:" | |
| echo " go build -o /tmp/lk ./cmd/lk && /tmp/lk generate-fish-completion -o autocomplete/fish_autocomplete" | |
| exit 1 | |
| fi | |
| # The Test step above already fails on a VRT mismatch, but testify's diff of | |
| # a full terminal frame is unreadable and says nothing about how to fix it. | |
| # Re-recording here turns the failure into the diff of what actually moved | |
| # on screen, and catches what the test alone cannot: a frame left behind by | |
| # a fixture that no longer exists (make update-vrt clears the directory, so | |
| # an orphan shows up as a deletion). Runs even when the tests failed, so the | |
| # actionable message is never buried behind them. | |
| - name: Verify TUI reference frames are up to date | |
| if: always() && matrix.os == 'ubuntu-latest' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| make update-vrt | |
| if [ -n "$(git status --porcelain -- cmd/lk/testdata/vrt)" ]; then | |
| git --no-pager diff -- cmd/lk/testdata/vrt | |
| git status --porcelain -- cmd/lk/testdata/vrt | |
| echo "::error::The TUI renders differently than the recorded reference frames." | |
| echo "::error::If the change is intended, run 'make update-vrt' and commit cmd/lk/testdata/vrt." | |
| exit 1 | |
| fi | |
| - name: Upload test log | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| if: always() | |
| with: | |
| name: test-log-${{ matrix.os }} | |
| path: test.log | |
| if-no-files-found: warn |