-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (54 loc) · 2.45 KB
/
Copy pathMakefile
File metadata and controls
71 lines (54 loc) · 2.45 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
.DEFAULT_GOAL := all
.PHONY: install lint format typecheck test test-integration test-vm test-nix test-nix-darwin-switch test-op-cli prewarm-vm pull-base-vm test-quick clean all prek-install prek
install:
uv sync
lint:
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
format:
uv run ruff format src/ tests/
uv run ruff check --fix src/ tests/
typecheck:
uv run pyright
test:
uv run pytest
# Pull-if-missing, shared by test-integration/test-vm rather than each duplicating
# the pinned digest. Uses mac2nix.vm.manager.pull_base_image_if_missing() (exact-name
# match + `tart clone <ref> <name>`) rather than a plain-text `tart list | grep`, which
# false-positives: an OCI pull caches under its full registry/repo@digest string, which
# contains "macos-tahoe-base" as a substring without actually being named that.
# Always operates on the one canonical pinned name/digest pair (its own defaults) —
# deliberately ignores MAC2NIX_BASE_VM, since passing only `name=` without a matching
# `image_ref=` would silently clone the unrelated pinned macos-tahoe-base image and
# tag it under whatever name MAC2NIX_BASE_VM names (e.g. mac2nix-nix-base), producing
# a VM that looks prewarmed by name but has no Nix installed. A prewarmed image is
# only ever created for real by `make prewarm-vm`; this target's only job is to
# guarantee the fallback pinned image exists.
pull-base-vm:
uv run python -c "import asyncio; from mac2nix.vm.manager import pull_base_image_if_missing; asyncio.run(pull_base_image_if_missing())"
test-integration: pull-base-vm
uv run pytest -m integration --tb=long
test-vm: pull-base-vm
uv run pytest -m nix_vm --tb=long
test-nix:
uv run pytest -m nix_build --tb=long
# CI-only — skips unless GITHUB_ACTIONS=true (see the test module's own docstring).
# Never invoke this on a real machine; it applies a genuine nix-darwin switch.
test-nix-darwin-switch:
uv run pytest -m nix_darwin_switch --tb=long
# Requires a real, signed-in `op` CLI and MAC2NIX_TEST_OP_VAULT set to a disposable
# test vault — skips otherwise (see tests/test_onepassword.py's op_test_vault fixture).
test-op-cli:
uv run pytest -m op_cli --tb=long
prewarm-vm:
uv run python scripts/prewarm_vm.py
test-quick:
uv run pytest -x --no-header -q
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
rm -rf .cache/ dist/ *.egg-info src/*.egg-info
prek-install:
uvx prek install
prek:
uvx prek run --all-files
all: install lint typecheck test