-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
288 lines (248 loc) · 9.34 KB
/
Copy pathTaskfile.yml
File metadata and controls
288 lines (248 loc) · 9.34 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
version: "3"
tasks:
cli:tidy:
desc: tidy go.mod and go.sum
cmd: go mod tidy
cli:licenses:
desc: regenerate THIRD_PARTY_LICENSES.md and enforce the license allowlist
cmd: go run ./hack/licenses
cli:licenses:check:
desc: verify THIRD_PARTY_LICENSES.md is in sync and all licenses are allowed (CI)
cmd: go run ./hack/licenses --check
automations:generate:
desc: regenerate .agents/agents/<id>/agent.md from hack/automations
cmd: go run ./hack/automations
automations:check:
desc: verify generated agent prompts are in sync (CI / pre-commit)
cmd: go run ./hack/automations -check
cli:lint:
desc: lint go code using golangci-lint
deps: [cli:lint:version]
cmd: golangci-lint run ./...
cli:lint:ci:
desc: lint using golangci-lint with CI parity
deps: [cli:lint:version]
cmds:
- golangci-lint config verify
- git fetch --quiet origin main
- |
patch="$(mktemp)"
trap 'rm -f "$patch"' EXIT
git diff "$(git merge-base HEAD origin/main)" > "$patch"
golangci-lint run --new-from-patch="$patch" --new=false ./...
cli:lint:version:
desc: assert the local golangci-lint matches .golangci-version (the version CI uses)
cmd: |
want="$(sed 's/^v//' .golangci-version | tr -d '[:space:]')"
cur="$(golangci-lint --version 2>&1 | sed -n 's/.*version \([0-9][0-9A-Za-z.+-]*\).*/\1/p')"
if [ "$cur" != "$want" ]; then
echo "golangci-lint version mismatch: local=${cur:-<not found>}, expected=${want}. Install golangci-lint v${want}." >&2
exit 1
fi
silent: true
cli:lint:fix:
desc: fix lint issues using golangci-lint
deps: [cli:lint:version]
cmd: golangci-lint run --fix ./...
cli:format:
desc: format go code using golangci-lint formatters
deps: [cli:lint:version]
cmd: golangci-lint fmt ./...
cli:act:lint:
desc: run devsy linters using act
cmd: act workflow_dispatch -W .github/workflows/lint.yml
cli:build:
desc: build devsy CLI
env:
GITHUB_REPOSITORY_OWNER: devsy-org
cmd: go tool goreleaser build --id devsy --snapshot --clean
cli:build:dev:
desc: build devsy CLI for development
env:
GITHUB_REPOSITORY_OWNER: devsy-org
DEVSY_CLI_VERSION: v0.0.0
cmd: go tool goreleaser build --id devsy-dev --snapshot --clean
cli:build:dev:pro:
desc: build devsy CLI for pro feature
vars:
NS: '{{.NS | default "default"}}'
cmd: go tool goreleaser build --id devsy-pro-dev --snapshot --clean
env:
GITHUB_REPOSITORY_OWNER: devsy-org
DEVSY_PRO_NS: "{{.NS}}"
cli:build:setup-cache:
desc: setup cache for CLI builds
deps:
- cli:build:dev
cmds:
- task: cli:build:teardown-cache
- mkdir -p "${TMPDIR:-/tmp/}devsy-cache"
- cp dist/devsy-dev_linux_amd64_v1/devsy-linux-amd64 "${TMPDIR:-/tmp/}devsy-cache/devsy-linux-amd64"
cli:build:teardown-cache:
desc: teardown cache for CLI builds
cmds:
- rm -rf "${TMPDIR:-/tmp/}devsy-cache"
cli:build:grpc:
desc: build devsy gRPC code
dir: pkg/agent/tunnel
cmd: |
# sudo apt install protobuf-compiler
# protoc invokes protoc-gen-go and protoc-gen-go-grpc from PATH, so install the plugins to GOBIN first.
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.6.2
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11
export PATH="$(go env GOPATH)/bin:$PATH"
protoc -I . tunnel.proto --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative
cli:test:
desc: run devsy unit tests
cmd: go test $(go list ./... | grep -v -e /test -e /e2e) -race -coverprofile=dist/profile.out -covermode=atomic
cli:test:e2e:build:
desc: build devsy for e2e tests
status:
- test -f e2e/bin/devsy-linux-amd64
cmds:
- task: cli:build:dev
- mkdir -p e2e/bin
- cp dist/devsy-dev_linux_amd64_v1/devsy-linux-amd64 e2e/bin/devsy-linux-amd64
cli:test:e2e:
desc: run e2e tests
deps:
- cli:test:e2e:build
dir: e2e
cmd: go tool ginkgo
cli:test:e2e:suite:
# usage: task cli:test:e2e:suite -- "test suite name"
desc: run e2e tests suite
dir: e2e
cmd: go tool ginkgo --label-filter {{ .CLI_ARGS }}
cli:test:e2e:focus:
# usage: task cli:test:e2e:focus -- "test suite pattern"
desc: run focused e2e tests
dir: e2e
cmd: go tool ginkgo --focus {{ .CLI_ARGS }}
cli:test:e2e:kind:setup:
desc: setup kind cluster for e2e tests
cmd: kind create cluster --image kindest/node:v1.34.0@sha256:7416a61b42b1662ca6ca89f02028ac133a309a2a30ba309614e8ec94d976dc5a
cli:test:e2e:kind:teardown:
desc: teardown kind cluster for e2e tests
cmd: kind delete cluster
cli:test:e2e:ginkgo:install:
desc: install ginkgo for e2e tests
env:
GOPROXY: direct
status: [command -v ginkgo >/dev/null 2>&1]
cmd: go install github.com/onsi/ginkgo/v2/ginkgo
cli:test:e2e:act:focus:
# usage: task cli:test:e2e:act:focus -- "test focus pattern"
desc: run e2e tests using act with focus
cmd: act workflow_dispatch -W .github/workflows/act.yml -j e2e-test --input test_focus={{ .CLI_ARGS }}
desktop:deps:
desc: install Linux desktop runtime dependencies for Electron and Playwright
cmds:
- cmd: sudo apt-get update
- cmd: >-
sudo apt-get install -y
libglib2.0-0 libnspr4 libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0
libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2t64 libpango-1.0-0
libcairo2 libxshmfence1 libgtk-3-0 libxss1 libatspi2.0-0 libnotify4 libxtst6 xdg-utils
libuuid1 xvfb
desktop:setup:
desc: setup Electron desktop application
dir: desktop
deps:
- desktop:deps
cmds:
- task: cli:build:dev
- cmd: mkdir -p resources/bin
- cmd: cp ../dist/devsy-dev_linux_amd64_v1/devsy-linux-amd64 ./resources/bin/devsy
- cmd: chmod +x ./resources/bin/devsy
- cmd: npm ci
desktop:dev:
desc: run desktop application in dev mode
dir: desktop
cmd: npm run electron:dev
desktop:build:
desc: build desktop application
dir: desktop
cmds:
- cmd: npm ci
- task: desktop:check
- cmd: npm run build
desktop:check:
desc: check desktop application
dir: desktop
cmd: npm run check
desktop:test:
desc: run desktop unit tests
dir: desktop
cmd: npm run test
desktop:test:e2e:
desc: run desktop e2e tests
deps:
- desktop:deps
dir: desktop
cmd: |
export DISPLAY=:99
if [ ! -f /tmp/.X99-lock ]; then
Xvfb :99 -screen 0 1280x720x24 >/tmp/devsy-xvfb.log 2>&1 &
# Wait for Xvfb to be ready (max 10 seconds)
for i in $(seq 1 50); do
if [ -f /tmp/.X99-lock ]; then
break
fi
sleep 0.2
done
fi
npm run test:e2e
desktop:act:build:ui:
desc: build desktop ui using act
cmd: act workflow_dispatch -W .github/workflows/act.yml -j build-ui
desktop:act:build:app:
desc: build desktop application using act
cmd: act workflow_dispatch -W .github/workflows/act.yml -j build-desktop
desktop:act:build:flatpak:
desc: build desktop flatpak using act
cmd: act workflow_dispatch -W .github/workflows/act.yml -j build-flatpak
github:dev-release:upload:
desc: upload dev binaries to GitHub release tag v0.0.0-10 for testing
cmds:
- cmd: |
TMP_DIR="$(mktemp -d)"
cp dist/devsy-dev_linux_amd64_v1/devsy-linux-amd64 "$TMP_DIR/devsy-linux-amd64"
gh release upload v0.0.0-10 dist/devsy-dev_linux_amd64_v1/devsy-linux-amd64 --repo devsy-org/devsy --clobber
rm -rf "$TMP_DIR"
github:app:jwt:
desc: |
generate a signed GitHub App JWT (RS256) for app authentication.
Requires DEVSY_GITHUB_APP_ID and either DEVSY_GITHUB_APP_PRIVATE_KEY
(PEM contents) or DEVSY_GITHUB_APP_PRIVATE_KEY_PATH (PEM file path).
cmd: go run ./hack/gen_github_app_jwt
github:app:sign-commit:
# usage: task github:app:sign-commit -- -m "subject" [-b "body"] [files...]
# task github:app:sign-commit -- -m "subject" -pr (commit + open draft PR)
# task github:app:sign-commit -- -m "subject" -pr-only (open draft PR only)
# task github:app:sign-commit -- -token (print the app installation token)
desc: |
create a commit signed by the Devsy GitHub App (devsy-app[bot]) on the
current branch.
Pass -token to print the app installation token instead (used to open PRs
as the app without GITHUB_TOKEN).
Reuses DEVSY_GITHUB_APP_ID / DEVSY_GITHUB_APP_PRIVATE_KEY[_PATH].
cmd: go run ./hack/sign_commit {{.CLI_ARGS}}
setup:agent:
desc: prepare the development environment fully for coding agents
cmds:
- |
if command -v apt-get >/dev/null 2>&1; then
if [ "$(id -u)" -eq 0 ]; then
apt-get update -qq && apt-get install -y protobuf-compiler xvfb
elif command -v sudo >/dev/null 2>&1; then
sudo apt-get update -qq && sudo apt-get install -y protobuf-compiler xvfb
else
echo "Error: Installing packages requires root privileges or sudo" >&2
exit 1
fi
fi
- go install github.com/goreleaser/goreleaser/v2@latest
- task: cli:tidy
- task: cli:build:grpc
- task: desktop:setup