-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (81 loc) · 4.16 KB
/
Copy pathMakefile
File metadata and controls
105 lines (81 loc) · 4.16 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
# FideX PHP Reference Implementation — Makefile
# Usage: make <target>
PHP ?= php
PHPUNIT ?= vendor/bin/phpunit
PHPSTAN ?= vendor/bin/phpstan
.PHONY: help install install-webapp keys migrate test test-unit test-integration test-crypto stan serve worker build-webapp clean
# ─── Default ─────────────────────────────────────────────────────────────────
help:
@echo "FideX PHP Reference Implementation"
@echo ""
@echo "Setup:"
@echo " make install Install Composer dependencies"
@echo " make install-webapp Install Node.js (TypeScript) devDependencies"
@echo " make keys Generate RSA-4096 key pairs"
@echo " make migrate Create/update database tables"
@echo ""
@echo "Development:"
@echo " make serve Start PHP dev server on :8080 (webapp at /onboarding/)"
@echo " make worker Run queue worker once"
@echo " make test Run all tests"
@echo " make test-unit Run unit tests only (no crypto)"
@echo " make test-integration Run integration tests (SQLite :memory:)"
@echo " make test-crypto Run crypto round-trip tests"
@echo " make stan Run PHPStan static analysis"
@echo " make build-webapp Compile TypeScript webapp → public/onboarding/app.js"
@echo ""
@echo "Maintenance:"
@echo " make clean Remove generated files (not keys/db)"
# ─── Setup ───────────────────────────────────────────────────────────────────
install:
composer install --prefer-dist --no-interaction
keys:
$(PHP) bin/generate-keys.php
migrate:
$(PHP) bin/migrate.php
setup: install keys migrate
@echo "✓ FideX PHP node is ready. Edit .env and run: make serve"
@echo " Onboarding UI available at: http://localhost:8080/onboarding/"
# ─── Development ─────────────────────────────────────────────────────────────
serve:
@echo "Starting FideX dev server at http://localhost:8080"
$(PHP) -S 0.0.0.0:8080 -t public/
worker:
$(PHP) bin/worker.php
worker-loop:
@echo "Running queue worker in a loop (Ctrl+C to stop)..."
@while true; do $(PHP) bin/worker.php; sleep 5; done
# ─── Testing ─────────────────────────────────────────────────────────────────
test:
$(PHPUNIT) --colors=always
test-unit:
$(PHPUNIT) --testsuite Unit --colors=always
test-crypto:
$(PHPUNIT) tests/Unit/Adapter/Crypto/ --colors=always
test-integration:
$(PHPUNIT) --testsuite Integration --colors=always
test-use-cases:
$(PHPUNIT) tests/Unit/Core/UseCase/ --colors=always
test-coverage:
XDEBUG_MODE=coverage $(PHPUNIT) --coverage-text --colors=always
# ─── Static Analysis ─────────────────────────────────────────────────────────
stan:
$(PHPSTAN) analyse src tests --level 5
# ─── Webapp (TypeScript) ──────────────────────────────────────────────────────
install-webapp:
npm install
build-webapp: install-webapp
npm run build
@echo "✓ Webapp compiled → public/onboarding/app.js"
# ─── Maintenance ─────────────────────────────────────────────────────────────
clean:
rm -rf .phpunit.cache .phpunit.result.cache .phpstan.result.cache
# ─── Docker (for local dev on Linux/Mac) ─────────────────────────────────────
up:
docker compose up -d
down:
docker compose down
docker-test:
docker compose run --rm app make test
docker-migrate:
docker compose run --rm app make migrate