|
| 1 | +# https://taskfile.dev — local CI + Langfuse/live helpers. |
| 2 | +# Install: go install github.com/go-task/task/v3/cmd/task@latest |
| 3 | +version: "3" |
| 4 | + |
| 5 | +vars: |
| 6 | + BINARY: '{{if eq OS "windows"}}squad-oc.exe{{else}}squad-oc{{end}}' |
| 7 | + COMPOSE: scripts/langfuse/docker-compose.yml |
| 8 | + PWSH: '{{if eq OS "windows"}}powershell{{else}}pwsh{{end}}' |
| 9 | + |
| 10 | +tasks: |
| 11 | + default: |
| 12 | + desc: List tasks |
| 13 | + silent: true |
| 14 | + cmds: |
| 15 | + - task --list |
| 16 | + |
| 17 | + tools: |
| 18 | + desc: Install golangci-lint, govulncheck, actionlint, goreleaser (versions match CI) |
| 19 | + cmds: |
| 20 | + - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 |
| 21 | + - go install golang.org/x/vuln/cmd/govulncheck@v1.7.0 |
| 22 | + - go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 |
| 23 | + - go install github.com/goreleaser/goreleaser/v2@v2.17.1 |
| 24 | + |
| 25 | + tidy: |
| 26 | + desc: go mod tidy |
| 27 | + cmds: |
| 28 | + - go mod tidy |
| 29 | + |
| 30 | + cover: |
| 31 | + desc: Unit tests with coverage profile |
| 32 | + cmds: |
| 33 | + - go test -coverprofile=coverage.out ./... |
| 34 | + - go tool cover -func=coverage.out |
| 35 | + |
| 36 | + test: |
| 37 | + desc: Unit tests (no race, no live OpenCode) |
| 38 | + cmds: |
| 39 | + - go test ./... |
| 40 | + |
| 41 | + test:race: |
| 42 | + desc: Unit tests with -race (needs a C toolchain on Windows) |
| 43 | + cmds: |
| 44 | + - go test -race -count=1 ./... |
| 45 | + |
| 46 | + vet: |
| 47 | + desc: go vet |
| 48 | + cmds: |
| 49 | + - go vet ./... |
| 50 | + |
| 51 | + lint: |
| 52 | + desc: golangci-lint (same timeout as CI) |
| 53 | + cmds: |
| 54 | + - golangci-lint run --timeout=4m |
| 55 | + |
| 56 | + fmt: |
| 57 | + desc: Apply gofmt to all .go files |
| 58 | + cmds: |
| 59 | + - gofmt -w . |
| 60 | + |
| 61 | + fmt:check: |
| 62 | + desc: Fail if gofmt would change files (Linux/macOS; CI). Skipped on Windows (CRLF false positive). |
| 63 | + cmds: |
| 64 | + - task: fmt:check:windows |
| 65 | + - task: fmt:check:unix |
| 66 | + |
| 67 | + fmt:check:windows: |
| 68 | + internal: true |
| 69 | + platforms: [windows] |
| 70 | + cmds: |
| 71 | + - cmd /c echo skip gofmt -l on Windows CI still checks |
| 72 | + |
| 73 | + fmt:check:unix: |
| 74 | + internal: true |
| 75 | + platforms: [linux, darwin] |
| 76 | + cmds: |
| 77 | + - | |
| 78 | + files=$(gofmt -l .) |
| 79 | + if [ -n "$files" ]; then |
| 80 | + echo unformatted: |
| 81 | + echo "$files" |
| 82 | + exit 1 |
| 83 | + fi |
| 84 | +
|
| 85 | + build: |
| 86 | + desc: Build squad-oc |
| 87 | + cmds: |
| 88 | + - go build -o {{.BINARY}} ./cmd/squad-oc |
| 89 | + |
| 90 | + install: |
| 91 | + desc: go install ./cmd/squad-oc onto GOPATH/bin |
| 92 | + cmds: |
| 93 | + - go install ./cmd/squad-oc |
| 94 | + |
| 95 | + clean: |
| 96 | + desc: Remove local binary, dist/, and coverage.out |
| 97 | + cmds: |
| 98 | + - '{{if eq OS "windows"}}cmd /c if exist {{.BINARY}} del /q {{.BINARY}} & if exist dist rmdir /s /q dist & if exist coverage.out del /q coverage.out{{else}}rm -rf {{.BINARY}} dist coverage.out{{end}}' |
| 99 | + |
| 100 | + vuln: |
| 101 | + desc: govulncheck |
| 102 | + cmds: |
| 103 | + - govulncheck ./... |
| 104 | + |
| 105 | + actionlint: |
| 106 | + desc: Lint GitHub workflow YAML |
| 107 | + cmds: |
| 108 | + - actionlint |
| 109 | + |
| 110 | + ci: |
| 111 | + desc: Local CI gate matching .github/workflows/ci.yml |
| 112 | + deps: [fmt:check, vet, lint, test:race, build, vuln, actionlint] |
| 113 | + |
| 114 | + langfuse:up: |
| 115 | + desc: Start local Langfuse v4 on 127.0.0.1:3000 |
| 116 | + cmds: |
| 117 | + - docker compose -f {{.COMPOSE}} up -d |
| 118 | + |
| 119 | + langfuse:down: |
| 120 | + desc: Stop local Langfuse (keeps volumes) |
| 121 | + cmds: |
| 122 | + - docker compose -f {{.COMPOSE}} down |
| 123 | + |
| 124 | + langfuse:down:volumes: |
| 125 | + desc: Stop local Langfuse and remove squad-oc-langfuse-* volumes |
| 126 | + cmds: |
| 127 | + - docker compose -f {{.COMPOSE}} down -v |
| 128 | + |
| 129 | + live:e2e: |
| 130 | + desc: Dummy PONG check (D:\xAI\squad-oc-dummy only) |
| 131 | + cmds: |
| 132 | + - "{{.PWSH}} -File scripts/live-e2e.ps1" |
| 133 | + |
| 134 | + live:traces: |
| 135 | + desc: Dummy traces + optional local Langfuse OTLP |
| 136 | + cmds: |
| 137 | + - "{{.PWSH}} -File scripts/live-traces.ps1" |
| 138 | + |
| 139 | + live:traces:skip-langfuse: |
| 140 | + desc: Dummy traces only (no Langfuse) |
| 141 | + cmds: |
| 142 | + - "{{.PWSH}} -File scripts/live-traces.ps1 -SkipLangfuse" |
| 143 | + |
| 144 | + live:models: |
| 145 | + desc: Dummy per-agent model pin check |
| 146 | + cmds: |
| 147 | + - "{{.PWSH}} -File scripts/live-models.ps1" |
| 148 | + |
| 149 | + release:check: |
| 150 | + desc: Validate .goreleaser.yaml |
| 151 | + cmds: |
| 152 | + - goreleaser check |
| 153 | + |
| 154 | + release: |
| 155 | + desc: Local GoReleaser snapshot into dist/ (no tag, no GitHub publish) |
| 156 | + cmds: |
| 157 | + - goreleaser release --snapshot --clean |
| 158 | + |
| 159 | + release:tag: |
| 160 | + desc: Annotated tag TAG=vX.Y.Z on main HEAD only (does not push) |
| 161 | + requires: |
| 162 | + vars: [TAG] |
| 163 | + cmds: |
| 164 | + - task: release:tag:windows |
| 165 | + - task: release:tag:unix |
| 166 | + |
| 167 | + release:tag:windows: |
| 168 | + internal: true |
| 169 | + platforms: [windows] |
| 170 | + cmds: |
| 171 | + - powershell -NoProfile -File scripts/release-tag.ps1 -Tag {{.TAG}} |
| 172 | + |
| 173 | + release:tag:unix: |
| 174 | + internal: true |
| 175 | + platforms: [linux, darwin] |
| 176 | + cmds: |
| 177 | + - bash scripts/release-tag.sh {{.TAG}} |
| 178 | + |
| 179 | + release:push: |
| 180 | + desc: Push existing tag TAG=vX.Y.Z to origin (starts GitHub release workflow) |
| 181 | + requires: |
| 182 | + vars: [TAG] |
| 183 | + cmds: |
| 184 | + - git push origin {{.TAG}} |
| 185 | + |
| 186 | + bump: |
| 187 | + desc: Pin Homebrew/Scoop/winget from dist/ (TAG=vX.Y.Z). Does not open a PR. |
| 188 | + requires: |
| 189 | + vars: [TAG] |
| 190 | + cmds: |
| 191 | + - bash -c "TAG='{{.TAG}}' REPO='{{.REPO | default "xeaser/squad-opencode"}}' DIST='{{.DIST | default "dist"}}' scripts/copy-packaging-from-dist.sh" |
0 commit comments