forked from tomodian/release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (35 loc) · 1.06 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
.PHONY: build run test
BUILD := ./build
install:
go install github.com/mitchellh/gox@latest
clean:
mkdir -p $(BUILD)
rm -Rf $(BUILD)/*
bundle-nix:
cd $(BUILD) && find . -type f ! -name '*.exe' | xargs -I % sh -c "mv % release && zip %.zip release && rm -f release"
bundle-windows:
cd $(BUILD) && find . -type f -name '*.exe' | xargs -I % sh -c "mv % release.exe && zip %.zip release.exe && rm -f release.exe"
build: clean
@echo "Building.."
gox -output="$(BUILD)/{{.Dir}}_{{.OS}}_{{.Arch}}" \
-osarch="darwin/amd64" \
-osarch="darwin/arm64" \
-osarch="linux/arm" \
-osarch="linux/amd64" \
-osarch="windows/amd64"
@echo "Bundling.."
$(MAKE) bundle-nix
$(MAKE) bundle-windows
build-darwin: clean
@echo "Building.."
gox -output="$(BUILD)/{{.Dir}}_{{.OS}}_{{.Arch}}" \
-osarch="darwin/amd64" \
-osarch="darwin/arm64"
@echo "Bundling.."
$(MAKE) bundle-nix
run:
go run main.go
test:
go test -cover -count 1 -race -coverprofile=coverage.txt -covermode=atomic ./...
cover:
go test -cover -coverprofile coverage.log ./... && go tool cover -html=coverage.log