-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (45 loc) · 1.21 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
GO ?= @go
PACKAGES ?= ./...
TEST_PACKAGES ?= $(PACKAGES)
COVER_PACKAGES ?= $(shell echo $(TEST_PACKAGES) | tr " " ",")
COVER_PROFILE ?= coverage.out
GOLANGCI_LINT ?= @golangci-lint
DOCKER_IMAGE_REGISTRY ?= docker.io/library
DOCKER_IMAGE_REPOSITORY ?= lindenhoney/linden-honey-scraper-go
DOCKER_IMAGE_TAG ?= latest
DOCKER_IMAGE ?= $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REPOSITORY):$(DOCKER_IMAGE_TAG)
.PHONY: all
all: build test
.PNONY: fmt
fmt:
$(GO) fmt $(PACKAGES)
.PHONY: mod/download
mod/download:
$(GO) mod download
.PHONY: prepare
prepare: mod/download fmt
.PHONY: run
run: prepare
$(GO) run -v ./cmd/server
.PHONY: build
build: prepare
$(GO) build -v $(PACKAGES)
.PHONY: install
install: prepare
$(GO) install -v $(PACKAGES)
.PHONY: test
test: prepare
$(GO) test -v -race -coverpkg $(COVER_PACKAGES) -coverprofile $(COVER_PROFILE) $(TEST_PACKAGES)
.PHONY: coverage
coverage: test
$(GO) tool cover -func $(COVER_PROFILE) -o coverage.txt
$(GO) tool cover -html $(COVER_PROFILE) -o coverage.html
.PHONY: lint
lint: prepare
$(GOLANGCI_LINT) run -v
.PHONY: docker/build
docker/build:
@docker build -t $(DOCKER_IMAGE) .
.PHONY: docker/push
docker/push:
@docker push $(DOCKER_IMAGE)