-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Dusan Malusev <[email protected]>
- Loading branch information
Dusan Malusev
committed
Jan 29, 2021
1 parent
a85e799
commit 3f3fca3
Showing
2 changed files
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.idea/ | ||
.vscode/ | ||
bin/ | ||
coverage.txt |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
GOPATH ?= ${HOME}/go | ||
RACE ?= 0 | ||
ENVIRONMENT ?= development | ||
VERSION ?= dev | ||
|
||
.PHONY: all | ||
all: clean test build | ||
|
||
.PHONY: test | ||
test: | ||
ifeq ($(RACE), 1) | ||
go test ./... -race -covermode=atomic -coverprofile=coverage.txt -timeout 5m | ||
else | ||
go test ./... -covermode=atomic -coverprofile=coverage.txt -timeout 1m | ||
endif | ||
|
||
.PHONY: build | ||
build: | ||
ifeq ($(ENVIRONMENT),production) | ||
CGO_ENABLED=0 go build -ldflags="-s -w -X 'main.Version=${VERSION}'" -o ./bin/hosts cmd/hosts/main.go | ||
else ifeq ($(ENVIRONMENT),development) | ||
go build -o ./bin/hosts cmd/hosts/main.go | ||
else | ||
echo "Target ${ENVIRONMENT} is not supported" | ||
endif | ||
|
||
.PHONY: git-setup | ||
git-setup: | ||
git config user.name GitHub | ||
git config user.email [email protected] | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/malusev998/dusanmalusev.git | ||
|
||
.PHONY: commit | ||
commit: | ||
git add . | ||
ifneq ($(shell git status --porcelain),) | ||
git commit --author "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" --message "${MESSAGE}" | ||
git push | ||
endif | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf ./bin |