-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
71 lines (54 loc) · 1.71 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
63
64
65
66
67
68
69
70
71
BINARY = onyxia-api
LAST_COMMIT = $(shell git rev-parse HEAD)
.PHONY: help
help: ## This help message
@awk -F: \
'/^([a-z-]+): [a-z- ]*## (.+)$$/ {gsub(/: .*?\s*##/, "\t");print}' \
Makefile \
| expand -t20 \
| sort
##############################################################################
# Tools
.PHONY: pre-commit
pre-commit: ## Run pre-commit compliance tests
pre-commit install
pre-commit run --all-files
##############################################################################
# Go
.PHONY: test
test: ## Run go test
go test
.PHONY: get
get: ## Download required modules
go get ./...
onyxia-api: test ## Test and build the program
go build -o onyxia-api main.go
##############################################################################
# Vagrant
.PHONY: vagrant-variables
vagrant-variables: ## Test vagrant env variables
@echo -n "Checking VAGRANT_BOX_NAME... "
@test -z "$$VAGRANT_BOX_NAME" || echo OK
.PHONY: vagrant-destroy
vagrant-destroy: ## Destroy vagrant boxes
vagrant destroy -f
.PHONY: vagrant-vbox
vagrant-vbox: vagrant-variables ## Test the api using vagrant and virtualbox
vagrant up --provider=virtualbox
vagrant provision
##############################################################################
# Containers
.PHONY: oci
oci: onyxia-api ## Create an OCI image using podman build
podman build --format=oci --tag=${BINARY}:${LAST_COMMIT} .
.PHONY: docker
docker: onyxia-api ## Create a docker image using docker build
docker build --tag=${BINARY}:${LAST_COMMIT} .
##############################################################################
# All
.PHONY: clean
clean: ## Delete produced artifacts
rm -f onyxia-api
.PHONY: all
all: get onyxia-api ## Test and build
@echo