forked from truly-systems/glpi-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (61 loc) · 1.65 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
72
73
74
75
76
77
78
VENV ?= ./venv
# Dependencies
venv:
test -d $(VENV) || virtualenv $(VENV)
dep-gobal:
test -d ./dist || mkdir -p ./dist |true
dep-dev: dep-deploy
dep-build: dep-deploy
dep-deploy: venv dep-gobal
$(VENV)/bin/pip install -r requirements-build.txt >/dev/null
# Build
build: clean dep-build
@echo "#> Building package on ./dist/ dir"
$(VENV)/bin/python setup.py sdist bdist_wheel
@echo "#> Done. Packages on ./dist/"
@ls ./dist
# Test (TODO)
# test-dev:
# $(VENV)/bin/twine check dist/*
# Bump version
bump: clean dep-dev
$(VENV)/bin/bumpversion --current-version `git tag |tail -n1` \
$(BUMP_LEVEL) ./glpi/version.py
bump-major:
$(MAKE) bump BUMP_LEVEL=major
bump-minor:
$(MAKE) bump BUMP_LEVEL=minor
bump-patch:
$(MAKE) bump BUMP_LEVEL=patch
# Tag
REPO_BRANCH ?= `git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
REPO_VERSION ?= `sed "s/__version__ \= //g" glpi/version.py |tr -d "'"`
tag:
@if [ "$(REPO_BRANCH)" != "master" ]; then \
echo "#>> ERR - Your should have in the master branch to create tag."; \
echo "#>> Current branch: $(REPO_BRANCH)"; \
exit 1; \
fi
git tag $(REPO_VERSION) -m "Bump to $(REPO_VERSION) by Makefile" && \
git push --tags origin
# Deploy
deploy-test: build
#$(VENV)/bin/twine check dist/* #TODO fix: is not working
$(VENV)/bin/twine upload \
-u $(TWINE_USERNAME) \
-p $(TWINE_PASSWORD) \
--repository-url https://test.pypi.org/legacy/ \
--verbose \
dist/*
deploy-prod: build
$(VENV)/bin/twine upload \
-u $(TWINE_USERNAME) \
-p $(TWINE_PASSWORD) \
--verbose \
dist/*
# Clean artifacts
clean:
@echo "#> Cleaning project's artifacts"
@rm -rf disk/*
clean-venv:
@rm -rf $(VENV)