-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile.yml
More file actions
187 lines (165 loc) · 5.63 KB
/
Copy pathTaskfile.yml
File metadata and controls
187 lines (165 loc) · 5.63 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
---
version: "3"
vars:
APP_NAME: adl
VERSION: 0.44.1
BUILD_DIR: bin
DIST_DIR: dist
ADL_SCHEMA_VERSION: v0.16.0
ADL_SCHEMA_URL: https://raw.githubusercontent.com/inference-gateway/adl/{{.ADL_SCHEMA_VERSION}}/schema/v1/schema.json
ADL_SCHEMA_PATH: internal/schema/schema.json
tasks:
build:
desc: Build the adl CLI
cmds:
- mkdir -p {{.BUILD_DIR}}
- go build -ldflags "-X main.Version={{.VERSION}}" -o {{.BUILD_DIR}}/{{.APP_NAME}} .
install:
desc: Install the adl CLI to GOPATH/bin as 'adl'
cmds:
- go build -ldflags "-X main.Version={{.VERSION}}" -o "$(go env GOPATH)/bin/{{.APP_NAME}}" .
test:
desc: Run tests
cmds:
- go test -v ./...
test:coverage:
desc: Run tests with coverage
cmds:
- go test -v -cover ./...
fmt:
desc: Format and vet code
cmd: |
go fmt ./...
format:
desc: Run prettier formatter
cmd: |
prettier . --write
vet:
desc: Run go vet
cmd: |
go vet ./...
lint:
desc: Run linter
cmds:
- golangci-lint run
lint:md:
desc: Run markdownlint
cmds:
- markdownlint '**/*.md' --ignore CHANGELOG.md
lint:md:fix:
desc: Run markdownlint
cmds:
- markdownlint '**/*.md' --ignore CHANGELOG.md --fix
mod:
desc: Download dependencies
cmds:
- go mod download
- go mod tidy
fetch-schema:
desc: Fetch the canonical ADL JSON Schema from inference-gateway/adl
cmds:
- curl -fsSL -o {{.ADL_SCHEMA_PATH}} {{.ADL_SCHEMA_URL}}
verify-schema:
desc: Verify the committed schema matches the pinned upstream version
cmds:
- |
tmp=$(mktemp)
trap "rm -f $tmp" EXIT
curl -fsSL -o "$tmp" {{.ADL_SCHEMA_URL}}
if ! diff -u {{.ADL_SCHEMA_PATH}} "$tmp"; then
echo "ERROR: {{.ADL_SCHEMA_PATH}} differs from upstream {{.ADL_SCHEMA_VERSION}}."
echo "Run 'task fetch-schema' to sync, or bump ADL_SCHEMA_VERSION."
exit 1
fi
generate-types:
desc: Generate internal/schema/types.go from the canonical schema
cmds:
- |
tmp=$(mktemp -t adl-schema-annotated.XXXXXX)
trap "rm -f $tmp" EXIT
go run ./internal/schema/annotate {{.ADL_SCHEMA_PATH}} > "$tmp"
go run github.com/atombender/go-jsonschema@v0.23.1 \
--package schema \
--schema-root-type=https://adl.inference-gateway.com/schemas/agent/v1=ADL \
--capitalization ID --capitalization URL --capitalization SCM \
--capitalization CPU --capitalization API --capitalization CI --capitalization CD \
--capitalization AI \
--capitalization CloudRun --capitalization DevContainer --capitalization TypeScript \
--only-models \
--output internal/schema/types.go \
"$tmp"
- gofmt -r 'interface{} -> any' -w internal/schema/types.go
- go fmt ./internal/schema/...
clean:
desc: Clean build artifacts
cmds:
- rm -rf {{.BUILD_DIR}}
- rm -rf {{.DIST_DIR}}
dev:
desc: Run in development mode
deps:
- build
cmds:
- ./{{.BUILD_DIR}}/{{.APP_NAME}} {{.CLI_ARGS}}
examples:test:
desc: Test all example ADL files
deps:
- build
cmds:
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/go-agent.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/go-agent-builtin-tools.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/go-agent-artifacts-filesystem.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/go-agent-artifacts-minio.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/cloudrun-agent.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/cloudrun-ghcr-agent.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/kubernetes-agent.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/vercel-agent.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/cloudflare-agent.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/rust-agent.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/rust-agent-redis.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/rust-agent-ai.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/typescript-agent.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/typescript-agent-tools.yaml
- ./{{.BUILD_DIR}}/{{.APP_NAME}} validate examples/typescript-agent-ai.yaml
examples:generate:
desc: Generate all example projects
deps:
- build
cmds:
- rm -rf test-output
- mkdir -p test-output
- for:
- go-agent
- go-agent-builtin-tools
- go-agent-artifacts-filesystem
- go-agent-artifacts-minio
- cloudrun-agent
- cloudrun-ghcr-agent
- kubernetes-agent
- vercel-agent
- cloudflare-agent
- rust-agent
- rust-agent-redis
- rust-agent-ai
- typescript-agent
- typescript-agent-tools
- typescript-agent-ai
cmd: |
./{{.BUILD_DIR}}/{{.APP_NAME}} generate --file examples/{{.ITEM}}.yaml --output test-output/{{.ITEM}} --overwrite
cp examples/{{.ITEM}}.yaml test-output/{{.ITEM}}/agent.yaml
release:
desc: Build release binaries for multiple platforms
cmds:
- GORELEASER_CURRENT_TAG=v{{.VERSION}} goreleaser release --snapshot --clean --skip=publish
docker:build:
desc: Build Docker image
cmds:
- docker build -t {{.APP_NAME}}:{{.VERSION}} .
ci:
desc: Run CI pipeline (fmt, lint, test, build, verify-schema)
cmds:
- task: fmt
- task: lint
- task: test
- task: build
- task: verify-schema