fix(scan,ui): bound memory growth (size cap + LRU caches) (#76) #111
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: test (${{ matrix.os }} / go ${{ matrix.go }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # ubuntu-latest = linux/amd64; ubuntu-24.04-arm = linux/arm64 (free | |
| # for public repos). macos-latest = darwin/arm64 (M-series). | |
| # windows-latest = windows/amd64. Covers the full set of arches we | |
| # cross-compile for, minus darwin/amd64 — the macos-13 Intel runner | |
| # queues unreliably (frequent multi-hour waits on the free tier), | |
| # so we rely on the build-cross job for compile coverage there. | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest] | |
| go: ["1.24"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| cache: true | |
| - name: Install clipboard tools (Linux) | |
| if: runner.os == 'Linux' | |
| # atotto/clipboard shells out to xclip/xsel on Linux; both need an | |
| # X server. Xvfb provides a headless one so the round-trip test | |
| # actually exercises the integration instead of skipping. | |
| # | |
| # The arm64 apt mirror is occasionally flaky — don't fail the whole | |
| # job on a transient install error; the clipboard test will just | |
| # skip if the tools aren't present. | |
| continue-on-error: true | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y xvfb xclip | |
| - name: Build | |
| run: go build ./... | |
| - name: Test | |
| shell: bash | |
| run: | | |
| # Run under xvfb only when both xvfb-run and xclip are actually | |
| # available — covers the case where apt-get install hit a | |
| # transient failure above. | |
| if command -v xvfb-run >/dev/null && command -v xclip >/dev/null; then | |
| xvfb-run -a go test -race -count=1 ./... | |
| else | |
| go test -race -count=1 ./... | |
| fi | |
| lint: | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| cache: true | |
| - name: go vet | |
| run: go vet ./... | |
| - name: gofmt check | |
| run: | | |
| out=$(gofmt -l .) | |
| if [ -n "$out" ]; then | |
| echo "::error::gofmt found issues in:" | |
| echo "$out" | |
| exit 1 | |
| fi | |
| - name: goimports check | |
| env: | |
| # Newer goimports requires Go 1.25; let the install step fetch | |
| # its own toolchain instead of pinning the workflow to 1.25. | |
| GOTOOLCHAIN: auto | |
| run: | | |
| go install golang.org/x/tools/cmd/goimports@latest | |
| out=$("$(go env GOPATH)/bin/goimports" -l .) | |
| if [ -n "$out" ]; then | |
| echo "::error::goimports found issues in:" | |
| echo "$out" | |
| exit 1 | |
| fi | |
| - name: staticcheck | |
| uses: dominikh/staticcheck-action@v1 | |
| with: | |
| version: "2025.1.1" | |
| install-go: false | |
| fuzz: | |
| name: fuzz (parseFrontmatter, 30s) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| cache: true | |
| - name: Short fuzz run on YAML frontmatter parser | |
| # Third-party SKILL.md content is untrusted; 30 s per PR is cheap | |
| # insurance against yaml.v3 parser regressions. Longer runs can | |
| # be scheduled nightly later. | |
| run: go test -run=^$ -fuzz=FuzzParseFrontmatter -fuzztime=30s ./internal/scan/... | |
| build-cross: | |
| name: build (cross-compile) | |
| runs-on: ubuntu-latest | |
| needs: test | |
| strategy: | |
| matrix: | |
| target: | |
| - goos: linux | |
| goarch: amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| - goos: darwin | |
| goarch: amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| - goos: windows | |
| goarch: amd64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| cache: true | |
| - name: Build ${{ matrix.target.goos }}/${{ matrix.target.goarch }} | |
| env: | |
| GOOS: ${{ matrix.target.goos }} | |
| GOARCH: ${{ matrix.target.goarch }} | |
| CGO_ENABLED: 0 | |
| run: go build -o /tmp/skillscope ./cmd/skillscope |