-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
134 lines (112 loc) · 3.35 KB
/
Copy pathTaskfile.yml
File metadata and controls
134 lines (112 loc) · 3.35 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
version: '3'
vars:
GOIMPORTS_VERSION: v0.41.0
GOLANGCI_LINT_VERSION: v2.8.0
YAMLFMT_VERSION: v0.17.2
ACTIONLINT_VERSION: v1.7.10
GHALINT_VERSION: v1.5.5
PINACT_VERSION: v3.9.0
GOVULNCHECK_VERSION: latest
DB_DSN: 'postgres://testuser:testpass@localhost:33432/testdb?sslmode=disable'
tasks:
default:
desc: Show available tasks
cmds:
- task --list
format-go:
desc: Format Go code with goimports
cmds:
- go run golang.org/x/tools/cmd/goimports@{{.GOIMPORTS_VERSION}} -w .
format-yaml:
desc: Format Yaml code with yamlfmt
cmds:
- go run github.com/google/yamlfmt/cmd/yamlfmt@{{.YAMLFMT_VERSION}}
lint-go:
desc: Run golangci-lint
cmds:
- go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@{{.GOLANGCI_LINT_VERSION}} run ./...
lint-go-fix:
desc: Run golangci-lint with auto-fix
cmds:
- go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@{{.GOLANGCI_LINT_VERSION}} run --fix ./...
lint-actions-actionlint:
desc: Run actionlint for GitHub Actions workflows
cmds:
- go run github.com/rhysd/actionlint/cmd/actionlint@{{.ACTIONLINT_VERSION}} -shellcheck= .github/workflows/*.yml
lint-actions-ghalint:
desc: Run ghalint for GitHub Actions workflows
cmds:
- go run github.com/suzuki-shunsuke/ghalint/cmd/ghalint@{{.GHALINT_VERSION}} run
lint-actions-pinact:
desc: Run pinact for GitHub Actions workflows
cmds:
- go run github.com/suzuki-shunsuke/pinact/v3/cmd/pinact@{{.PINACT_VERSION}} run
pinact-update:
desc: Run pinact for GitHub Actions workflows
cmds:
- go run github.com/suzuki-shunsuke/pinact/v3/cmd/pinact@{{.PINACT_VERSION}} run -u
lint-actions:
desc: Run all GitHub Actions workflow linters
cmds:
- task: lint-actions-actionlint
- task: lint-actions-ghalint
lint-actions-fix:
desc: Run all GitHub Actions workflow linters with auto-fix
cmds:
- task: lint-actions-pinact
- task: lint-actions-actionlint
- task: lint-actions-ghalint
db-up:
desc: Start PostgreSQL database with Docker Compose
cmds:
- docker compose up -d
- echo "Waiting for database to be ready..."
- sleep 5
db-down:
desc: Stop PostgreSQL database
cmds:
- docker compose down
db-reset:
desc: Reset database (stop, remove volumes, and start fresh)
cmds:
- docker compose down -v
- docker compose up -d
- echo "Waiting for database to be ready..."
- sleep 5
test-migration:
desc: Run migration tests
cmds:
- go run ./cmd/goose -output=json -dir=./testdata/migrations up
env:
GOOSE_DBSTRING: '{{.DB_DSN}}'
GOOSE_DRIVER: postgres
vuln:
desc: Run vulnerability check with govulncheck
cmds:
- go run golang.org/x/vuln/cmd/govulncheck@{{.GOVULNCHECK_VERSION}} ./...
build:
desc: Build the binary
cmds:
- go build -o bin/goose ./cmd/goose
format:
desc: Run all formatters
cmds:
- task: format-go
- task: format-yaml
lint:
desc: Run all linters
cmds:
- task: lint-go
- task: lint-actions
lint-fix:
desc: Run all linters with auto-fix
cmds:
- task: lint-go-fix
- task: lint-actions-fix
check:
desc: Check build, format, lint
cmds:
- task: build
- task: format
- task: lint
- task: vuln