-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
157 lines (113 loc) · 3.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# -*- coding: utf-8 -*-
# (c) 2014-2023 Andreas Motl <[email protected]>
# =============
# Configuration
# =============
$(eval venv := .venv)
$(eval pip := $(venv)/bin/pip)
$(eval python := $(venv)/bin/python)
$(eval pytest := $(venv)/bin/pytest)
$(eval coverage := $(venv)/bin/coverage)
$(eval bumpversion := $(venv)/bin/bumpversion)
$(eval twine := $(venv)/bin/twine)
$(eval sphinx-build := $(venv)/bin/sphinx-build)
$(eval sphinx-autobuild := $(venv)/bin/sphinx-autobuild)
$(eval invoke := $(venv)/bin/invoke)
# =====
# Setup
# =====
# Setup Python virtualenv.
setup-virtualenv:
@test -e $(python) || python3 -m venv $(venv)
@$(pip) install --upgrade --prefer-binary wheel
# Install requirements for building the documentation.
virtualenv-docs: setup-virtualenv
@$(pip) install --upgrade --prefer-binary --requirement=doc/source/requirements.txt
# Install requirements for development.
virtualenv-dev: setup-virtualenv
@$(pip) install --upgrade --prefer-binary --requirement=requirements-test.txt
@$(pip) install --upgrade --prefer-binary --editable=.[daq,daq_geospatial,export,scientific,firmware]
# Install requirements for releasing.
install-releasetools: setup-virtualenv
@$(pip) install --upgrade --prefer-binary --requirement=requirements-release.txt
# =======
# Release
# =======
# Release this piece of software.
# Uses the fine ``bumpversion`` utility.
#
# Synopsis::
#
# make release bump={patch,minor,major}
#
release: bumpversion push build pypi-upload
bumpversion: install-releasetools check-bump-options
$(bumpversion) $(bump)
push:
git push && git push --tags
build:
$(python) -m build
pypi-upload: install-releasetools
twine upload --skip-existing --verbose dist/*.tar.gz dist/*.whl
check-bump-options:
@if test "$(bump)" = ""; then \
echo "ERROR: 'bump' not set, try 'make release bump={patch,minor,major}'"; \
exit 1; \
fi
# =========
# Packaging
# =========
include packaging/tasks.mk
# ==============
# Software tests
# ==============
.PHONY:
test: virtualenv-dev
$(pytest) kotori test
.PHONY:
test-coverage: virtualenv-dev
$(coverage) run --concurrency=multiprocessing,thread --parallel-mode --timid $(pytest) kotori test
$(coverage) combine
$(coverage) report
$(coverage) xml
# =============
# Documentation
# =============
# Build Sphinx documentation.
docs-html: virtualenv-docs
touch doc/source/index.rst
$(sphinx-build) -j auto -n -W --keep-going -b html doc/source doc/build
docs-autobuild: virtualenv-docs
$(pip) install sphinx-autobuild
$(sphinx-autobuild) --open-browser doc/source doc/build
# Run link checker on documentation.
docs-linkcheck: virtualenv-docs
$(sphinx-build) -j auto -n -W --keep-going -b linkcheck doc/source doc/build
# Upload media assets. Images, videos, etc.
# Don't commit media assets (screenshots, etc.) to the repository.
# Instead, upload them to https://ptrace.getkotori.org/
ptrace_target := [email protected]:/srv/www/organizations/daq-tools/ptrace.getkotori.org/htdocs/
ptrace_http := https://ptrace.getkotori.org/
ptrace: check-ptrace-options
$(eval prefix := $(shell gdate --iso-8601))
$(eval name := $(shell basename $(source)))
$(eval id := $(prefix)_$(name))
@# debugging
@#echo "name: $(name)"
@#echo "id: $(id)"
@scp '$(source)' '$(ptrace_target)$(id)'
$(eval url := $(ptrace_http)$(id))
@echo "Access URL: $(url)"
check-ptrace-options:
@if test "$(source)" = ""; then \
echo "ERROR: 'source' not set"; \
exit 1; \
fi
# ==============
# Infrastructure
# ==============
start-foundation-services:
docker-compose pull
docker-compose up
mongodb-start:
mongod --dbpath=./var/lib/mongodb/ --smallfiles