summaryrefslogtreecommitdiff
path: root/Makefile
blob: fb84df759561a8610769b5709c214582a2b3fc61 (plain)
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
PROJECT_NAME := $(shell basename $(shell pwd))
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g')
IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH)

.PHONY: clean setup build test run

sparkled:
	@go build -o sparkled ./cmd/sparkled/main.go

clean:
	@rm -f sparkled

setup:
	@mise install

build: sparkled

test-unit:
	@go clean -testcache
	@go test -shuffle=on ./...

test-integration: build-image
	@go test -tags=integration ./test/integration/...

test: test-unit test-integration

build-image:
	@docker build --tag $(IMAGE_TAG) .

build-builder-image:
	@docker build --target build --tag $(IMAGE_TAG) .

run: build
	BIND_ADDR=:8080 ./sparkled

run-image: build-image
	@docker run -p 8080:80 -it $(IMAGE_TAG)

sh-image: build-builder-image
	@docker run -it $(IMAGE_TAG) /bin/sh