Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathMakefile
More file actions
Latest commit
80 lines (63 loc) · 2.26 KB
/
Copy pathMakefile
File metadata and controls
80 lines (63 loc) · 2.26 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
.PHONY: build test run run-log clean lint fmt vet build-full install generate_screenshots
INSTALL_DIR ?= /usr/local/bin
BINARY_NAME=matcha
BUILD_DIR=bin
generate_gif:
alias matcha="go run ."
vhs demo.tape
mv demo.gif public/assets/demo.gif
generate_screenshots:
@mkdir -p docs/docs/assets/features/
@for tape in screenshots/*.tape;do\
[ "$$(basename $$tape)"="common.tape" ] &&continue;\
name=$$(basename "$$tape" .tape);\
echo"==> Generating screenshot: $$name";\
vhs "$$tape"||echo"Warning: $$name failed";\
done
@mv screenshots/*.png docs/docs/assets/features/ 2>/dev/null ||true
@rm -f screenshots/*.gif 2>/dev/null ||true
@echo "Screenshots saved to docs/docs/assets/features/"
build:
go build -o $(BUILD_DIR)/$(BINARY_NAME).
install:
@echo "Building and installing $(BINARY_NAME)..."
@EXISTING=$$(which $(BINARY_NAME) 2>/dev/null);\
DEST=$$([ -n "$$EXISTING" ] && dirname "$$EXISTING" || echo "$(INSTALL_DIR)");\
VERSION=$$([ -n "$(VERSION)" ] && echo "$(VERSION)" || git describe --tags --abbrev=0 2>/dev/null || echo "dev");\
COMMIT=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown");\
DATE=$$(date +%Y-%m-%d);\
echo"Version: $$VERSION";\
echo"Commit: $$COMMIT";\
echo"Date: $$DATE";\
go build -ldflags="-X 'main.version=$$VERSION' -X 'main.commit=$$COMMIT' -X 'main.date=$$DATE'" -o $(BUILD_DIR)/$(BINARY_NAME).;\
install -m 755 $(BUILD_DIR)/$(BINARY_NAME)"$$DEST/$(BINARY_NAME)";\
echo"Installed to $$DEST/$(BINARY_NAME)"
build-full:
@echo "Building with version information..."
@VERSION=$$(git describe --tags --abbrev=0 2>/dev/null || echo "dev");\
COMMIT=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown");\
DATE=$$(date +%Y-%m-%d);\
echo"Version: $$VERSION";\
echo"Commit: $$COMMIT";\
echo"Date: $$DATE";\
go build -ldflags="-X 'main.version=$$VERSION' -X 'main.commit=$$COMMIT' -X 'main.date=$$DATE'" -o $(BUILD_DIR)/$(BINARY_NAME)-full .;
run:
go run .
run-log:
go run . --debug --logs
test:
go test ./...
test-verbose:
go test -v ./...
test-coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
clean:
rm -rf $(BUILD_DIR)
rm -f coverage.out coverage.html
fmt:
go fmt ./...
vet:
go vet ./...
lint: fmt vet
all: lint test build