-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (46 loc) · 1.37 KB
/
Makefile
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
# Define the binary name
BINARY_NAME=./out/generate-npc
BINARY_DEMO_NAME=./demo/generate-npc
# Define the main package
MAIN_PACKAGE=./cmd/generate-npc
# Go Bin
GO_BIN=$(shell which go)
# Ensure the out directory exists
out:
mkdir -p out
# Install the required tools for go generators
install-tools:
@echo "Parsing tools.go and installing dependencies..."
@cd tools && go list -e -f '{{join .Imports " "}}' tools.go | xargs -t -n 1 $(GO_BIN) install
@echo "all tools installed"
# Build the Go application
build: out
@go build -o $(BINARY_NAME) $(MAIN_PACKAGE)
# Build binary to generate the demo.gif inside the vhs docker container
build-demo: out
env GOOS=linux go build -o $(BINARY_DEMO_NAME) $(MAIN_PACKAGE)
# Run the Go application
run: build
$(BINARY_NAME) $(filter-out $@,$(MAKECMDGOALS))
# Run tests
test:
@go test -v ./...
# Run the linter
lint:
@revive -config .revive.toml -formatter friendly ./...
# Run all checks
check: lint test
save-demo-gif: build-demo
docker run --rm -v ${PWD}/demo:/vhs ghcr.io/charmbracelet/vhs demo.tape
publish-demo-gif: build-demo
docker run --rm -v ${PWD}/demo:/vhs ghcr.io/charmbracelet/vhs demo.tape --publish
# Clean up build artifacts
clean:
rm -f $(BINARY_NAME)
rm -f $(BINARY_DEMO_NAME)
# Default target
all: build
# Hack to make run proxy the arguments to the binary
%:
@true
.PHONY: out build run test lint check clean all