-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
149 lines (106 loc) · 3.3 KB
/
Copy pathMakefile
File metadata and controls
149 lines (106 loc) · 3.3 KB
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
# -*- coding: utf-8 -*-
# (c) 2014-2023 Andreas Motl <andreas.motl@getkotori.org>
# =============
# 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 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 --editable='.[full,test]'
# Install requirements for releasing.
install-releasetools: setup-virtualenv
@$(pip) install --upgrade --prefer-binary --editable='.[release]'
# =======
# Release
# =======
# Synopsis::
#
# make release
#
release: push build pypi-upload
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 $(pytest) kotori test
$(coverage) combine
$(coverage) report
$(coverage) xml
# =============
# Documentation
# =============
# Build Sphinx documentation.
docs-html: virtualenv-docs
touch doc/source/index.rst
$(sphinx-build) --jobs auto -n -W --keep-going -b html doc/source doc/build
docs-autobuild: virtualenv-docs
$(pip) install sphinx-autobuild
$(sphinx-autobuild) --jobs auto --open-browser doc/source doc/build
# Run link checker on documentation.
docs-linkcheck: virtualenv-docs
$(sphinx-build) --jobs 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 := root@ptrace.getkotori.org:/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