-
Notifications
You must be signed in to change notification settings - Fork 913
Expand file tree
/
Copy pathMakefile
More file actions
148 lines (125 loc) · 6.72 KB
/
Copy pathMakefile
File metadata and controls
148 lines (125 loc) · 6.72 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
145
146
147
148
.PHONY: help install install-deps lint docs-check check-commits check-pr-title check-assets check-file-sizes check-deprecated-names check-github-docs check-cjk check-datetime openapi check-openapi format test integration package cov ci verify-parity clean
help:
@echo "Targets:"
@echo " install Install deps + pre-commit hooks (full dev setup)"
@echo " install-deps Install deps only (uv sync --frozen, used by CI)"
@echo " lint ruff (check + format-check) + import-linter + datetime discipline + openapi drift"
@echo " docs-check Validate Markdown links, use-case banners, and issue template YAML"
@echo " check-commits Validate Conventional Commit subjects for a git range"
@echo " check-pr-title Validate PR title uses Conventional Commit format"
@echo " check-assets Block committed images, videos, and asset/media directories"
@echo " check-file-sizes Block committed files above the size ceiling (HARD gate, run via lint)"
@echo " check-deprecated-names Block deprecated product names"
@echo " check-github-docs Block legacy/internal branch-model residue in contributor docs"
@echo " check-cjk Scan for CJK outside the language-policy allowlist (advisory)"
@echo " check-datetime Scan for code that bypasses component/utils/datetime (HARD gate, run via lint)"
@echo " openapi Regenerate docs/openapi.json from the FastAPI app"
@echo " check-openapi Verify docs/openapi.json matches app.openapi() (HARD gate, run via lint)"
@echo " format Format src/tests with ruff"
@echo " test pytest tests/unit"
@echo " integration pytest tests/integration"
@echo " package Build sdist/wheel and smoke-test wheel import"
@echo " cov pytest tests/unit + tests/integration with coverage (fail under 80%)"
@echo " ci full CI: lint + test + integration + package"
@echo " clean Remove caches"
# Sync deps from uv.lock; CI calls this directly. --frozen means "lock is the
# source of truth — fail rather than update it".
install-deps:
uv sync --frozen
# One-stop dev setup: deps + pre-commit hooks (both pre-commit and commit-msg
# stages — gitlint runs on commit-msg).
install: install-deps
uv run pre-commit install
uv run pre-commit install --hook-type commit-msg
lint:
uv run ruff check src tests benchmarks
uv run ruff format --check src tests benchmarks
uv run lint-imports
uv run python scripts/check_repo_assets.py
uv run python scripts/check_file_sizes.py
uv run python scripts/check_deprecated_names.py
uv run python scripts/check_github_contributor_docs.py
uv run python scripts/check_datetime_discipline.py
uv run python scripts/dump_openapi.py --check
docs-check:
python3 scripts/check_docs.py
python3 scripts/check_github_contributor_docs.py
ruby -e 'require "yaml"; Dir[".github/ISSUE_TEMPLATE/*.yml"].sort.each { |p| YAML.load_file(p); puts "YAML ok: #{p}" }'
check-commits:
python3 scripts/check_commit_messages.py $(RANGE)
check-pr-title:
python3 scripts/check_pr_title.py
# Repository media hygiene gate. Images/videos belong in external hosting,
# release artifacts, or other approved storage, then linked from docs.
check-assets:
uv run python scripts/check_repo_assets.py
# Repository file size gate (wired into `lint`, and therefore `ci`). Mirrors
# the `check-added-large-files` pre-commit hook so the ceiling is enforced on
# every PR, not only on machines that installed the hooks. Scope is the change
# under review (diff vs the base branch), so existing files are left alone —
# needs `fetch-depth: 0` in CI to resolve the merge base.
check-file-sizes:
uv run python scripts/check_file_sizes.py
# Product naming gate. Public repo text should use EverOS or EverMind Cloud.
check-deprecated-names:
uv run python scripts/check_deprecated_names.py
# GitHub contributor-doc gate. Public contribution guidance must target the
# GitHub `main` workflow, not an internal branch model.
check-github-docs:
uv run python scripts/check_github_contributor_docs.py
# Advisory CJK scan (see .claude/rules/language-policy.md). Deliberately NOT
# wired into `lint` / `ci`: the policy is enforced by review and the rules
# doc, not a hard gate. Run on demand when touching potentially-CJK files.
check-cjk:
uv run python scripts/check_cjk.py
# Datetime two-zone discipline scanner (see .claude/rules/datetime-handling.md).
# Wired into `lint` (and therefore `ci`) as a HARD gate — any code that
# bypasses ``component/utils/datetime`` (raw ``datetime.now()``,
# ``time.time()``, naked ``datetime(...)`` constructor, etc.) fails the build.
check-datetime:
uv run python scripts/check_datetime_discipline.py
# OpenAPI schema export — produce docs/openapi.json from the FastAPI app.
# Run this after touching any HTTP route / DTO; commit the result.
openapi:
uv run python scripts/dump_openapi.py
# OpenAPI drift gate (wired into `lint`). Re-renders the schema in memory
# and diffs it against the committed ``docs/openapi.json``; any drift
# fails the build with a unified diff. Forces the contract doc to track
# the code on every PR that touches the API surface.
check-openapi:
uv run python scripts/dump_openapi.py --check
format:
uv run ruff check --fix src tests benchmarks
uv run ruff format src tests benchmarks
test:
uv run pytest tests/unit -v
# The differential tests compare against a checkout outside this repository, so all of
# them skip when it is absent -- 269 of the 395 benchmark tests, and `make test` still
# reported success. This target refuses to skip: run it before any evaluation, because a
# number produced by an unverified harness is worse than no number.
verify-parity:
BENCHMARK_PARITY_STRICT=1 uv run pytest tests/unit -q -k benchmark
uv run python benchmarks/audit/check_parity.py
uv run python benchmarks/audit/check_protocol.py
uv run python benchmarks/audit/coverage.py
uv run python benchmarks/audit/partition.py
integration:
uv run pytest tests/integration -v
package:
rm -rf dist .package-smoke
uv build --sdist --wheel
uv venv --python 3.12 --seed .package-smoke
uv pip install --python .package-smoke/bin/python --no-deps dist/*.whl
.package-smoke/bin/python -c "import everos; print(everos.__version__)"
rm -rf .package-smoke
# Coverage runs unit + integration so the number matches what CI's `test` and
# `integration` jobs actually exercise. Threshold starts at 80% (unit-only is
# currently 87%, unit+integration 91% — 80% leaves ~10pp headroom for normal
# churn). Bump as the suite stabilises.
cov:
uv run pytest tests/unit tests/integration --cov=src/everos --cov-report=term-missing --cov-branch --cov-fail-under=80
ci: lint test integration package
clean:
rm -rf .pytest_cache .ruff_cache .uv-cache .mypy_cache .coverage htmlcov .package-smoke
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name '*.pyc' -delete