-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmakefile
More file actions
75 lines (59 loc) · 2.08 KB
/
Copy pathmakefile
File metadata and controls
75 lines (59 loc) · 2.08 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
# Check to see if we can use ash, in Alpine images, or default to BASH.
# On Windows/MSYS2, derive bash.exe from the default sh.exe path.
# On Unix, uses `which` to find bash for environments like NixOS where
# bash lives in the Nix store rather than /bin/bash.
ifeq ($(OS),Windows_NT)
SHELL := $(subst sh.exe,bash.exe,$(SHELL))
else
SHELL := $(if $(wildcard /bin/ash),/bin/ash,$(shell which bash 2>/dev/null || echo /bin/sh))
endif
# ==============================================================================
# Project setup
# `setup` installs the non-Go tools required to run the full test suite.
# Currently the only such tool is `uv`, which TestRequestsAgainstTemplates
# uses to invoke scripts/render_python.py and produce the canonical
# HuggingFace Jinja2 reference output to compare against.
#
# On macOS this uses Homebrew. On Linux/CI the GitHub workflow installs uv
# via the astral-sh/setup-uv action, so this target is mostly for local dev.
setup:
@if command -v uv >/dev/null 2>&1; then \
echo "uv already installed: $$(uv --version)"; \
elif command -v brew >/dev/null 2>&1; then \
echo "Installing uv via Homebrew..."; \
brew install uv; \
else \
echo "Neither uv nor brew is installed."; \
echo "Install uv from https://docs.astral.sh/uv/getting-started/installation/"; \
exit 1; \
fi
# ==============================================================================
# Go Modules support
tidy:
go mod tidy
deps-upgrade: bui-upgrade
go get -u -v ./...
go mod tidy
# ==============================================================================
# Tests
lint:
go vet ./...
go tool staticcheck -checks=all ./...
vuln-check:
go tool govulncheck ./...
diff:
go fix -diff ./...
test-only:
@echo ========== RUN TESTS ==========
go test -v -count=1 ./...
test: test-only lint vuln-check diff
bench:
go test -bench=. -benchmem -count=1 -benchtime=3s
# ==============================================================================
# Examples
example-basic:
go run ./examples/basic/
example-chat:
go run ./examples/chat/
example-toolcall:
go run ./examples/toolcall/