-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (51 loc) · 1.96 KB
/
Copy pathMakefile
File metadata and controls
69 lines (51 loc) · 1.96 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
.PHONY: compose_build up test_db create_database clean down tests lint fmt backend-unit-tests frontend-unit-tests test build watch start redis-cli bash
compose_build:
docker compose build
up:
docker compose up -d --build
test_db:
@for i in `seq 1 5`; do \
if (docker compose exec postgres sh -c 'psql -U postgres -c "select 1;"' 2>&1 > /dev/null) then break; \
else echo "postgres initializing..."; sleep 5; fi \
done
docker compose exec postgres sh -c 'psql -U postgres -c "drop database if exists tests;" && psql -U postgres -c "create database tests;"'
pull-deepseek-r1:
docker compose exec ollama ollama pull deepseek-r1:7b
create_database:
docker compose run server create_db
clean:
docker compose down && docker compose rm
down:
docker compose down
tests:
docker compose run server tests
fmt:
@echo "Formatting changed files..."
@CHANGED=$$(git diff --cached --name-only --diff-filter=ACM; git diff --name-only --diff-filter=ACM); \
CHANGED=$$(echo "$$CHANGED" | sort -u); \
JS_FILES=$$(echo "$$CHANGED" | grep -E '\.(js|jsx|ts|tsx|json|css|scss|less|md)$$'); \
PY_FILES=$$(echo "$$CHANGED" | grep -E '\.py$$'); \
if [ -z "$$CHANGED" ]; then echo "No changed files to format."; exit 0; fi; \
if [ -n "$$JS_FILES" ]; then echo "$$JS_FILES" | xargs npx prettier --config .prettierrc.json --write; fi; \
if [ -n "$$PY_FILES" ]; then echo "$$PY_FILES" | xargs black; echo "$$PY_FILES" | xargs ruff check --fix 2>/dev/null; fi; \
STAGED=$$(git diff --cached --name-only --diff-filter=ACM); \
if [ -n "$$STAGED" ]; then echo "$$STAGED" | xargs git add; fi
@echo "Done. Changed files formatted."
lint:
flake8 --config=.flake8 .
backend-unit-tests: up test_db
docker compose run --rm --name tests server tests
frontend-unit-tests:
npm ci
npm test
test: lint backend-unit-tests frontend-unit-tests
build:
npm run build
watch:
npm run watch
start:
npm run start
redis-cli:
docker compose run --rm redis redis-cli -h redis
bash:
docker compose run --rm server bash