This repository has been archived by the owner on Jun 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
71 lines (59 loc) · 2.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.DELETE_ON_ERROR:
.ONESHELL:
.SHELLFLAGS := -euo pipefail -c
.SILENT:
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --warn-undefined-variables
SHELL = bash
DATAPATH = $(CURDIR)/tests/data
DEBUG = TOMATE_DEBUG=1
DOCKER_IMAGE = eliostvs/tomate
OBS_API_URL = https://api.opensuse.org:443/trigger/runservice
PLUGINPATH = $(CURDIR)/data/plugins
PYTEST =
PYTHONPATH = PYTHONPATH=$(CURDIR)/tomate:$(PLUGINPATH)
VERSION = `cat .bumpversion.cfg | grep current_version | awk '{print $$3}'`
WORKDIR = /code
XDGPATH = XDG_CONFIG_HOME=$(DATAPATH) XDG_DATA_HOME=$(DATAPATH) XDG_DATA_DIRS=$(DATAPATH)
ifeq ($(shell which xvfb-run 1> /dev/null && echo yes),yes)
ARGS = xvfb-run -a
else
ARGS =
endif
.PHONY: init
init:
pre-commit install
git submodule add https://github.com/eliostvs/tomate tomate
.PHONY: submodule
submodule:
git submodule init
git submodule update
.PHONY: format
format:
black data/plugins/ tests/
.PHONY: clean
clean:
find . \( -iname "__pycache__" \) -print0 | xargs -0 rm -rf
rm -rf .eggs *.egg-info/ .coverage build/ .cache .pytest_cache
.PHONY: test
test: clean
echo "$(DEBUG) $(XDGPATH) $(PYTHONPATH) $(ARGS) py.test $(PYTEST) --cov=$(PLUGINPATH)"
$(DEBUG) $(XDGPATH) $(PYTHONPATH) $(ARGS) py.test $(PYTEST) --cov=$(PLUGINPATH)
release-%:
git flow init -d
@grep -q '\[Unreleased\]' CHANGELOG.md || (echo 'Create the [Unreleased] section in the changelog first!' && exit)
bumpversion --verbose --commit $*
git flow release start $(VERSION)
GIT_MERGE_AUTOEDIT=no git flow release finish -m "Merge branch release/$(VERSION)" -T $(VERSION) $(VERSION) -p
.PHONY: trigger-build
trigger-build:
curl -X POST -H "Authorization: Token $(TOKEN)" $(OBS_API_URL)
.PHONY: docker-test
docker-test:
docker run --rm -v $(CURDIR):$(WORKDIR) --workdir $(WORKDIR) $(DOCKER_IMAGE) test
.PHONY: docker-enter
docker-enter:
docker run --rm -v $(CURDIR):$(WORKDIR) --workdir $(WORKDIR) -it --entrypoint="bash" $(DOCKER_IMAGE)