1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-22 08:12:27 +00:00

Squashed '.makefiles/' changes from b20982c..a75ba69

a75ba69 Merge branch 'meaningcloud' into 'master'
919c4a0 Update base.mk
42224e3 Updated makefiles from meaningcloud
f0c211c PYVERSION changed
24d85b1 Merge branch 'meaningcloud' into 'master'
d150321 Updated makefiles from meaningcloud
4f88009 Merge branch 'senpy' into 'master'
1f0703d Fixed typo in .gitlab-ci
c23f798 Trying to fix push to github

git-subtree-dir: .makefiles
git-subtree-split: a75ba6994d
This commit is contained in:
J. Fernando Sánchez 2017-12-13 15:24:28 +01:00
parent b03e03fd0a
commit 89f3a0eca9
4 changed files with 23 additions and 13 deletions

12
base.mk
View File

@ -2,18 +2,16 @@ export
NAME ?= $(shell basename $(CURDIR)) NAME ?= $(shell basename $(CURDIR))
VERSION ?= $(shell git describe --tags --dirty 2>/dev/null) VERSION ?= $(shell git describe --tags --dirty 2>/dev/null)
ifeq ($(VERSION),)
VERSION:=unknown
endif
# Get the location of this makefile. # Get the location of this makefile.
MK_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) MK_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
-include .env -include .env
-include ../.env -include ../.env
.FORCE:
version: .FORCE
@echo $(VERSION) > $(NAME)/VERSION
@echo $(VERSION)
help: ## Show this help. help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/\(.*:\)[^#]*##\s*\(.*\)/\1\t\2/' | column -t -s " " @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/\(.*:\)[^#]*##\s*\(.*\)/\1\t\2/' | column -t -s " "
@ -35,4 +33,4 @@ include $(MK_DIR)/git.mk
info:: ## List all variables info:: ## List all variables
env env
.PHONY:: config help ci version .FORCE .PHONY:: config help ci

View File

@ -1,4 +1,5 @@
IMAGEWTAG ?= $(IMAGENAME):$(VERSION) IMAGENAME?=$(NAME)
IMAGEWTAG?=$(IMAGENAME):$(VERSION)
docker-login: ## Log in to the registry. It will only be used in the server, or when running a CI task locally (if CI_BUILD_TOKEN is set). docker-login: ## Log in to the registry. It will only be used in the server, or when running a CI task locally (if CI_BUILD_TOKEN is set).
ifeq ($(CI_BUILD_TOKEN),) ifeq ($(CI_BUILD_TOKEN),)
@ -22,4 +23,7 @@ login:: docker-login
clean:: docker-clean clean:: docker-clean
docker-info:
@echo IMAGEWTAG=${IMAGEWTAG}
.PHONY:: docker-login docker-clean login clean .PHONY:: docker-login docker-clean login clean

6
git.mk
View File

@ -13,12 +13,12 @@ git-pull:
push-github: ## Push the code to github. You need to set up GITHUB_DEPLOY_KEY push-github: ## Push the code to github. You need to set up GITHUB_DEPLOY_KEY
ifeq ($(GITHUB_DEPLOY_KEY),) ifeq ($(GITHUB_DEPLOY_KEY),)
else else
$(eval KEY_FILE := $(shell mktemp)) $(eval KEY_FILE := "$(shell mktemp)")
@echo "$(GITHUB_DEPLOY_KEY)" > $(KEY_FILE) @echo "$(GITHUB_DEPLOY_KEY)" > $(KEY_FILE)
@git remote rm github-deploy || true @git remote rm github-deploy || true
git remote add github-deploy $(GITHUB_REPO) git remote add github-deploy $(GITHUB_REPO)
@GIT_SSH_COMMAND="ssh -i $(KEY_FILE)" git fetch github-deploy $(CI_COMMIT_REF_NAME) || true -@GIT_SSH_COMMAND="ssh -i $(KEY_FILE)" git fetch github-deploy $(CI_COMMIT_REF_NAME)
@GIT_SSH_COMMAND="ssh -i $(KEY_FILE)" git push github-deploy $(CI_COMMIT_REF_NAME) @GIT_SSH_COMMAND="ssh -i $(KEY_FILE)" git push github-deploy HEAD:$(CI_COMMIT_REF_NAME)
rm $(KEY_FILE) rm $(KEY_FILE)
endif endif

View File

@ -1,9 +1,17 @@
PYVERSIONS ?= 2.7 PYVERSIONS ?= 3.5
PYMAIN ?= $(firstword $(PYVERSIONS)) PYMAIN ?= $(firstword $(PYVERSIONS))
TARNAME ?= $(NAME)-$(VERSION).tar.gz TARNAME ?= $(NAME)-$(VERSION).tar.gz
VERSIONFILE ?= $(NAME)/VERSION
DEVPORT ?= 6000 DEVPORT ?= 6000
.FORCE:
version: .FORCE
@echo $(VERSION) > $(VERSIONFILE)
@echo $(VERSION)
yapf: ## Format python code yapf: ## Format python code
yapf -i -r $(NAME) yapf -i -r $(NAME)
yapf -i -r tests yapf -i -r tests
@ -89,4 +97,4 @@ clean:: ## Clean older docker images and containers related to this project and
@docker ps -a | grep $(IMAGENAME) | awk '{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1;}}' | xargs docker rm -v 2>/dev/null|| true @docker ps -a | grep $(IMAGENAME) | awk '{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1;}}' | xargs docker rm -v 2>/dev/null|| true
@docker images | grep $(IMAGENAME) | awk '{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1":"$$2;}}' | xargs docker rmi 2>/dev/null|| true @docker images | grep $(IMAGENAME) | awk '{ split($$2, vers, "-"); if(vers[0] != "${VERSION}"){ print $$1":"$$2;}}' | xargs docker rmi 2>/dev/null|| true
.PHONY:: yapf dockerfiles Dockerfile-% quick_build build build-% dev-% quick-dev test quick_test push-latest push-latest-% push-% push .PHONY:: yapf dockerfiles Dockerfile-% quick_build build build-% dev-% quick-dev test quick_test push-latest push-latest-% push-% push version .FORCE