-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathMakefile
70 lines (52 loc) · 2.18 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
## Prepare environment for development
prepare:
sudo apt update
# Install python with virtual env and dev extensions, graphicsmagick, and gcc
sudo apt install -y python3.9 python3.9-venv libpython3.9-dev python-dev libpq-dev graphicsmagick gcc postgresql
# Install node: https://github.com/nodesource/distributions/blob/master/README.md#deb
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install poetry: https://python-poetry.org/docs/#installing-with-the-official-installer
curl -sSL https://install.python-poetry.org | python3.9 -
# Install yarn
sudo npm install -g yarn
yarn install
yarn prepare # Sets up Git hooks
# Ensure poetry can be called from the command line and make commands
@echo "User action required: Make poetry available in your PATH. This will vary depending on your configuration"
@echo "If using bash, add 'export PATH=\"\$$PATH:\$$HOME/.local/bin\"' to your .bashrc and then run 'source ~/.bashrc'"
db-prepare:
sudo systemctl start postgresql
sudo -u postgres psql -c "create user arlo superuser password 'arlo';"
sudo -u postgres psql -c "create database arlo with owner arlo;"
make db-clean
## Local development
dev-environment: prepare db-prepare install
run: # Used for development, not during production deployment. Defaults to 3 ports - 8080, 3000, 3001
./run-dev.sh
## Following commands are mainly for server development, since client is encapsulated in a subdirectory
install:
poetry install
yarn install
make -C client install
typecheck:
poetry run mypy server scripts fixtures
format:
poetry run black .
lint:
poetry run pylint server scripts fixtures
test:
poetry run pytest -n auto --ignore=server/tests/arlo-extra-tests
test-clean:
FLASK_ENV=test make db-clean
test-coverage:
poetry run pytest -n auto --cov=. --ignore=server/tests/arlo-extra-tests
test-extra: # This runs the _extra files_ repo tests as well (must download first)
poetry run pytest -n auto
test-extra-coverage:
poetry run pytest -n auto --cov=.
## Database
db-clean:
FLASK_ENV=$${FLASK_ENV:-development} poetry run python -m scripts.resetdb
db-migrate:
FLASK_ENV=$${FLASK_ENV:-development} poetry run alembic upgrade head