-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
137 lines (104 loc) · 4.69 KB
/
Copy pathMakefile
File metadata and controls
137 lines (104 loc) · 4.69 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
include scripts/shared.mk
include scripts/terraform/terraform.mk
.DEFAULT_GOAL := help
.PHONY: clean config dependencies githooks-config githooks-run help test test-lint test-unit lint _install-uv \
up down restart logs build rebuild run run-pacs run-mwl run-listener run-upload ps shell docker-clean \
package deploy-app \
review dev preprod prod
.SILENT: help
# ---------------------------------------------------------------------------
# Help & Meta
# ---------------------------------------------------------------------------
help: # Print help @Others
printf "\nUsage: \033[3m\033[93m[arg1=val1] [arg2=val2] \033[0m\033[0m\033[32mmake\033[0m\033[34m <command>\033[0m\n\n"
perl -e '$(HELP_SCRIPT)' $(MAKEFILE_LIST)
# ---------------------------------------------------------------------------
# Operations
# ---------------------------------------------------------------------------
package: # Create release package @Operations
./scripts/bash/package_release.sh
GATEWAY_RINGS ?= ring0
deploy-app: # Deploy gateway app to the target environment - make <env> deploy-app RELEASE_TAG=<tag> @Operations
@[ -n "$(RELEASE_TAG)" ] || (echo "ERROR: RELEASE_TAG is required. Usage: make <env> deploy-app RELEASE_TAG=<tag>"; exit 1)
scripts/bash/deploy_stage.sh "$(ENV_CONFIG)" "$(GATEWAY_RINGS)" "$(RELEASE_TAG)"
clean: # Clean-up project resources @Operations
@echo "Cleaning up..."
rm -rf .pytest_cache __pycache__ .coverage htmlcov/ .mypy_cache .ruff_cache
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
# ---------------------------------------------------------------------------
# Bootstrap & Environment
# ---------------------------------------------------------------------------
config: _install-tools _install-uv githooks-config dependencies # Configure development environment @Configuration
dependencies: # Install dependencies @Pipeline
uv sync --all-extras
githooks-config: # Install pre-commit hooks @Configuration
@if ! command -v pre-commit >/dev/null 2>&1; then \
PC_VERSION=$$(awk '/^pre-commit / {print $$2}' .tool-versions); \
echo "Installing pre-commit==$${PC_VERSION}..."; \
pip install "pre-commit==$${PC_VERSION}"; \
fi
pre-commit install -c .pre-commit-config.yaml
githooks-run: # Run git hooks @Operations
pre-commit run \
--config .pre-commit-config.yaml \
--all-files
_install-uv:
@if ! uv --version >/dev/null 2>&1; then \
UV_VERSION=$$(awk '/^uv / {print $$2}' .tool-versions); \
echo "Installing uv==$${UV_VERSION}..."; \
pip install "uv==$${UV_VERSION}"; \
else \
echo "uv already installed"; \
fi
# ---------------------------------------------------------------------------
# Database backup
# ---------------------------------------------------------------------------
backup-dbs: # Backup sqlite databases @Operations
PYTHONPATH=src uv run python -c'import scripts.python.database; scripts.python.database.backup_databases()'
reset-worklist: # Reset worklist database @Operations
PYTHONPATH=src uv run python -c'import scripts.python.database; scripts.python.database.reset_worklist_database()'
# ---------------------------------------------------------------------------
# Testing
# ---------------------------------------------------------------------------
test: test-unit test-integration test-lint # Run all tests @Testing
test-unit: # Run unit tests (use ARGS="<args>" for additional options) @Testing
uv run pytest -m "not integration" $(ARGS)
test-integration:
uv run pytest -m "integration" $(ARGS)
test-lint: # Lint files (check only, as CI does) @Testing
uv run ruff check .
uv run ruff format --check .
uv run pyright
lint: # Auto-fix lint and formatting issues @Testing
uv run ruff check --fix .
uv run ruff format .
run: # Start all services in the foreground
docker compose up
up: # Start all services
docker compose up -d
down: # Stop all services
docker compose down
restart: down up # Restart all services
logs: # Tail logs from all services (use SVC=<name> for specific service)
docker compose logs -f $(SVC)
build: # Build Docker images
docker compose build
rebuild: # Rebuild and restart services
docker compose up -d --build
run-pacs: # Start PACS server only
docker compose up -d pacs
run-mwl: # Start MWL server only
docker compose up -d mwl
run-listener: # Start relay listener only
docker compose up -d listener
run-upload: # Start upload service only
docker compose up -d upload
ps: # Show running services
docker compose ps
shell: # Open shell in a service container (use SVC=pacs|mwl|listener|upload)
docker compose exec $(SVC) /bin/sh
docker-clean: down # Stop services and remove volumes
docker compose down -v
docker system prune -f