-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (55 loc) · 1.31 KB
/
Copy pathMakefile
File metadata and controls
69 lines (55 loc) · 1.31 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
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
PKGNAME := esbulk
TARGETS := esbulk
VERSION := 0.7.32
SHELL := /bin/bash
# testing against elasticsearch may require larger amounts of memory
.PHONY: test
test:
go test -cover -v
.PHONY: imports
imports:
goimports -w .
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: all
all: fmt test
go build -o esbulk cmd/esbulk/main.go
.PHONY: install
install:
go install
.PHONY: clean
clean:
go clean
rm -f coverage.out
rm -f $(TARGETS)
rm -f esbulk-*.x86_64.rpm
rm -f esbulk-* .aarch64.rpm
rm -f esbulk_*.deb
rm -rf logs/
.PHONY: cover
cover:
go get -d && go test -v -coverprofile=coverage.out
go tool cover -html=coverage.out
esbulk:
CGO_ENABLED=0 go build -o esbulk cmd/esbulk/main.go
# ==== packaging ====
#
# Packaging deb, rpm requires "nfpm" https://nfpm.goreleaser.com/
#
# $ go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
.PHONY: image
image:
DOCKER_CONTENT_TRUST=0 docker build --rm -t tirtir/esbulk:latest -t tirtir/esbulk:$(VERSION) .
docker image prune --force --filter label=stage=intermediate
.PHONY: rmi
rmi:
docker rmi tirtir/esbulk:$(VERSION)
.PHONY: deb
deb: $(TARGETS)
GOARCH=amd64 SEMVER=$(VERSION) nfpm package -p deb
GOARCH=arm64 SEMVER=$(VERSION) nfpm package -p deb
.PHONY: rpm
rpm: $(TARGETS)
GOARCH=amd64 SEMVER=$(VERSION) nfpm package -p rpm
GOARCH=arm64 SEMVER=$(VERSION) nfpm package -p rpm