-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (48 loc) · 2 KB
/
Copy pathMakefile
File metadata and controls
66 lines (48 loc) · 2 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
.PHONY: up up-full down logs status psql migrate oauth-setup lint format format-check test test-quick audit ci pre-commit clean
up:
docker compose up -d --build
up-full:
docker compose --profile ingestion up -d --build
down:
docker compose down
logs:
docker compose logs -f
status:
@docker compose ps
@echo ""
@echo "--- Sync Log ---"
@docker compose exec -T postgres sh -c 'psql -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" -c "SELECT endpoint, last_sync_date, record_count, last_success_at, consecutive_failures FROM sync_log ORDER BY endpoint;"'
psql:
docker compose exec postgres sh -c 'psql -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"'
migrate:
docker compose run --rm migrate
# One-shot local OAuth setup. The callback is published on 127.0.0.1:8765 only.
# To use a different port, set OURA_REDIRECT_URI (e.g. http://localhost:9000/callback)
# AND update the -p mapping below to match, otherwise Docker won't publish that port.
oauth-setup:
docker compose build ingestion
docker compose run --rm --no-deps --user "$$(id -u):$$(id -g)" -p 127.0.0.1:8765:8765 -v "$(CURDIR):/workspace" -w /workspace -e PYTHONPATH=/workspace/ingestion ingestion python -m oura_ingest.cli --oauth-setup --oauth-host 0.0.0.0
# ---------------------------------------------------------------------------
# CI / quality targets
# ---------------------------------------------------------------------------
lint:
ruff check ingestion/ streamlit/ tests/
format:
ruff format ingestion/ streamlit/ tests/
format-check:
ruff format --check ingestion/ streamlit/ tests/
test:
pytest tests/ --cov=oura_ingest --cov-branch --cov-report=term-missing --cov-fail-under=93
test-quick:
pytest
audit:
pip-audit -r ingestion/requirements.txt
pip-audit -r streamlit/requirements.txt
npm audit --prefix scripts --audit-level=high
ci: lint format-check test
pre-commit:
pre-commit install
clean:
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type d -name .pytest_cache -exec rm -rf {} +
find . -type d -name .ruff_cache -exec rm -rf {} +