-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
77 lines (63 loc) · 1.89 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
SHELL = /bin/bash
PYTHON = python3
PIP = pip3
LOG_LEVEL = INFO
PYTHONIOENCODING=utf8
# pytest args. Set to '-s' to see log output during test execution, '--verbose' to see individual tests. Default: '$(PYTEST_ARGS)'
PYTEST_ARGS =
DOCKER_BASE_IMAGE = docker.io/ocrd/core:v2.68.0
DOCKER_TAG = 'ocrd/olahd-client'
# BEGIN-EVAL makefile-parser --make-help Makefile
help:
@echo ""
@echo " Targets"
@echo ""
@echo " deps Install python deps via pip"
@echo " deps-test Install testing python deps via pip"
@echo " install Install"
@echo " docker Build docker image"
@echo " test Run unit tests"
@echo " coverage Run unit tests and determine test coverage"
@echo ""
@echo " Variables"
@echo ""
@echo " PYTEST_ARGS pytest args. Set to '-s' to see log output during test execution, '--verbose' to see individual tests. Default: '$(PYTEST_ARGS)'"
@echo " DOCKER_TAG Docker container tag"
# END-EVAL
# Install python deps via pip
deps:
$(PIP) install -U pip
$(PIP) install -r requirements.txt
# Install testing python deps via pip
deps-test:
$(PIP) install -U pip
$(PIP) install -r requirements_test.txt
# Install
install:
$(PIP) install -U pip
$(PIP) install .
# Install-develop
install-dev:
$(PIP) install -U pip
$(PIP) install -e .
docker:
docker build \
--build-arg DOCKER_BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
--build-arg VCS_REF=$$(git rev-parse --short HEAD) \
--build-arg BUILD_DATE=$$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
-t $(DOCKER_TAG) .
# Run unit tests
test: tests/assets
# declare -p HTTP_PROXY
$(PYTHON) -m pytest --continue-on-collection-errors tests $(PYTEST_ARGS)
.PHONY: tests/assets
tests/assets:
mkdir -p tests/assets
cp -r repo/assets/data/* tests/assets
# Run unit tests and determine test coverage
coverage:
coverage erase
make test PYTHON="coverage run"
coverage report
coverage html
.PHONY: test install deps deps-test help docker