-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (113 loc) · 4.74 KB
/
Makefile
File metadata and controls
126 lines (113 loc) · 4.74 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
# m-test-engine — container lifecycle.
#
# All targets shell out to `docker compose -f docker/compose.yml`. The
# bind mount in compose.yml uses $PWD by default, so for consumer
# projects, run these from the consumer's repo root (with M_TEST_ENGINE
# pointing at this repo's checkout) — that way /work in the container
# matches your project tree.
#
# A typical consumer-side wrapper (in m-cli/Makefile, m-stdlib/Makefile):
#
# M_TEST_ENGINE ?= $(HOME)/projects/m-test-engine
# engine-up:
# $(MAKE) -C $(M_TEST_ENGINE) up
# engine-down:
# $(MAKE) -C $(M_TEST_ENGINE) down
#
# But run-from-here works too: cd into m-test-engine and `make smoke`
# for a quick check.
.PHONY: up down logs shell smoke clean manifest check-manifest check-docs-prose skill-install
COMPOSE := docker compose -f docker/compose.yml
up:
$(COMPOSE) up -d --build
@echo
@echo "m-test-engine is up. Verify with: make smoke"
down:
$(COMPOSE) down
logs:
$(COMPOSE) logs -f
shell:
docker exec -it m-test-engine bash
# Smoke check — the container is running, `mumps` works, the Phase 3
# OCI labels are present, and the healthcheck reports healthy/starting.
#
# %XCMD is the most universally available entry point across
# yottadb-base image versions. Using single-quoted M command avoids
# the inside-container bash expanding $ZVERSION (which is a YDB
# special variable, not a bash variable — bash would empty it).
smoke:
@echo "→ mumps -run %XCMD inside container"
@docker exec m-test-engine bash -lc \
'$$ydb_dist/mumps -run %XCMD '\''write "smoke ok",!'\'
@echo
@echo "→ Phase 3 OCI labels"
@for k in protocol bind-mount ydb-version image-rev; do \
v=$$(docker inspect --format '{{ index .Config.Labels "org.m-dev-tools.m-test-engine.'$$k'" }}' m-test-engine); \
if [ -z "$$v" ]; then \
echo " MISSING: org.m-dev-tools.m-test-engine.$$k" >&2; exit 1; \
fi; \
printf " ✓ %-15s %s\n" "$$k" "$$v"; \
done
@echo
@echo "→ HEALTHCHECK"
@hc=$$(docker inspect --format '{{ .State.Health.Status }}' m-test-engine 2>/dev/null); \
if [ -z "$$hc" ] || [ "$$hc" = "<no value>" ]; then \
echo " MISSING: image has no HEALTHCHECK directive" >&2; exit 1; \
fi; \
case "$$hc" in \
healthy|starting) echo " ✓ status: $$hc";; \
*) echo " FAIL: status=$$hc (expected healthy or starting)" >&2; exit 1;; \
esac
@echo
@echo "→ Phase 4 mte status --json"
@python3 tools/check-mte.py
# Destructive: stop AND remove the globals volume. Useful when a test
# left ^STDLIB or similar in a bad state and you want a clean slate.
clean:
$(COMPOSE) down -v
# ── Phase-0 AI-discoverability contract ───────────────────────────────
#
# Tier-2 entry to the org catalog. See
# https://github.com/m-dev-tools/.github/blob/main/docs/AI-discoverability-plan.md
#
# `dist/lifecycle.json` is hand-authored, not regenerated — the source
# of truth for the container's name, image base, mount point, and the
# make/compose lifecycle targets is the Dockerfile + compose.yml + this
# Makefile, all already committed. When any of those change in a way
# that affects an external claim, update lifecycle.json in the same
# commit (this is captured in AGENTS.md § Guardrails).
#
# `make manifest` is therefore a pointer no-op — it exists so
# verification_commands in dist/repo.meta.json line up with other org
# repos.
manifest:
@echo "m-test-engine: dist/lifecycle.json is hand-authored alongside Dockerfile + compose.yml."
@echo " see AGENTS.md § Build / generate for the rebuild-when-it-changes guardrail."
check-manifest:
python3 tools/check-manifest.py
# ── Phase 5: skill generator (~/claude/skills/m-engine) ─────────────
#
# Auto-generated skill driven by dist/m-test-engine.json. Mirrors the
# m-stdlib pattern: the manifest is the source of truth; the skill is
# a derived artifact regenerated on manifest bumps.
#
# Idempotent. Safe to re-run after a fresh git clone — overwrites the
# generated SKILL.md but leaves any unrelated files in
# ~/claude/skills/m-engine/ alone.
skill-install:
python3 tools/gen-skill.py
# Guardrail: docs/ holds only human-readable prose. Same target name
# as the tier-1 repos so cross-repo muscle memory works.
check-docs-prose:
@if [ ! -d docs ]; then echo "check-docs-prose: no docs/ directory ✓"; exit 0; fi; \
violations=$$(find docs -type f \
! -name '*.md' ! -name '*.markdown' \
! -name '*.png' ! -name '*.jpg' ! -name '*.jpeg' \
! -name '*.gif' ! -name '*.svg' ! -name '*.webp' \
! -name '.gitkeep'); \
if [ -n "$$violations" ]; then \
echo "ERROR: non-prose files under docs/ — move to a top-level domain dir:" >&2; \
echo "$$violations" >&2; \
exit 1; \
fi; \
echo "check-docs-prose: docs/ is prose-only ✓"