-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (49 loc) · 1.74 KB
/
Copy pathMakefile
File metadata and controls
68 lines (49 loc) · 1.74 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
.PHONY: build test lint run docker-build docker-up docker-down clean fmt tidy npm-publish release-build
# ---------- Build ----------
## Build all binaries.
build:
go build -ldflags="-s -w" -o bin/lark-server ./cmd/lark-server
go build -ldflags="-s -w" -o bin/lark-agent ./cmd/lark-agent
# ---------- Test ----------
## Run all tests with race detector.
test:
go test ./... -race -count=1
# ---------- Lint ----------
## Run golangci-lint.
lint:
golangci-lint run ./...
# ---------- Run ----------
## Build and run the server locally.
run: build
./bin/lark-server
# ---------- Docker ----------
## Build the Docker image.
docker-build:
docker build -t lark-daemon:latest .
## Start services with Docker Compose.
docker-up:
docker compose up -d
## Stop services.
docker-down:
docker compose down
# ---------- Utilities ----------
## Format all Go source files.
fmt:
go fmt ./...
## Tidy module dependencies.
tidy:
go mod tidy
## Remove build artifacts and runtime data.
clean:
rm -rf bin/ data/ coverage.out
# ---------- Release ----------
## Build binaries for all platforms.
release-build:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/lark-daemon-linux-amd64 ./cmd/lark-server
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/lark-daemon-linux-arm64 ./cmd/lark-server
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/lark-daemon-darwin-amd64 ./cmd/lark-server
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/lark-daemon-darwin-arm64 ./cmd/lark-server
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/lark-daemon-windows-amd64.exe ./cmd/lark-server
## Publish the npm wrapper package.
npm-publish:
cd npm && npm publish