This repository has been archived by the owner on Mar 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
172 lines (100 loc) · 3.26 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
DOCKER_COMPOSE_DEV = docker-compose
DOCKER_COMPOSE_CI = docker-compose -f docker-compose.yml
DOCKER_COMPOSE = $(DOCKER_COMPOSE_DEV)
VENV = venv
PIP = $(VENV)/bin/pip
PYTHON = $(VENV)/bin/python
RUN_DEV = $(DOCKER_COMPOSE) run --rm sciencebeam-pipelines-dev
SCIENCEBEAM_PORT = 8075
CONVERT_API_URL = http://localhost:$(SCIENCEBEAM_PORT)/api/convert
EXAMPLE_DOCUMENT = test-data/minimal-office-open.docx
NO_BUILD =
ARGS =
.PHONY: logs
venv-clean:
@if [ -d "$(VENV)" ]; then \
rm -rf "$(VENV)"; \
fi
venv-create:
python3 -m venv $(VENV)
dev-install:
$(PIP) install -r requirements.prereq.txt
$(PIP) install -r requirements.txt
$(PIP) install -r requirements.dev.txt
$(PIP) install -e . --no-deps
dev-venv: venv-create dev-install
dev-flake8:
$(PYTHON) -m flake8 sciencebeam_pipelines tests setup.py
dev-pylint:
$(PYTHON) -m pylint sciencebeam_pipelines tests setup.py
dev-lint: dev-flake8 dev-pylint
dev-pytest:
$(PYTHON) -m pytest -p no:cacheprovider $(ARGS)
dev-watch:
$(PYTHON) -m pytest_watch --verbose --ext=.py,.xsl -- -p no:cacheprovider -k 'not slow' $(ARGS)
dev-watch-slow:
$(PYTHON) -m pytest_watch --verbose --ext=.py,.xsl -- -p no:cacheprovider $(ARGS)
dev-test: dev-lint dev-pytest
dev-start:
$(PYTHON) -m sciencebeam_pipelines.server $(ARGS)
dev-start-debug:
FLASK_ENV=development \
$(PYTHON) -m sciencebeam_pipelines.server $(ARGS)
dev-start-doc-to-pdf:
$(PYTHON) -m sciencebeam_pipelines.server --port=8075 --pipeline=doc_to_pdf $(ARGS)
dev-start-doc-to-docx:
$(PYTHON) -m sciencebeam_pipelines.server --port=8075 --pipeline=doc_to_docx $(ARGS)
build:
$(DOCKER_COMPOSE) build sciencebeam-pipelines
build-dev:
@if [ "$(NO_BUILD)" != "y" ]; then \
$(DOCKER_COMPOSE) build sciencebeam-pipelines-base-dev sciencebeam-pipelines-dev; \
fi
test: build-dev
$(RUN_DEV) ./project_tests.sh
watch: build-dev
$(RUN_DEV) pytest-watch --verbose --ext=.py,.xsl -- -p no:cacheprovider -k 'not slow' $(ARGS)
shell-dev: build-dev
$(RUN_DEV) bash
build-and-start:
$(DOCKER_COMPOSE) up -d --build grobid sciencebeam-pipelines
start:
$(DOCKER_COMPOSE) up -d grobid sciencebeam-pipelines
start-doc-to-pdf:
$(DOCKER_COMPOSE) build sciencebeam-pipelines
$(DOCKER_COMPOSE) run --rm --no-deps -p 8075:8075 sciencebeam-pipelines \
python -m sciencebeam_pipelines.server --host=0.0.0.0 --port=8075 --pipeline=doc_to_pdf $(ARGS)
convert-example-document:
curl --fail --show-error \
--form "file=@$(EXAMPLE_DOCUMENT);filename=$(EXAMPLE_DOCUMENT)" \
--silent "$(CONVERT_API_URL)" \
> /dev/null
wait-for-sciencebeam-pipelines:
$(DOCKER_COMPOSE) run --rm wait-for-it \
"sciencebeam-pipelines:$(SCIENCEBEAM_PORT)" \
--timeout=10 \
--strict \
-- echo "ScienceBeam Pipelines is up"
wait-for-grobid:
$(DOCKER_COMPOSE) run --rm wait-for-it \
"grobid:8070" \
--timeout=10 \
--strict \
-- echo "GROBID is up"
end-to-end-test:
$(MAKE) start
$(MAKE) wait-for-sciencebeam-pipelines wait-for-grobid
$(MAKE) convert-example-document
$(MAKE) stop
stop:
$(DOCKER_COMPOSE) down
logs:
$(DOCKER_COMPOSE) logs -f
ci-build-all:
$(DOCKER_COMPOSE_CI) build
ci-test:
$(MAKE) DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" test
ci-end-to-end-test:
$(MAKE) DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" end-to-end-test
ci-clean:
$(DOCKER_COMPOSE_CI) down -v