-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (47 loc) · 1.4 KB
/
Makefile
File metadata and controls
63 lines (47 loc) · 1.4 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
ENV := . env/bin/activate;
PYTHON := $(ENV) python3
.PHONY: all backend build clean docker docs env e2e frontend hooks lint precommit tests
all: docs lint tests
backend: env
@$(PYTHON) -m app
build: node_modules
@npx parcel build src/index.html
clean:
@rm -fR docs/build docs/source/apidoc
docker:
docker build -t mathsnuggets .
docker tag mathsnuggets bknguyen/mathsnuggets
docker push bknguyen/mathsnuggets
docs: env
@$(ENV) sphinx-apidoc -fME --implicit-namespaces -o docs/source/apidoc mathsnuggets
@$(ENV) sphinx-build -M html docs/source docs/build
env: env/bin/activate
env/bin/activate: requirements.txt
@test -d env || python3 -m venv env
@$(PYTHON) -m pip install -Ur requirements.txt
@touch env/bin/activate
e2e: build env
@$(PYTHON) -m app &
sleep 1
npx mocha --timeout 10000 src/tests
sleep 1
ps -ef | grep "env/bin/python3 -m app" | awk '{print $$2}' | head -1 | xargs kill
frontend: node_modules
@npx parcel watch src/index.html
hooks:
@echo "make precommit" > .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
python_lint: env
@$(ENV) isort . --skip env
@$(PYTHON) -m black .
@$(PYTHON) -m flake8
node_modules: package.json
@npm install
precommit:
@$(ENV) isort . --check --skip env
@$(PYTHON) -m black .
@$(PYTHON) -m flake8
@npx eslint --ignore-path .gitignore src/*
python_tests: env
@$(PYTHON) -m pytest -v --cov=. --cov-report=xml -n 4
@$(PYTHON) -m coverage html