-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
87 lines (69 loc) · 2.45 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
SHELL=/bin/bash
PYTHON=python3
PYTHON_ENV=env
DJANGO_SETTINGS_MODULE=test_django_project._django.settings
DJANGO_DATABASE_NAME=test-django-project/db.sqlite3
.PHONY: all clean npm-dependencies dist _release \
test-script test-project test-django-project
all: | test-script
clean:
rm -rf node_modules
rm -rf $(PYTHON_ENV)
# python ######################################################################
$(PYTHON_ENV): pyproject.toml
rm -rf $(PYTHON_ENV) && \
$(PYTHON) -m venv $(PYTHON_ENV) && \
. $(PYTHON_ENV)/bin/activate && \
pip install pip --upgrade && \
pip install -e .[packaging,test] \
pip install -e test-django-project
# npm #########################################################################
node_modules: package.json
npm install
npm-dependencies: | node_modules
rm -rf $(DIST_ROOT)
mkdir -p $(DIST_ROOT)
# picocss
mkdir -p $(DIST_ROOT)/pico
cp node_modules/@picocss/pico/LICENSE.md $(DIST_ROOT)/pico
cp -r node_modules/@picocss/pico/css $(DIST_ROOT)/pico/css
cp -r node_modules/@picocss/pico/scss $(DIST_ROOT)/pico/scss
# feather icons
mkdir -p $(DIST_ROOT)/feather-icons
cp node_modules/feather-icons/LICENSE $(DIST_ROOT)/feather-icons
cp -r node_modules/feather-icons/dist/* $(DIST_ROOT)/feather-icons
rm -rf $(DIST_ROOT)/feather-icons/icons
# packaging ###################################################################
dist: $(PYTHON_ENV)
. $(PYTHON_ENV)/bin/activate && \
rm -rf dist *.egg-info && \
python -m build
_release: dist
. $(PYTHON_ENV)/bin/activate && \
twine upload --config-file ~/.pypirc.fscherf dist/*
# tests ########################################################################
test:
docker-compose run playwright tox $(args)
test-script: $(PYTHON_ENV)
. $(PYTHON_ENV)/bin/activate && \
$(PYTHON) test-script/test_script.py $(args)
test-project: | $(PYTHON_VENV)
. $(PYTHON_ENV)/bin/activate && \
lona run-server \
--project-root=test-project \
-s settings.py \
$(args)
# django
smtp-server: $(PYTHON_ENV)
. $(PYTHON_ENV)/bin/activate && \
python -m smtpd -c DebuggingServer -n localhost:1025
$(DJANGO_DATABASE_NAME): | $(PYTHON_ENV)
. $(PYTHON_ENV)/bin/activate && \
DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) django-admin migrate && \
DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) django-admin createsuperuser
test-django-project: | $(PYTHON_ENV) $(DJANGO_DATABASE_NAME)
. $(PYTHON_ENV)/bin/activate && \
lona run-server \
--project-root=test-django-project \
-s settings.py \
$(args)