Merge pull request #16 from nspcc-dev/update-makefile-and-targets

Update Makefile and targets
This commit is contained in:
Evgeniy Kulikov 2021-02-08 11:34:54 +03:00 committed by GitHub
commit aa6bb31f4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 2 deletions

View file

@ -1,3 +1,6 @@
-include .env
-include help.mk
VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')" VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')"
GRPC_VERSION=$(shell go list -m google.golang.org/grpc | cut -d " " -f 2) GRPC_VERSION=$(shell go list -m google.golang.org/grpc | cut -d " " -f 2)
@ -8,11 +11,13 @@ B=\033[0;1m
G=\033[0;92m G=\033[0;92m
R=\033[0m R=\033[0m
.PHONY: version deps image publish
# Show current version # Show current version
version: version:
@echo "Current version: $(VERSION)-$(GRPC_VERSION)" @echo "Current version: $(VERSION)-$(GRPC_VERSION)"
# Make sure that all files added to commit # Check and ensure dependencies
deps: deps:
@printf "${B}${G}⇒ Ensure vendor${R}: " @printf "${B}${G}⇒ Ensure vendor${R}: "
@go mod tidy -v && echo OK || (echo fail && exit 2) @go mod tidy -v && echo OK || (echo fail && exit 2)
@ -21,6 +26,7 @@ deps:
@printf "${B}${G}⇒ Store vendor localy${R}: " @printf "${B}${G}⇒ Store vendor localy${R}: "
@go mod vendor && echo OK || (echo fail && exit 2) @go mod vendor && echo OK || (echo fail && exit 2)
# Build docker image
image: VERSION?= image: VERSION?=
image: deps image: deps
@echo "${B}${G}⇒ Build GW docker-image with $(GRPC_VERSION) ${R}" @echo "${B}${G}⇒ Build GW docker-image with $(GRPC_VERSION) ${R}"
@ -29,9 +35,14 @@ image: deps
-f Dockerfile \ -f Dockerfile \
-t $(HUB_IMAGE)-http-gate:$(VERSION) . -t $(HUB_IMAGE)-http-gate:$(VERSION) .
# Publish docker image
publish:
@echo "${B}${G}⇒ publish docker image ${R}"
@docker push $(HUB_IMAGE)-http-gate:$(VERSION)
.PHONY: dev .PHONY: dev
# v1.24.0 v1.25.1 v1.26.0 v1.27.1 # Build development docker images
dev: VERSIONS?=$(GRPC_VERSION) dev: VERSIONS?=$(GRPC_VERSION)
dev: dev:
@echo "=> Build multiple images for $(VERSIONS)"; \ @echo "=> Build multiple images for $(VERSIONS)"; \

View file

@ -3,6 +3,23 @@
NeoFS HTTP Gate is example of tool that provides basic interactions with NeoFS. NeoFS HTTP Gate is example of tool that provides basic interactions with NeoFS.
You can download files from NeoFS Network using NeoFS Gate. You can download files from NeoFS Network using NeoFS Gate.
## Notable make targets
```
Usage:
make <target>
Targets:
deps Check and ensure dependencies
dev Build development docker images
help Show this help prompt
image Build docker image
publish Publish docker image
version Show current version
```
## Install ## Install
```go get -u github.com/nspcc-dev/neofs-http-gate``` ```go get -u github.com/nspcc-dev/neofs-http-gate```

11
help.mk Normal file
View file

@ -0,0 +1,11 @@
.PHONY: help
# Show this help prompt
help:
@echo ' Usage:'
@echo ''
@echo ' make <target>'
@echo ''
@echo ' Targets:'
@echo ''
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort | uniq