-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (46 loc) · 1.77 KB
/
Makefile
File metadata and controls
65 lines (46 loc) · 1.77 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
.PHONY: all check-formatting commit-check mypy check clean serve
SOURCEDIRS := "coua"
PYTHON_SRCS := $(shell find $(SOURCEDIRS) -name '*.py')
PYTHON_SRCS += $(wildcard tests/*.py)
RDF_SRCS := $(shell find $(SOURCEDIRS) -name '*.ttl')
QUERIES := $(shell find $(SOURCEDIRS) -name '*.rq')
DOC := $(shell find doc -name '*.rst')
DOC += $(shell find doc -name '*.py')
SRCS := $(PYTHON_SRCS)
SRCS += $(RDF_SRCS)
SRCS += $(DOC_SRCS)
SRCS += $(QUERIES)
all: check test cert
check-format:
nix fmt -- --fail-on-change --no-cache
commit-check:
cog check
mypy:
mypy .
pylint:
pylint .
junit.xml: coverage.xml
coverage.xml: $(SRCS)
pytest --cov-branch --junit-xml=junit.xml --cov=coua --cov-report term --cov-report xml:coverage.xml
traces.json: $(SRCS)
malkoha . > traces.json
spec.nq: spec.ttl
python -c "import pyoxigraph; g = pyoxigraph.parse(open('spec.ttl'), format=pyoxigraph.RdfFormat.TURTLE); pyoxigraph.serialize(g, format=pyoxigraph.RdfFormat.N_QUADS, output='spec.nq')"
doc/source/imported.nq: spec.nq $(SRCS) junit.xml coverage.xml traces.json coua.toml
python -c 'import coua; coua.run()' check --output doc/source/imported.nq --extra-triples spec.nq
# Generates documentation from data items in doc/source/imported.nq
doc/build/html/index.html: doc/source/imported.nq $(DOC)
$(MAKE) -C doc clean
$(MAKE) -C doc html
doc/build/html/coua_db: doc/build/html/index.html
test: junit.xml
cert: doc/build/html/index.html
check: check-format commit-check mypy pylint cert
clean:
rm -f junit.xml coverage.xml traces.json spec.nq doc/source/imported.nq
$(MAKE) -C doc clean
doc/build/html/coua_db: doc/source/imported.nq
mkdir -p doc/build/html/coua_db
oxigraph load --location $@ --format application/n-quads < $<
serve: doc/build/html/coua_db
oxigraph serve-read-only --location $<