-
Notifications
You must be signed in to change notification settings - Fork 157
/
Makefile
43 lines (34 loc) · 843 Bytes
/
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
# Helpers
IS_DARWIN := $(filter Darwin,$(shell uname -s))
define set_env
sed $(if $(IS_DARWIN),-i "",-i) -e "s/^#*\($(1)=\).*/$(if $(2),,#)\1$(2)/" .env
endef
EXEC := docker compose exec main
# Environment recipes
.PHONY: default
default: init up
.PHONY: init
init:
test -f .env || cp .env.example .env
$(call set_env,USER_ID,$(shell id -u))
.PHONY: up
up:
DOCKER_BUILDKIT=1 docker compose up -d --build
.PHONY: down
down:
docker compose down
.PHONY: shell
shell:
$(EXEC) zsh
# Project recipes
.PHONY: build
build:
$(EXEC) ./scripts/set-versions.sh $(NETBOX_VERSION) $(NETBOX_DOCKER_VERSION)
./scripts/fetch-spec.sh $$(cat api/netbox_version) $$(cat api/netbox_docker_version)
$(EXEC) ./scripts/fix-spec.py
./scripts/generate-code.sh
$(EXEC) go mod tidy
$(EXEC) goimports -w .
.PHONY: test
test:
$(EXEC) go test -v ./...