-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (93 loc) · 4.64 KB
/
Makefile
File metadata and controls
107 lines (93 loc) · 4.64 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# =========================================================================== #
# MIT License Copyright (c) 2022 Kris Nóva <kris@nivenly.com> #
# #
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ #
# ┃ ███╗ ██╗ ██████╗ ██╗ ██╗ █████╗ ┃ #
# ┃ ████╗ ██║██╔═████╗██║ ██║██╔══██╗ ┃ #
# ┃ ██╔██╗ ██║██║██╔██║██║ ██║███████║ ┃ #
# ┃ ██║╚██╗██║████╔╝██║╚██╗ ██╔╝██╔══██║ ┃ #
# ┃ ██║ ╚████║╚██████╔╝ ╚████╔╝ ██║ ██║ ┃ #
# ┃ ╚═╝ ╚═══╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ┃ #
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ #
# #
# This machine kills fascists. #
# #
# =========================================================================== #
DATADIR := data
.PHONY: all
all: compile
version ?= 0.0.1
target ?= hachyboop
org ?= hachyderm
authorname ?= Hachyderm Infrastructure Team
authoremail ?= hachyderm@hachyderm.io
license ?= Apache 2.0
year ?= 2025
copyright ?= Copyright (c) $(year)
.PHONY: compile
compile: ## Compile for the local architecture ⚙
@echo "Compiling..."
go build -ldflags "\
-X 'github.com/$(org)/$(target).Version=$(version)' \
-X 'github.com/$(org)/$(target).AuthorName=$(authorname)' \
-X 'github.com/$(org)/$(target).AuthorEmail=$(authoremail)' \
-X 'github.com/$(org)/$(target).Copyright=$(copyright)' \
-X 'github.com/$(org)/$(target).License=$(license)' \
-X 'github.com/$(org)/$(target).Name=$(target)'" \
-o $(target) cmd/*.go
.PHONY: run
run: compile
./hachyboop
.PHONY: container
container:
docker build . -t $(target):latest
.PHONY: runcontainer
runcontainer: container
docker run \
-e HACHYBOOP_S3_ENDPOINT \
-e HACHYBOOP_S3_BUCKET \
-e HACHYBOOP_S3_PATH \
-e HACHYBOOP_S3_ACCESS_KEY_ID \
-e HACHYBOOP_S3_SECRET_ACCESS_KEY \
-e HACHYBOOP_OBSERVER_ID \
-e HACHYBOOP_OBSERVER_REGION \
-e HACHYBOOP_RESOLVERS \
-e HACHYBOOP_QUESTIONS \
-e HACHYBOOP_LOCAL_RESULTS_PATH \
-e BUNNYNET_MC_REGION \
-e BUNNYNET_MC_ZONE \
-e BUNNYNET_MC_APPID \
-e BUNNYNET_MC_PODID \
-e HACHYBOOP_TEST_FREQUENCY_SECONDS \
--mount type=bind,src=data/,dst=/data \
$(target):latest
.PHONY: install
install: ## Install the program to /usr/bin 🎉
@echo "Installing..."
sudo cp $(target) /usr/bin/$(target)
.PHONY: test
test: clean compile install ## 🤓 Run go tests
@echo "Testing..."
go test -v ./...
.PHONY: clean
clean: ## Clean your artifacts 🧼
@echo "Cleaning..."
rm -rvf release/*
rm -rvf ./hachyboop
.PHONY: release
release: ## Make the binaries for a GitHub release 📦
mkdir -p release
GOOS="linux" GOARCH="amd64" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-linux-amd64 cmd/*.go
GOOS="linux" GOARCH="arm" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-linux-arm cmd/*.go
GOOS="linux" GOARCH="arm64" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-linux-arm64 cmd/*.go
GOOS="linux" GOARCH="386" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-linux-386 cmd/*.go
GOOS="darwin" GOARCH="amd64" go build -ldflags "-X 'github.com/$(org)/$(target).Version=$(version)'" -o release/$(target)-darwin-amd64 cmd/*.go
.PHONY: help
help: ## 🤔 Show help messages for make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: querylast
querylast:
duckdb -c "select * from read_parquet('${DATADIR}/$(shell ls -t data | head -n1)');"
.PHONY: queryall
queryall:
duckdb -c "select * from read_parquet('data/*.parquet');"