-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
107 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,81 @@ | ||
PROJ_NAME = gndiff | ||
|
||
VERSION = $(shell git describe --tags) | ||
VER = $(shell git describe --tags --abbrev=0) | ||
DATE = $(shell date -u '+%Y-%m-%d_%H:%M:%S%Z') | ||
|
||
FLAGS_INTEL64 = GOARCH=amd64 | ||
NO_C = CGO_ENABLED=0 | ||
FLAGS_LINUX = $(FLAGS_INTEL) GOOS=linux | ||
FLAGS_MAC = $(FLAGS_INTEL) GOOS=darwin | ||
FLAGS_LINUX = $(FLAGS_INTEL64) GOOS=linux | ||
FLAGS_MAC = $(FLAGS_INTEL64) GOOS=darwin | ||
FLAGS_MAC_ARM = $GOARCH=arm64 GOOS=darwin | ||
FLAGS_WIN = $(FLAGS_INTEL64) GOOS=windows | ||
FLAGS_LD=-ldflags "-s -w -X github.com/gnames/gndiff.Build=${DATE} \ | ||
-X github.com/gnames/gndiff.Version=${VERSION}" | ||
FLAGS_LD = -ldflags "-X github.com/gnames/$(PROJ_NAME)/pkg.Build=$(DATE) \ | ||
-X github.com/gnames/$(PROJ_NAME)/pkg.Version=$(VERSION)" | ||
FLAGS_REL = -trimpath -ldflags "-s -w \ | ||
-X github.com/gnames/$(PROJ_NAME)/pkg.Build=$(DATE)" | ||
GOCMD = go | ||
GOBUILD = $(GOCMD) build $(FLAGS_LD) | ||
GORELEASE = $(GOCMD) build $(FLAGS_REL) | ||
GOINSTALL = $(GOCMD) install $(FLAGS_LD) | ||
GOCLEAN = $(GOCMD) clean | ||
GOGET = $(GOCMD) get | ||
|
||
RELEASE_DIR ?= "/tmp" | ||
BUILD_DIR ?= "." | ||
CLIB_DIR ?= "." | ||
|
||
all: install | ||
|
||
test: deps install | ||
$(FLAG_INTEL) go test -race ./... | ||
@echo Run tests | ||
$(GOCMD) test -shuffle=on -count=1 -race -coverprofile=coverage.txt ./... | ||
|
||
test-build: deps build | ||
|
||
deps: | ||
@echo Download go.mod dependencies | ||
$(GOCMD) mod download; | ||
|
||
tools: deps | ||
@echo Installing tools from tools.go | ||
@cat gndiff/tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install % | ||
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install % | ||
|
||
build: | ||
cd gndiff; \ | ||
@echo Building | ||
$(GOCLEAN); \ | ||
$(FLAGS_SHARED) $(NO_C) $(GOBUILD) -o $(BUILD_DIR) | ||
|
||
buildrel: | ||
@echo Building release binary | ||
$(GOCLEAN); \ | ||
$(NO_C) $(GORELEASE) -o $(BUILD_DIR); | ||
|
||
install: | ||
cd gndiff; \ | ||
$(GOCLEAN); \ | ||
$(FLAGS_SHARED) $(NO_C) $(GOINSTALL) | ||
|
||
release: dockerhub | ||
cd gndiff; \ | ||
@echo Make release | ||
$(GOCLEAN); \ | ||
$(FLAGS_LINUX) $(NO_C) $(GOBUILD); \ | ||
tar zcf $(RELEASE_DIR)/gndiff-$(VER)-linux.tar.gz gndiff; \ | ||
tar zcf $(RELEASE_DIR)/$(PROJ_NAME)-$(VER)-linux.tar.gz $(PROJ_NAME); \ | ||
$(GOCLEAN); \ | ||
$(FLAGS_MAC) $(NO_C) $(GOBUILD); \ | ||
tar zcf $(RELEASE_DIR)/gndiff-$(VER)-mac.tar.gz gndiff; \ | ||
tar zcf $(RELEASE_DIR)/$(PROJ_NAME)-$(VER)-mac.tar.gz $(PROJ_NAME); \ | ||
$(GOCLEAN); \ | ||
$(FLAGS_MAC_ARM) $(NO_C) $(GOBUILD); \ | ||
tar zcf $(RELEASE_DIR)/gndiff-$(VER)-mac-arm64.tar.gz gndiff; \ | ||
tar zcf $(RELEASE_DIR)/$(PROJ_NAME)-$(VER)-mac-arm64.tar.gz $(PROJ_NAME); \ | ||
$(GOCLEAN); \ | ||
$(FLAGS_WIN) $(NO_C) $(GOBUILD); \ | ||
zip -9 $(RELEASE_DIR)/gndiff-$(VER)-win-64.zip gndiff.exe; \ | ||
zip -9 $(RELEASE_DIR)/$(PROJ_NAME)-$(VER)-win-64.zip $(PROJ_NAME).exe; \ | ||
$(GOCLEAN); | ||
|
||
dc: build | ||
docker-compose build; | ||
|
||
docker: build | ||
docker build -t gnames/gndiff:latest -t gnames/gndiff:$(VERSION) .; \ | ||
cd gndiff; \ | ||
docker: buildrel | ||
@echo Build Docker images | ||
docker buildx build -t gnames/$(PROJ_NAME):latest -t gnames/$(PROJ_NAME):$(VERSION) .; \ | ||
$(GOCLEAN); | ||
|
||
dockerhub: docker | ||
docker push gnames/gndiff; \ | ||
docker push gnames/gndiff:$(VERSION) | ||
@echo Push Docker images to DockerHub | ||
docker push gnames/$(PROJ_NAME); \ | ||
docker push gnames/$(PROJ_NAME):$(VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.