-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathTaskfile.yml
More file actions
142 lines (124 loc) · 3.77 KB
/
Taskfile.yml
File metadata and controls
142 lines (124 loc) · 3.77 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
version: '3'
vars:
BUILD_DIR: build
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo "dev"
COMMIT:
sh: git rev-parse --short HEAD 2>/dev/null || echo "unknown"
DATE:
sh: date -u +"%Y-%m-%dT%H:%M:%SZ"
LDFLAGS: -ldflags "-X main.version={{.VERSION}} -X main.commit={{.COMMIT}} -X main.date={{.DATE}}"
tasks:
default:
desc: Show available tasks
cmds:
- task --list
deps:
desc: Download and install dependencies
cmds:
- go mod download
- go mod tidy
build:
desc: Build the catalog binary
cmds:
- mkdir -p {{.BUILD_DIR}}
- go build {{.LDFLAGS}} -o {{.BUILD_DIR}}/catalog ./cmd/catalog
sources:
- cmd/catalog/**/*.go
- internal/**/*.go
- go.mod
- go.sum
generates:
- "{{.BUILD_DIR}}/catalog"
catalog:build:
desc: Build registry files from server.json (both formats)
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/catalog build --format all -v
sources:
- registries/**/server.json
generates:
- "{{.BUILD_DIR}}/*/registry.json"
- "{{.BUILD_DIR}}/*/official-registry.json"
catalog:validate:
desc: Validate all server.json entries
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/catalog validate -v
catalog:update-metadata:
desc: Update metadata for a specific server.json file
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/catalog update-metadata {{.SERVER}} {{.CLI_ARGS}}
vars:
SERVER: '{{.SERVER | default ""}}'
preconditions:
- sh: test -n "{{.SERVER}}"
msg: "Please specify a server.json file with SERVER=path/to/server.json"
catalog:update-metadata:oldest:
desc: Update metadata for the N oldest entries
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/catalog update-metadata --oldest {{.COUNT}} -v {{.CLI_ARGS}}
vars:
COUNT: '{{.COUNT | default "5"}}'
catalog:update-metadata:oldest:dry-run:
desc: Preview metadata updates for the N oldest entries
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/catalog update-metadata --oldest {{.COUNT}} --dry-run -v
vars:
COUNT: '{{.COUNT | default "5"}}'
catalog:update-tools:
desc: Update tool lists for a specific server.json file
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/catalog update-tools {{.SERVER}} {{.CLI_ARGS}}
vars:
SERVER: '{{.SERVER | default ""}}'
preconditions:
- sh: test -n "{{.SERVER}}"
msg: "Please specify a server.json file with SERVER=path/to/server.json"
catalog:update-tools:dry-run:
desc: Preview tool list updates for a specific server.json file
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/catalog update-tools {{.SERVER}} --dry-run -v
vars:
SERVER: '{{.SERVER | default ""}}'
preconditions:
- sh: test -n "{{.SERVER}}"
msg: "Please specify a server.json file with SERVER=path/to/server.json"
version:
desc: Show version information
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/catalog version
test:
desc: Run tests
cmds:
- go test -v -race -coverprofile=coverage.out ./...
test:coverage:
desc: Run tests with coverage report
deps: [test]
cmds:
- go tool cover -html=coverage.out -o coverage.html
- 'echo "Coverage report generated: coverage.html"'
lint:
desc: Run linter (requires golangci-lint)
cmds:
- golangci-lint run --allow-parallel-runners ./...
lint:fix:
desc: Run linter with auto-fix
cmds:
- golangci-lint run --allow-parallel-runners --fix ./...
clean:
desc: Clean build artifacts
cmds:
- rm -rf {{.BUILD_DIR}}
- rm -f coverage.out coverage.html
- go clean
watch:
desc: Watch for changes and rebuild (requires entr)
cmds:
- find cmd internal -name '*.go' | entr -c task build