Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and CI #2

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
NAME=pixelizer

SHELL := env DOCKER_REPO=$(DOCKER_REPO) $(SHELL)
DOCKER_REPO?=eu.gcr.io/melsoft-infra
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about dockers and makefiles, but doesn't this mean we won't be able to compile if this docker repo is down someday ? Also, it seems this repo has the name of your company. I don't know if it is relevant to use your company's docker repo here.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you mark this as resolved please provide an answer about it so I can know if you will fix it


SHELL := env VERSION=$(VERSION) $(SHELL)
VERSION ?= $(shell date -u +%Y%m%d.%H.%M.%S)


# COLORS
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)


TARGET_MAX_CHAR_NUM=20


define colored
@echo '${GREEN}$1${RESET}'
endef

## Show help
help:
${call colored, help is running...}
@echo 'link this Makefile from scripts dir to core root'
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)

## vet project
vet:
${call colored, vet is running...}
./scripts/vet.sh
.PHONY: vet

## Compile executable
compile:
${call colored, compile is running...}
./scripts/compile.sh
.PHONY: compile

## Release
release:
./scripts/release.sh
.PHONY: release

## Release local snapshot
release-local-snapshot:
${call colored, release is running...}
./scripts/release-local-snapshot.sh
.PHONY: release-local-snapshot

## Installs tools from vendor.
install-tools: sync-vendor
./scripts/install-tools.sh
.PHONY: install-tools

## Sync vendor of root project and tools.
sync-vendor:
./scripts/sync-vendor.sh
.PHONY: sync-vendor