go 1.16 features
- use go embed instead of go-binary and remove all about old assets (go 1.16 feature) - pin gox version (go 1.16 feature) - update ci to go 1.16
This commit is contained in:
29
Makefile
29
Makefile
@@ -2,7 +2,6 @@ TARGETS = darwin/amd64 linux/amd64 linux/386 windows/amd64 windows/386
|
||||
GIT_COMMIT = $(shell git rev-parse HEAD)
|
||||
BUILD_TIME = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
|
||||
GO_VERSION = $(shell go version | awk {'print $$3'})
|
||||
BINDATA_IGNORE = $(shell git ls-files -io --exclude-standard $< | sed 's/^/-ignore=/;s/[.]/[.]/g')
|
||||
DOCKER_RELEASE_TAG = "sosedoff/pgweb:$(shell git describe --abbrev=0 --tags | sed 's/v//')"
|
||||
DOCKER_LATEST_TAG = "sosedoff/pgweb:latest"
|
||||
|
||||
@@ -18,35 +17,29 @@ usage:
|
||||
@echo "make test : Execute test suite"
|
||||
@echo "make test-all : Execute test suite on multiple PG versions"
|
||||
@echo "make clean : Remove all build files and reset assets"
|
||||
@echo "make assets : Generate production assets file"
|
||||
@echo "make dev-assets : Generate development assets file"
|
||||
@echo "make docker : Build docker image"
|
||||
@echo "make docker-release : Build and tag docker image"
|
||||
@echo "make docker-push : Push docker images to registry"
|
||||
@echo ""
|
||||
|
||||
test:
|
||||
GO111MODULE=on go test -race -cover ./pkg/...
|
||||
go test -race -cover ./pkg/...
|
||||
|
||||
test-all:
|
||||
@./script/test_all.sh
|
||||
@./script/test_cockroach.sh
|
||||
|
||||
assets: static/
|
||||
go-bindata -o pkg/data/bindata.go -pkg data $(BINDATA_OPTS) $(BINDATA_IGNORE) -ignore=[.]gitignore -ignore=[.]gitkeep $<...
|
||||
|
||||
dev-assets:
|
||||
@$(MAKE) --no-print-directory assets BINDATA_OPTS="-debug"
|
||||
|
||||
dev: dev-assets
|
||||
GO111MODULE=on go build
|
||||
dev:
|
||||
go build
|
||||
@echo "You can now execute ./pgweb"
|
||||
|
||||
build: assets
|
||||
GO111MODULE=on go build
|
||||
build:
|
||||
go build
|
||||
@echo "You can now execute ./pgweb"
|
||||
|
||||
release: clean assets
|
||||
release:
|
||||
@echo "Building binaries..."
|
||||
@gox \
|
||||
-osarch "$(TARGETS)" \
|
||||
@@ -54,12 +47,12 @@ release: clean assets
|
||||
-output "./bin/pgweb_{{.OS}}_{{.Arch}}"
|
||||
|
||||
@echo "Building ARM binaries..."
|
||||
GO111MODULE=on GOOS=linux GOARCH=arm GOARM=5 go build \
|
||||
GOOS=linux GOARCH=arm GOARM=5 go build \
|
||||
-ldflags "-s -w -X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \
|
||||
-o "./bin/pgweb_linux_arm_v5"
|
||||
|
||||
@echo "Building ARM64 binaries..."
|
||||
GO111MODULE=on GOOS=linux GOARCH=arm64 GOARM=7 go build \
|
||||
GOOS=linux GOARCH=arm64 GOARM=7 go build \
|
||||
-ldflags "-s -w -X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \
|
||||
-o "./bin/pgweb_linux_arm64_v7"
|
||||
|
||||
@@ -70,13 +63,11 @@ bootstrap:
|
||||
gox -build-toolchain
|
||||
|
||||
setup:
|
||||
go get -u github.com/mitchellh/gox
|
||||
go get -u github.com/go-bindata/go-bindata/...
|
||||
go install github.com/mitchellh/gox@v1.0.1
|
||||
|
||||
clean:
|
||||
@rm -f ./pgweb
|
||||
@rm -rf ./bin/*
|
||||
@rm -f bindata.go
|
||||
|
||||
docker:
|
||||
docker build --no-cache -t pgweb .
|
||||
@@ -88,4 +79,4 @@ docker-release:
|
||||
|
||||
docker-push:
|
||||
docker push $(DOCKER_RELEASE_TAG)
|
||||
docker push $(DOCKER_LATEST_TAG)
|
||||
docker push $(DOCKER_LATEST_TAG)
|
||||
Reference in New Issue
Block a user