This repository has been archived by the owner on May 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
90 lines (72 loc) · 2.34 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
84
85
86
87
88
89
90
BRANCH := $(shell git rev-parse --symbolic-full-name --abbrev-ref HEAD)
# by default, we'll bump the "build" part of the version, for non-releases
PART = build
# if the current version is a release and not a dev build, bump the patch part instead
VERSION := $(shell grep -Po '(?<=current_version = )[\w\d\.]+' .bumpversion.cfg)
ifeq (,$(findstring dev,$(VERSION)))
ifeq ($(PART),build)
PART = patch
endif
endif
# Minimal makefile for Sphinx documentation
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = docs_source
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
docs:
-rm -rf _build/
make html
s3_docs: docs
aws s3 sync --delete _build/html/ s3://docs.pewresearch.tech/pewtils/
github_docs:
make html
-mv _build/html /tmp/html
-rm -rf _build
-git branch -D docs
git fetch --all
git checkout docs
-mv .git /tmp/.git
-rm -rf * .*
-mv /tmp/.git .
cp -a /tmp/html/. .
-rm -rf /tmp/html
git add -A .
git commit -m "latest docs"
git push origin docs
git checkout $(BRANCH)
python_lint_errors:
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,__pycache__,build,dist
python_lint_quality:
flake8 . --exit-zero --statistics --count --show-source --max-line-length=127 --ignore=E201,E202,E501,E722,W503,W504 --exclude=.git,__pycache__,build,dist
github_lint_flake8:
flake8 . --max-line-length 127 --ignore=E201,E202,E501,E722,W503,W504 --exclude=.git,__pycache__,build,dist | reviewdog -reporter=github-pr-check -f=flake8
python_test:
python3 -m unittest tests
python_build:
python3 setup.py sdist bdist_wheel
.ONESHELL:
bump:
git checkout $(BRANCH)
git pull origin $(BRANCH)
bumpversion --commit $(PART)
.ONESHELL:
sync_branch:
git checkout $(BRANCH)
git pull origin $(BRANCH)
git push origin $(BRANCH)
.ONESHELL:
release:
git checkout $(BRANCH)
git pull origin $(BRANCH)
bumpversion --commit $(PART)
bumpversion --commit --tag release
git push origin $(BRANCH) --follow-tags
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)