-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
220 lines (193 loc) · 5.79 KB
/
Taskfile.yaml
File metadata and controls
220 lines (193 loc) · 5.79 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
# https://taskfile.dev
version: '3'
vars:
BINARY_NAME: bin/dockbridge
tasks:
default:
desc: Show available tasks
cmds:
- task --list
build:
desc: Build the binary
sources:
- ./**/*.go
- go.mod
- go.sum
generates:
- "{{.BINARY_NAME}}"
cmds:
- go build -o {{.BINARY_NAME}} ./cmd/dockbridge
test:
desc: Run tests
sources:
- ./**/*.go
cmds:
- go test ./...
package:mac:
desc: Package the app for macOS
cmds:
- echo "Packaging for macOS..."
- mkdir -p bin
- fyne package -os darwin -icon {{.TASKFILE_DIR}}/gui/assets/icon.png -name DockBridge -src ./cmd/dockbridge-gui
- mv DockBridge.app bin/
- echo "Packaging complete (Mac)"
package:windows:
desc: Package the app for Windows
cmds:
- echo "Packaging for Windows..."
- mkdir -p bin
- fyne package -os windows -icon {{.TASKFILE_DIR}}/gui/assets/icon.png -name DockBridge.exe -src ./cmd/dockbridge-gui
- mv DockBridge.exe bin/
- echo "Packaging complete (Windows)"
package:linux:
desc: Package the app for Linux
cmds:
- echo "Packaging for Linux..."
- mkdir -p bin
- fyne package -os linux -icon {{.TASKFILE_DIR}}/gui/assets/icon.png -name DockBridge -src ./cmd/dockbridge-gui
- mv DockBridge.tar.xz bin/ || mv DockBridge bin/
- echo "Packaging complete (Linux)"
lint:
desc: Run golangci-lint (only if Go files changed)
deps: [golangci-lint:install]
sources:
- ./**/*.go
cmds:
- golangci-lint run ./...
golangci-lint:install:
desc: Install golangci-lint if not present
status:
- which golangci-lint
cmds:
- echo "Installing golangci-lint..."
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin
- echo "✅ golangci-lint installed"
modernize:
desc: Run modernize linter to check for code modernizations
deps: [golangci-lint:install]
cmds:
- golangci-lint run --enable-only modernize ./...
modernize:fix:
desc: Run modernize linter and automatically fix issues
deps: [golangci-lint:install]
cmds:
- golangci-lint run --fix --enable-only modernize ./...
fmt:
desc: Format code
cmds:
- go fmt ./...
security:install:gosec:
desc: Install gosec if not present
status:
- which gosec
cmds:
- curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
security:install:govulncheck:
desc: Install govulncheck if not present
status:
- which govulncheck
cmds:
- go install golang.org/x/vuln/cmd/govulncheck@latest
security:gosec:
desc: Run gosec security scanner
deps: [security:install:gosec]
sources:
- ./**/*.go
cmds:
- gosec -exclude=G104 -exclude-dir=ssh-docker-proxy ./...
- cd ssh-docker-proxy && gosec -exclude=G104 ./...
security:govulncheck:
desc: Run govulncheck security scanner
deps: [security:install:govulncheck]
sources:
- go.mod
- go.sum
cmds:
- govulncheck ./...
security:install:trivy:
desc: Install trivy if not present
status:
- which trivy
cmds:
- |
echo "Installing trivy..."
if [ "$(uname)" = "Darwin" ]; then
brew install aquasecurity/trivy/trivy
else
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b $(go env GOPATH)/bin
fi
echo "✅ trivy installed"
security:trivy:
desc: Run trivy filesystem scan
deps: [security:install:trivy]
cmds:
- trivy fs --severity CRITICAL,HIGH .
security:
desc: Run security checks (gosec, govulncheck, trivy)
deps: [security:gosec, security:govulncheck, security:trivy]
check:
desc: Run all checks (fmt, lint, security, test) - for pre-commit
cmds:
- task: fmt
- task: lint
- task: security
- task: test
# Git hooks
hooks:install:
desc: Install git pre-commit hook
cmds:
- |
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/sh
# Run checks only on changed Go files
task check
EOF
chmod +x .git/hooks/pre-commit
echo "✅ Pre-commit hook installed (runs: task check)"
hooks:uninstall:
desc: Remove git pre-commit hook
cmds:
- rm -f .git/hooks/pre-commit
- echo "✅ Pre-commit hook removed"
# Release tasks
release:patch:
desc: Create a patch release (v1.0.0 -> v1.0.1)
cmds:
- task: release
vars: { BUMP: patch }
release:minor:
desc: Create a minor release (v1.0.0 -> v1.1.0)
cmds:
- task: release
vars: { BUMP: minor }
release:major:
desc: Create a major release (v1.0.0 -> v2.0.0)
cmds:
- task: release
vars: { BUMP: major }
release:
desc: Create and push a release tag
internal: true
vars:
CURRENT_TAG:
sh: git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"
MAJOR:
sh: echo {{.CURRENT_TAG}} | sed 's/v//' | cut -d. -f1
MINOR:
sh: echo {{.CURRENT_TAG}} | sed 's/v//' | cut -d. -f2
PATCH:
sh: echo {{.CURRENT_TAG}} | sed 's/v//' | cut -d. -f3
NEW_TAG:
sh: |
case "{{.BUMP}}" in
major) echo "v$(({{.MAJOR}}+1)).0.0" ;;
minor) echo "v{{.MAJOR}}.$(({{.MINOR}}+1)).0" ;;
patch) echo "v{{.MAJOR}}.{{.MINOR}}.$(({{.PATCH}}+1))" ;;
esac
cmds:
- echo "Current version{{":"}} {{.CURRENT_TAG}}"
- echo "New version{{":"}} {{.NEW_TAG}}"
- git tag {{.NEW_TAG}}
- git push origin {{.NEW_TAG}}
- echo "✅ Released {{.NEW_TAG}}"
- echo "GitHub Actions will now build and publish the release"