-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile.yml
More file actions
201 lines (168 loc) · 6.01 KB
/
Copy pathTaskfile.yml
File metadata and controls
201 lines (168 loc) · 6.01 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
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
cli:lint:
desc: lint go code using golangci-lint
cmd: golangci-lint run ./...
cli:lint:ci:
desc: lint exactly as CI does (golangci-lint-action only-new-issues -> new-from-patch vs the merge-base with origin/main)
cmds:
- 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:fix:
desc: fix lint issues using golangci-lint
cmd: golangci-lint run --fix ./...
cli:format:
desc: format go code using golangci-lint formatters
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: 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: goreleaser build --id devsy-dev --snapshot --clean
cli:build:dev:pro:
desc: build devsy CLI for pro feature
vars:
NS: '{{.NS | default "default"}}'
cmd: 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
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.4
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
- cli:test:e2e:ginkgo:install
dir: e2e
cmd: go run github.com/onsi/ginkgo/v2/ginkgo@latest
cli:test:e2e:suite:
# usage: task cli:test:e2e:suite -- "test suite name"
desc: run e2e tests suite
deps:
- cli:test:e2e:ginkgo:install
dir: e2e
cmd: go run github.com/onsi/ginkgo/v2/ginkgo@latest --label-filter {{ .CLI_ARGS }}
cli:test:e2e:focus:
# usage: task cli:test:e2e:focus -- "test suite pattern"
desc: run focused e2e tests
deps:
- cli:test:e2e:ginkgo:install
dir: e2e
cmd: go run github.com/onsi/ginkgo/v2/ginkgo@latest --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@latest
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:setup:
desc: setup Electron desktop application
dir: desktop
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
dir: desktop
cmd: 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"