-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (30 loc) · 1.13 KB
/
Makefile
File metadata and controls
43 lines (30 loc) · 1.13 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
#!/usr/bin/make -f
NAME := satisfy
REPO ?= $(or ${DOCKER_SERVER},smartystreets)
IMAGE := $(REPO)/$(NAME):$(or ${VERSION},current)
IMAGEARCH := $(REPO)/$(NAME)-$(CPU):$(or ${VERSION},current)
PKG := github.com/smarty/$(NAME)/cmd/satisfy
test: fmt
go test -timeout=1s -short -cover ./...
fmt:
go mod tidy && go fmt ./...
coverage:
go test -timeout=1s -race -covermode=atomic -short ./...
clean:
rm -rf workspace/ coverage.txt
compile: clean
GOOS="$(OS)" GOARCH="$(CPU)" GOAMD64="v3" CGO_ENABLED="0" go build -trimpath -ldflags "-X main.ldflagsSoftwareVersion=${VERSION}" -o workspace/satisfy "$(PKG)"
build: coverage compile
install: coverage
GOOS="$(OS)" GOARCH="$(CPU)" CGO_ENABLED="0" go install -trimpath -ldflags "-X main.ldflagsSoftwareVersion=${VERSION}" "$(PKG)"
##########################################################
image: OS ?= linux
image: CPU ?= amd64
image: build
docker build . --no-cache --rm -t "$(IMAGE)"
publish: image
docker push "$(IMAGE)"
publish-amd: build
docker build . --no-cache --rm -t "$(IMAGEARCH)"
docker push "$(IMAGEARCH)"
.PHONY: test fmt coverage clean compile build install image publish