-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (38 loc) · 1.12 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
46
.DEFAULT_GOAL := build
MIG_VERSION = $(shell cat version.txt)
BUILD_TIME = $(shell date +"%Y-%m-%dT%H:%M:%S%z")
# Strip debug info
GO_FLAGS += "-ldflags=-s -w -X 'github.com/tlhunter/mig/commands.Version=$(MIG_VERSION)' -X 'github.com/tlhunter/mig/commands.BuildTime=$(BUILD_TIME)'"
build:
go build $(GO_FLAGS) -o mig
tiny: build
upx mig
multi:
echo "Linux amd64 (x86)"
GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o mig-linux-amd64
echo "Windows amd64 (x86)"
GOOS=windows GOARCH=amd64 go build $(GO_FLAGS) -o mig.exe
echo "macOS amd64 (Intel)"
GOOS=darwin GOARCH=amd64 go build $(GO_FLAGS) -o mig-macos-amd64
echo "macOS arm64 (Apple Silicon)"
GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o mig-macos-arm64
publish: build
git commit -am "version v$(MIG_VERSION)"
git tag "v$(MIG_VERSION)"
git push origin main "v$(MIG_VERSION)"
# unit tests
test: build
go test -v ./...
# integration tests
#integration: build
# cd tests/postgres
# sh ../test.mjs
# cd ../mysql
# sh ../test.mjs
# cd ../..
clean:
rm mig || true
rm mig-linux-amd64 || true
rm mig.exe || true
rm mig-macos-amd64 || true
rm mig-macos-arm64 || true