-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcustom.mk
More file actions
134 lines (108 loc) · 5.26 KB
/
Copy pathcustom.mk
File metadata and controls
134 lines (108 loc) · 5.26 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
# MCB private handlers for the FLEXT-generated Make surface.
# Public verbs and environment ownership remain in the generated Makefile.
post-setup:
@hooks_dir=$$(git rev-parse --git-path hooks); \
cp scripts/hooks/pre-commit scripts/hooks/pre-push "$$hooks_dir/"; \
chmod +x "$$hooks_dir/pre-commit" "$$hooks_dir/pre-push"
@# Why (mcb-o96i.19): CI runners need sccache installed before any cargo
@# invocation because .cargo/config.toml sets rustc-wrapper = "sccache".
@# The setup-ci.sh script installs sccache when not present. On local
@# machines where sccache is already installed this is a no-op.
@if [ "$$CI" = "Y" ] && [ -f .github/setup-ci.sh ]; then \
bash .github/setup-ci.sh; \
fi
@printf '%s\n' 'MCB hooks installed'
_custom_build_artifacts:
@if [ "$(RELEASE)" = "1" ]; then \
bash scripts/lib/mcb.sh run cargo build --release; \
else \
bash scripts/lib/mcb.sh run cargo build; \
fi
_custom_test_all:
@if cargo nextest --version >/dev/null 2>&1; then \
MCB_MODEL_ID=test-model bash scripts/lib/mcb.sh run cargo nextest run --workspace; \
else \
MCB_MODEL_ID=test-model bash scripts/lib/mcb.sh run cargo test --workspace --all-targets; \
fi
_custom_test_unit:
@if cargo nextest --version >/dev/null 2>&1; then \
MCB_MODEL_ID=test-model bash scripts/lib/mcb.sh run cargo nextest run --workspace --test unit; \
else \
MCB_MODEL_ID=test-model bash scripts/lib/mcb.sh run cargo test --workspace --test unit; \
fi
_custom_test_integration:
@MCB_MODEL_ID=test-model bash scripts/lib/mcb.sh run cargo test --workspace --test '*integration*'
_custom_test_doc:
@bash scripts/lib/mcb.sh run cargo test --workspace --doc
_custom_test_golden:
@MCB_MODEL_ID=test-model bash scripts/lib/mcb.sh run cargo test -p mcb-server --test e2e "$(if $(strip $(MATCH)),$(MATCH),golden)"
_custom_fmt_check:
@bash scripts/lib/mcb.sh run cargo fmt --all -- --check
@UV_CACHE_DIR=.cache/uv uv run --no-sync ruff format --check scripts
_custom_fmt_all:
$(call _require_apply)
@bash scripts/lib/mcb.sh run cargo fmt --all
@UV_CACHE_DIR=.cache/uv uv run --no-sync ruff format scripts
_custom_fmt_apply: _custom_fmt_all
_custom_fix_check:
@UV_CACHE_DIR=.cache/uv uv run --no-sync ruff check scripts
_custom_fix_all:
$(call _require_apply)
@UV_CACHE_DIR=.cache/uv uv run --no-sync ruff check --fix scripts
_custom_fix_apply: _custom_fix_all
_custom_check_lint:
@bash scripts/lib/mcb.sh run cargo fmt --all -- --check
@bash scripts/lib/mcb.sh run cargo clippy --all-targets -- -D warnings
_custom_check_python:
@UV_CACHE_DIR=.cache/uv uv run --no-sync ruff check scripts
@UV_CACHE_DIR=.cache/uv MYPYPATH=scripts uv run --no-sync mypy scripts/lib
@UV_CACHE_DIR=.cache/uv uv run --no-sync pytest -m 'not slow' scripts/lib/tests
_custom_check_validate:
@bash scripts/lib/mcb.sh validate $(if $(filter 1,$(QUICK)),quick,full)
_custom_check_guard:
@bash scripts/lib/mcb.sh guard
_custom_check_gitops:
@UV_CACHE_DIR=.cache/uv uv run --no-sync python scripts/check/gitops.py
_custom_check_surface:
@UV_CACHE_DIR=.cache/uv uv run --no-sync python scripts/check/surface.py
_custom_check_audit:
@bash scripts/lib/mcb.sh run cargo audit
_custom_check_all:
@UV_CACHE_DIR=.cache/uv uv run --no-sync ruff check scripts
@UV_CACHE_DIR=.cache/uv MYPYPATH=scripts uv run --no-sync mypy scripts/lib
@UV_CACHE_DIR=.cache/uv uv run --no-sync pytest -m 'not slow' scripts/lib/tests
@bash scripts/lib/mcb.sh run cargo fmt --all -- --check
@bash scripts/lib/mcb.sh run cargo clippy --all-targets -- -D warnings
@MCB_MODEL_ID=test-model bash scripts/lib/mcb.sh run cargo test --workspace --all-targets
@bash scripts/lib/mcb.sh validate quick
@bash scripts/lib/mcb.sh guard
_custom_run_mcb-hooks:
$(call _require_apply)
@$(MAKE) --no-print-directory post-setup
_custom_run_mcb-hook-pre-commit:
@bash scripts/lib/mcb.sh guard --staged
@UV_CACHE_DIR=.cache/uv uv run --no-sync ruff check scripts
@UV_CACHE_DIR=.cache/uv uv run --no-sync pytest -m 'not slow' scripts/lib/tests
@bash scripts/lib/mcb.sh run cargo fmt --all -- --check
@bash scripts/lib/mcb.sh run cargo clippy --workspace -- -D warnings
_custom_run_mcb-hook-pre-push:
@UV_CACHE_DIR=.cache/uv uv run --no-sync ruff check scripts
@UV_CACHE_DIR=.cache/uv MYPYPATH=scripts uv run --no-sync mypy scripts/lib
@UV_CACHE_DIR=.cache/uv uv run --no-sync pytest -m 'not slow' scripts/lib/tests
@bash scripts/lib/mcb.sh run cargo fmt --all -- --check
@bash scripts/lib/mcb.sh run cargo clippy --all-targets -- -D warnings
@MCB_MODEL_ID=test-model bash scripts/lib/mcb.sh run cargo test --workspace --all-targets
@bash scripts/lib/mcb.sh run cargo test --workspace --doc
@bash scripts/lib/mcb.sh validate quick
@bash scripts/lib/mcb.sh guard
_custom_gen_agent-pointers:
@if [ "$(CHECK)" != "1" ] && [ "$(APPLY)" != "Y" ]; then printf 'ERROR: this action requires APPLY=Y\n' >&2; exit 2; fi
@UV_CACHE_DIR=.cache/uv uv run --no-sync python scripts/lib/agent_pointers.py $(if $(filter 1,$(CHECK)),--check,)
_custom_status_done-check:
@base=$$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || printf '%s\n' origin/main); \
files=$$(git diff --name-only --diff-filter=d "$$base"...HEAD -- '*.py'); \
if [ -z "$$files" ]; then \
printf '%s\n' 'done-check: no committed Python changes'; \
else \
printf '%s\n' "$$files" | xargs -r ruff check --quiet; \
fi