Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
144 lines (103 loc) · 4.9 KB
/
Copy pathMakefile
File metadata and controls
144 lines (103 loc) · 4.9 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
138
139
140
141
142
143
144
SHELL := /bin/bash
.ONESHELL:
.PHONY: mutation up down logs emulator-up emulator-down emulator-logs emulator-config emulator-ps fleet-up fleet-down fleet-logs fleet-ps fleet-config fleet-build up-standalone test test-unit test-integration test-contract seed-libraries seed-tapes seed-all clean build-frontend dev-backend dev-frontend dev frontend lint build all test-hardware protocols-up protocols-down test-protocols hw-preflight lan-up lan-down
# Start all services
up:
docker compose up -d
# Stop all services
down:
docker compose down
# View logs
logs:
docker compose logs -f
# Start standalone emulator services from local Docker build assets
emulator-up:
./scripts/emulator/run_standalone_stack.sh up
emulator-down:
./scripts/emulator/run_standalone_stack.sh down
emulator-logs:
./scripts/emulator/run_standalone_stack.sh logs
emulator-config:
./scripts/emulator/run_standalone_stack.sh config
emulator-ps:
./scripts/emulator/run_standalone_stack.sh ps
# Fleet stack: OpenBlade API/web + standalone emulators
fleet-up:
./scripts/emulator/run_fleet_stack.sh up
fleet-down:
./scripts/emulator/run_fleet_stack.sh down
fleet-logs:
./scripts/emulator/run_fleet_stack.sh logs
fleet-ps:
./scripts/emulator/run_fleet_stack.sh ps
fleet-config:
./scripts/emulator/run_fleet_stack.sh config
fleet-build:
./scripts/emulator/run_fleet_stack.sh build
# Backward-compatible alias
up-standalone: fleet-up
# Run all tests (excluding hardware)
test:
python3 -m pytest tests/unit/ tests/safety/ tests/integration/ -q --tb=short
# Run unit tests only (faster)
test-unit:
python3 -m pytest tests/unit/ tests/safety/ -q --tb=short
# Run integration tests
test-integration:
python3 -m pytest tests/integration/ -q --tb=short
# Run the backend contract suite against every backend pairing
# (the real+real pairing skips unless OPENBLADE_REAL_HARDWARE_ENABLED=true)
test-contract:
python3 -m pytest tests/contract/ -m contract -q --tb=short
# Seed default library instances (library-1, library-2, library-3)
seed-libraries:
python3 -c $$'from openblade.catalog.db import get_session, init_db\nfrom openblade.catalog.repository import CatalogRepository\nfrom openblade.config import load_config\n\ndb_url = load_config().db_url\ninit_db(db_url)\nrepo = CatalogRepository(get_session())\nfor name, url in [("library-1", "http://localhost:8010"), ("library-2", "http://localhost:8011"), ("library-3", "http://localhost:8012")]:\n existing = repo.get_library_instance_by_name(name)\n if existing:\n print(f"Skipped {name} (already exists)")\n continue\n repo.create_library_instance(name=name, emulator_url=url, model="Scalar i3")\n print(f"Created {name}")'
# Seed demo tapes into the default AML state
seed-tapes:
python3 -c $$'from openblade.api import aml_state\nfrom openblade.config import load_config\n\ndb_url = load_config().db_url\naml_state.ensure_initialized(db_url, force_reset=True)\nprint("AML state initialized with", len(aml_state.list_aml_media()), "media items")'
# Seed everything
seed-all: seed-libraries seed-tapes
# Clean build artifacts and test cache
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -name '*.pyc' -delete 2>/dev/null || true
rm -rf .pytest_cache frontend/dist frontend/node_modules/.vite
# Build frontend
build-frontend:
cd frontend && npm run build
# Dev: start backend only
dev-backend:
python3 -m uvicorn openblade.api.main:app --reload --host 0.0.0.0 --port 8000
# Dev: start frontend only
dev-frontend:
cd frontend && npm run dev
dev: dev-backend
frontend: dev-frontend
lint:
ruff check . && ruff format --check .
build: build-frontend
all: lint test build
test-hardware:
OPENBLADE_BACKEND=real OPENBLADE_REAL_HARDWARE_ENABLED=true python3 -m pytest tests/hardware/ -v
# Read-only day-one rig check (no motion; must not run armed). Lane: PREFLIGHT_LANE=readonly|destructive.
hw-preflight:
python3 -m tools.hardware.preflight --lane $${PREFLIGHT_LANE:-readonly}
# NAS protocol rig (SMB/NFS, containerised). Host ports: OB_SMB_PORT / OB_NFS_PORT.
PROTOCOLS_COMPOSE = docker compose -f deploy/nas-protocols/docker-compose.yml
protocols-up:
python -m tests.e2e.protocols.rig
OB_SMB_PORT=$${OB_SMB_PORT:-14450} OB_NFS_PORT=$${OB_NFS_PORT:-20490} $(PROTOCOLS_COMPOSE) up -d --build --wait
protocols-down:
$(PROTOCOLS_COMPOSE) down -v --remove-orphans
test-protocols:
python -m pytest -m protocols tests/e2e/protocols -q
# Mutation lane (nightly); see tools/mutation_run.sh and mutation/baseline.txt
mutation:
PYTHON=$${PYTHON:-python} MUTATION_TIMEOUT=$${MUTATION_TIMEOUT:-3600} tools/mutation_run.sh
# LAN exposure (production mode, ports 8090/8091/8092). Needs deploy/lan/.env
# filled from deploy/lan/.env.example; see deploy/lan/README.md.
LAN_COMPOSE = docker compose -p openblade-lan -f docker-compose.yml -f deploy/lan/docker-compose.lan.yml --profile web-flask --env-file deploy/lan/.env
lan-up:
$(LAN_COMPOSE) up -d --build
lan-down:
$(LAN_COMPOSE) down