Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
154 lines (128 loc) · 3.74 KB
/
Copy pathTaskfile.yml
File metadata and controls
154 lines (128 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# https://taskfile.dev — local CI and release helpers.
# Install: go install github.com/go-task/task/v3/cmd/task@latest
version: "3"
vars:
BINARY: '{{if eq OS "windows"}}squad-oc.exe{{else}}squad-oc{{end}}'
tasks:
default:
desc: List tasks
silent: true
cmds:
- task --list
tools:
desc: Install golangci-lint, govulncheck, actionlint, goreleaser (versions match CI)
cmds:
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2
- go install golang.org/x/vuln/cmd/govulncheck@v1.7.0
- go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.12
- go install github.com/goreleaser/goreleaser/v2@v2.17.1
tidy:
desc: go mod tidy
cmds:
- go mod tidy
cover:
desc: Unit tests with coverage profile
cmds:
- go test -coverprofile=coverage.out ./...
- go tool cover -func=coverage.out
test:
desc: Unit tests (no race, no live OpenCode)
cmds:
- go test ./...
test:race:
desc: Unit tests with -race (needs a C toolchain on Windows)
cmds:
- go test -race -count=1 ./...
vet:
desc: go vet
cmds:
- go vet ./...
lint:
desc: golangci-lint (same timeout as CI)
cmds:
- golangci-lint run --timeout=4m
fmt:
desc: Apply gofmt to all .go files
cmds:
- gofmt -w .
fmt:check:
desc: Fail if gofmt would change files (Linux/macOS; CI). Skipped on Windows (CRLF false positive).
cmds:
- task: fmt:check:windows
- task: fmt:check:unix
fmt:check:windows:
internal: true
platforms: [windows]
cmds:
- cmd /c echo skip gofmt -l on Windows CI still checks
fmt:check:unix:
internal: true
platforms: [linux, darwin]
cmds:
- |
files=$(gofmt -l .)
if [ -n "$files" ]; then
echo unformatted:
echo "$files"
exit 1
fi
build:
desc: Build squad-oc
cmds:
- go build -o {{.BINARY}} ./cmd/squad-oc
install:
desc: go install ./cmd/squad-oc onto GOPATH/bin
cmds:
- go install ./cmd/squad-oc
clean:
desc: Remove local binary, dist/, and coverage.out
cmds:
- '{{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}}'
vuln:
desc: govulncheck
cmds:
- govulncheck ./...
actionlint:
desc: Lint GitHub workflow YAML
cmds:
- actionlint
ci:
desc: Local CI gate matching .github/workflows/ci.yml
deps: [fmt:check, vet, lint, test:race, build, vuln, actionlint]
release:check:
desc: Validate .goreleaser.yaml
cmds:
- goreleaser check
release:
desc: Local GoReleaser snapshot into dist/ (no tag, no GitHub publish)
cmds:
- goreleaser release --snapshot --clean
release:tag:
desc: Annotated tag TAG=vX.Y.Z on main HEAD only (does not push)
requires:
vars: [TAG]
cmds:
- task: release:tag:windows
- task: release:tag:unix
release:tag:windows:
internal: true
platforms: [windows]
cmds:
- powershell -NoProfile -File scripts/release-tag.ps1 -Tag {{.TAG}}
release:tag:unix:
internal: true
platforms: [linux, darwin]
cmds:
- bash scripts/release-tag.sh {{.TAG}}
release:push:
desc: Push existing tag TAG=vX.Y.Z to origin (starts GitHub release workflow)
requires:
vars: [TAG]
cmds:
- git push origin {{.TAG}}
bump:
desc: Pin Homebrew/Scoop/winget from dist/ (TAG=vX.Y.Z). Does not open a PR.
requires:
vars: [TAG]
cmds:
- bash -c "TAG='{{.TAG}}' REPO='{{.REPO | default "xeaser/squad-opencode"}}' DIST='{{.DIST | default "dist"}}' scripts/copy-packaging-from-dist.sh"