forked from CleanCut/green
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (67 loc) · 2.81 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
79
80
81
82
83
VERSION=$(shell cat green/VERSION)
clean: clean-message clean-silent
clean-message:
@echo "Cleaning generated files and directories. Do 'make super-clean' to remove virtualenvs as well."
clean-silent:
@find . -name '*.pyc' -exec rm \{\} \;
@find . -name '.coverage*' -exec rm \{\} \;
@rm -rf _trial_temp build dist green.egg-info green-*
super-clean-message:
@echo "Cleaning generated files and directories and the virtual-environments."
super-clean: super-clean-message clean-silent
@rm -rf venv*
test: test-versions test-installed test-coverage
@# test-coverage needs to be last in deps, don't clean after it runs!
@echo "\n(test) completed\n"
test-local:
@pip install -r requirements-optional.txt
-@pip uninstall green
@make test-installed
make test-versions
make test-coverage
@# test-coverage needs to be last in deps, don't clean after it runs!
test-coverage:
# Coverage of green should not include coverage of the example project
@make clean-silent
! ./g -r green | grep example/
@make clean-silent
@# Generate coverage files for travis builds (don't clean after this!)
./g -s 0 -r -vvv green
@echo "\n(test-coverage) completed\n"
test-installed:
# Install under the default python and run self-tests
@make clean-silent
pip install -r requirements-optional.txt
python setup.py sdist
tar zxvf dist/green-$(VERSION).tar.gz
bash -c "cd green-$(VERSION) && python setup.py install"
bash -c "cd && green -vvv green"
pip uninstall -y green
@make clean-silent
@echo "\n(test-installed) completed\n"
test-versions:
# Run the in-place stub under all python versions in the path
@make clean-silent
./test_versions
@make clean-silent
@echo "\n(test-versions) completed\n"
sanity-checks:
@if ! ./g -r green | grep TOTAL | grep "0 100%" ; then echo 'Coverage needs to be at 100% for a release!' && exit 1; fi
@if git show-ref --verify --quiet refs/tags/$(VERSION) ; then printf "\nVersion $(VERSION) has already been tagged.\nIf the make process died after tagging, but before actually releasing, you can try 'make release-unsafe'\n\n" ; exit 1 ; fi
@if [[ $(shell git rev-parse --abbrev-ref HEAD) != "master" ]] ; then echo "\nYou need to be on the master branch to release.\n" && exit 1 ; fi
@./g -h > cli-options.txt
@printf "\n== SANITY CHECK: GIT STATUS ==\n"
@git status
@printf "\nIs everything committed? (Ctrl-C if not!) "
@read
release-test: test-local sanity-checks
@echo "\n== CHECKING PyPi-Test =="
python setup.py sdist upload -r pypi-test
if [ "`git diff MANIFEST`" != "" ] ; then git add MANIFEST && git commit -m "Added the updated MANIFEST file." ; fi
release-tag:
git tag $(VERSION) -m "Tagging a release version"
git push --tags origin HEAD
release-unsafe:
@echo "\n== Releasing Version $(VERSION) =="
python setup.py sdist upload -r pypi
release: release-test release-tag release-unsafe