-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (68 loc) · 1.98 KB
/
Makefile
File metadata and controls
91 lines (68 loc) · 1.98 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
.PHONY: build run test clean install lint fmt vet smoke harness harness-fast harness-private evals
# Build variables
BINARY_NAME=simple-agent
BUILD_DIR=./build
MAIN_PATH=./cmd/simple-agent
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOFMT=gofumpt
GOVET=$(GOCMD) vet
GOLINT=golangci-lint
# Build flags
LDFLAGS=-ldflags "-w -s"
all: test build
build:
$(GOBUILD) $(LDFLAGS) -o $(BINARY_NAME) $(MAIN_PATH)
build-all:
GOOS=darwin GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 $(MAIN_PATH)
GOOS=darwin GOARCH=arm64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 $(MAIN_PATH)
GOOS=linux GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 $(MAIN_PATH)
GOOS=windows GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe $(MAIN_PATH)
run:
$(GOBUILD) -o $(BINARY_NAME) $(MAIN_PATH)
./$(BINARY_NAME)
test:
$(GOTEST) -v -race -coverprofile=coverage.out ./...
test-coverage:
$(GOTEST) -v -race -coverprofile=coverage.out ./...
$(GOCMD) tool cover -html=coverage.out -o coverage.html
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -rf $(BUILD_DIR)
rm -f coverage.out coverage.html
install:
$(GOBUILD) $(LDFLAGS) -o $(GOPATH)/bin/$(BINARY_NAME) $(MAIN_PATH)
deps:
$(GOMOD) download
$(GOMOD) tidy
lint:
$(GOLINT) run
fmt:
$(GOFMT) -w .
vet:
$(GOVET) ./...
smoke: build
./$(BINARY_NAME) tools list
./$(BINARY_NAME) --help >/dev/null
harness:
go run ./scripts/run_harness --mode public
harness-fast:
go run ./scripts/run_harness --mode fast
harness-private:
go run ./scripts/run_harness --mode private
evals: build
SIMPLE_AGENT_BINARY=./$(BINARY_NAME) go run ./scripts/run_public_evals --json
# Development helpers
dev-deps:
go install mvdan.cc/gofumpt@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Run with live reload (requires air)
watch:
air
.DEFAULT_GOAL := build