-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathMakefile
More file actions
97 lines (69 loc) · 2.65 KB
/
Makefile
File metadata and controls
97 lines (69 loc) · 2.65 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
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
SHELL := /bin/bash
#
# Dev setup
#
dev-environment:
@echo '⚠️ This command assumes an Ubuntu 24 environment'
@echo
@# Necessary for Python 3.11 package discovery
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update
sudo apt install -y curl
@# Install Python 3.11
sudo apt install -y python3.11 python3.11-venv libpython3.11-dev python-dev-is-python3
@# Install other apt packages
sudo apt install -y gcc graphicsmagick libpq-dev 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 install -y nodejs
@# Install Poetry: https://python-poetry.org/docs/#installing-with-the-official-installer
curl -sSL https://install.python-poetry.org | python3.11 -
@# Install Yarn
sudo npm install -g yarn
yarn install
yarn prepare # Set up Git hooks
@echo
@echo '⚠️ User action required: Make poetry available in your PATH.'
@echo "⚠️ If using bash, run: echo 'export PATH=\"\$$PATH:\$$HOME/.local/bin\"' >> ~/.bashrc && source ~/.bashrc"
install:
poetry env use 3.11
poetry install
make -C client install
dev-dbs:
sudo systemctl start postgresql
sudo -u postgres psql -c "create user arlo superuser password 'arlo';" || \
sudo -u postgres psql -c "alter user arlo superuser password 'arlo';"
@# The following commands require Python packages to be installed
make db-clean # Initialize dev DB
FLASK_ENV=test make db-clean # Initialize test DB
sudo -u postgres psql -c "alter system set timezone = 'UTC'";
sudo systemctl restart postgresql
run: # Used for development, not during production deployment. Defaults to 3 ports - 8080, 3000, 3001
./run-dev.sh
#
# Server-specific commands; see client/Makefile for client-specific commands
#
typecheck:
poetry run basedpyright
typecheck-update-baseline:
poetry run basedpyright --writebaseline
format:
poetry run ruff format .
lint:
poetry run ruff check server scripts fixtures
test:
poetry run pytest -n auto --ignore=server/tests/arlo-extra-tests
test-coverage:
poetry run pytest -n auto --cov=. --ignore=server/tests/arlo-extra-tests
test-extra: # This additionally runs the tests in arlo-extra-tests (must download first)
poetry run pytest -n auto
test-extra-coverage:
poetry run pytest -n auto --cov=.
# Can't run with parallelization (-n auto) when updating snapshots
test-update-snapshots:
poetry run pytest -n 1 --ignore=server/tests/arlo-extra-tests --snapshot-update
poetry run ruff format .
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