2022-12-02 20:56:18 +03:00
|
|
|
PKG = github.com/sosedoff/pgweb
|
|
|
|
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'})
|
|
|
|
|
2015-03-17 07:59:46 +03:00
|
|
|
DOCKER_RELEASE_TAG = "sosedoff/pgweb:$(shell git describe --abbrev=0 --tags | sed 's/v//')"
|
2016-06-28 04:54:29 +03:00
|
|
|
DOCKER_LATEST_TAG = "sosedoff/pgweb:latest"
|
2022-12-02 20:56:18 +03:00
|
|
|
|
2021-12-31 00:33:43 +03:00
|
|
|
LDFLAGS = -s -w
|
2022-12-02 20:56:18 +03:00
|
|
|
LDFLAGS += -X $(PKG)/pkg/command.GitCommit=$(GIT_COMMIT)
|
|
|
|
LDFLAGS += -X $(PKG)/pkg/command.BuildTime=$(BUILD_TIME)
|
|
|
|
LDFLAGS += -X $(PKG)/pkg/command.GoVersion=$(GO_VERSION)
|
2014-10-31 08:02:58 +03:00
|
|
|
|
2014-12-27 05:50:15 +03:00
|
|
|
usage:
|
|
|
|
@echo ""
|
|
|
|
@echo "Task : Description"
|
|
|
|
@echo "----------------- : -------------------"
|
|
|
|
@echo "make dev : Generate development build"
|
|
|
|
@echo "make build : Generate production build for current OS"
|
|
|
|
@echo "make release : Generate binaries for all supported OSes"
|
2015-04-30 20:10:25 +03:00
|
|
|
@echo "make test : Execute test suite"
|
2016-01-18 00:22:51 +03:00
|
|
|
@echo "make test-all : Execute test suite on multiple PG versions"
|
2022-12-02 01:51:12 +03:00
|
|
|
@echo "make lint : Execute code linter"
|
2014-12-27 05:50:15 +03:00
|
|
|
@echo "make clean : Remove all build files and reset assets"
|
2015-01-01 03:47:21 +03:00
|
|
|
@echo "make docker : Build docker image"
|
2015-03-17 08:01:28 +03:00
|
|
|
@echo "make docker-release : Build and tag docker image"
|
2016-06-28 04:54:29 +03:00
|
|
|
@echo "make docker-push : Push docker images to registry"
|
2014-12-27 05:50:15 +03:00
|
|
|
@echo ""
|
|
|
|
|
2014-12-18 06:39:03 +03:00
|
|
|
test:
|
2021-03-05 03:38:08 +03:00
|
|
|
go test -race -cover ./pkg/...
|
2014-12-18 06:39:03 +03:00
|
|
|
|
2016-01-18 00:22:51 +03:00
|
|
|
test-all:
|
|
|
|
@./script/test_all.sh
|
2018-06-06 02:20:58 +03:00
|
|
|
@./script/test_cockroach.sh
|
2016-01-18 00:22:51 +03:00
|
|
|
|
2022-11-15 01:10:50 +03:00
|
|
|
lint:
|
|
|
|
golangci-lint run
|
|
|
|
|
2021-03-05 03:38:08 +03:00
|
|
|
dev:
|
|
|
|
go build
|
2014-12-14 05:43:07 +03:00
|
|
|
@echo "You can now execute ./pgweb"
|
|
|
|
|
2021-03-05 03:38:08 +03:00
|
|
|
build:
|
2022-12-02 20:56:18 +03:00
|
|
|
go build -ldflags '${LDFLAGS}'
|
2014-12-14 05:43:07 +03:00
|
|
|
@echo "You can now execute ./pgweb"
|
|
|
|
|
2022-09-18 18:14:51 +03:00
|
|
|
install:
|
2022-12-06 20:09:13 +03:00
|
|
|
go install -ldflags '${LDFLAGS}'
|
2022-09-18 18:14:51 +03:00
|
|
|
@echo "You can now execute pgweb"
|
|
|
|
|
2022-07-27 04:17:40 +03:00
|
|
|
release: clean
|
2015-05-07 05:24:15 +03:00
|
|
|
@echo "Building binaries..."
|
2022-07-27 04:17:40 +03:00
|
|
|
@LDFLAGS='${LDFLAGS}' ./script/build_all.sh
|
2014-10-11 02:32:47 +04:00
|
|
|
|
|
|
|
clean:
|
2022-07-27 04:17:40 +03:00
|
|
|
@echo "Removing all artifacts"
|
|
|
|
@rm -rf ./pgweb ./bin/*
|
2014-11-06 03:27:14 +03:00
|
|
|
|
|
|
|
docker:
|
2019-12-17 02:26:23 +03:00
|
|
|
docker build --no-cache -t pgweb .
|
2015-03-17 07:59:46 +03:00
|
|
|
|
|
|
|
docker-release:
|
2019-07-25 01:28:15 +03:00
|
|
|
docker build --no-cache -t $(DOCKER_RELEASE_TAG) .
|
|
|
|
docker tag $(DOCKER_RELEASE_TAG) $(DOCKER_LATEST_TAG)
|
2019-07-31 17:43:17 +03:00
|
|
|
docker images $(DOCKER_RELEASE_TAG)
|
2016-06-28 04:54:29 +03:00
|
|
|
|
|
|
|
docker-push:
|
|
|
|
docker push $(DOCKER_RELEASE_TAG)
|
2021-12-31 00:33:43 +03:00
|
|
|
docker push $(DOCKER_LATEST_TAG)
|