-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (33 loc) · 895 Bytes
/
Copy pathMakefile
File metadata and controls
40 lines (33 loc) · 895 Bytes
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
.PHONY: clean
clean:
git clean -fd
.PHONY: bats-tests
bats-tests: build
docker run \
-v "$(shell pwd):/code" \
-v "$(shell pwd)/build:/usr/local/bin" \
madsbis/bayesh-bats-testing:v6 \
--print-output-on-failure \
--verbose-run \
tests
ifdef BAYESH_VERSION
VERSION := $(BAYESH_VERSION)
else
VERSION := $(shell git describe --tags --always --dirty)
endif
.PHONY: build
build:
rm -rf build && mkdir -p build
go build -ldflags="-X 'main.version=${VERSION}'" -o ./build/bayesh ./main.go
# supported architectures
ARCH := amd64 arm
.PHONY: release
release:
grep -qF $(VERSION) install.sh
rm -rf dist && mkdir -p dist
for arc in $(ARCH); do \
tmpdir=$$(mktemp -d); \
GOARCH=$$arc go build -ldflags="-s -w -X 'main.version=${VERSION}'" -o $$tmpdir/bayesh ./main.go; \
tar -czf ./dist/bayesh-$(VERSION)-linux-$$arc.tar.gz -C $$tmpdir bayesh; \
rm -rf $$tmpdir; \
done