Skip to content

Commit 26cb193

Browse files
committed
Create Makefile to help build releases
1 parent b2b06e7 commit 26cb193

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
go-junit-report
2+
build/

Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
VERSION=$(shell git describe --match="v*")
2+
REVISION=$(shell git rev-parse HEAD)
3+
TIMESTAMP=$(shell date +%FT%T)
4+
5+
test:
6+
go test ./...
7+
8+
build/go-junit-report build/go-junit-report.exe: clean
9+
go build --ldflags "-s -X main.Version=$(VERSION) -X main.Revision=$(REVISION) -X main.BuildTime=$(TIMESTAMP)" -o $@
10+
11+
build/go-junit-report-$(VERSION)-$(GOOS)-$(GOARCH).tar.gz: build/go-junit-report
12+
tar czf $@ -C build go-junit-report
13+
14+
build/go-junit-report-$(VERSION)-windows-amd64.zip: build/go-junit-report.exe
15+
zip -j $@ build/go-junit-report.exe
16+
17+
release: test
18+
$(MAKE) GOOS=linux GOARCH=amd64 build/go-junit-report-$(VERSION)-linux-amd64.tar.gz
19+
$(MAKE) GOOS=windows GOARCH=amd64 build/go-junit-report-$(VERSION)-windows-amd64.zip
20+
$(MAKE) GOOS=darwin GOARCH=amd64 build/go-junit-report-$(VERSION)-darwin-amd64.tar.gz
21+
22+
clean:
23+
rm -f build/go-junit-report
24+
rm -f build/go-junit-report.exe
25+
26+
.PHONY: build clean release test

0 commit comments

Comments
 (0)