-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (80 loc) · 2.31 KB
/
Copy pathMakefile
File metadata and controls
96 lines (80 loc) · 2.31 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
# Convenience makefile to build the dev env and run common commands
# Based on https://github.com/niteoweb/Makefile
# Python version uv should use for the environment
python ?= 3.14
# Pass `frozen=1` to run against the locked environment without re-resolving.
# Used by the CI jobs.
ifeq ($(frozen),1)
uv_run := uv run --no-sync --python $(python)
uv_sync := uv sync --frozen --python $(python)
else
uv_run := uv run --python $(python)
uv_sync := uv sync --python $(python)
endif
.PHONY: all
all: tests
# Regenerate both lockfiles: uv.lock (latest deps) and uv-oldest.lock
# (a lowest-direct resolution used by the oldest-supported-deps CI job).
# uv's lockfile indentation differs between versions
.PHONY: lock
lock:
@uv lock --resolution lowest-direct
@cp uv.lock uv-oldest.lock
@uv lock
# Sync the development environment. The ty hook and the test suite run against
# this .venv, so linting and testing targets depend on it.
.PHONY: install
install:
@$(uv_sync)
# Run prek checks on changed files only:
# 1. get all unstaged modified files
# 2. get all staged modified files
# 3. get all untracked files
# 4. run prek checks on them
.PHONY: lint
lint: install
@{ git diff --name-only ./; git diff --name-only --staged ./; git ls-files --other --exclude-standard; } \
| sort -u | uniq | xargs prek run --files
# Run prek checks on all files in the repository.
.PHONY: lint-all
lint-all: install
@prek run --all-files
.PHONY: type
type: types
.PHONY: types
types: install
@ty check --error-on-warning pyramid_openapi3 examples
# anything, in regex-speak
filter = "."
# additional arguments for pytest
full_suite = "false"
ifeq ($(filter),".")
full_suite = "true"
endif
ifdef path
full_suite = "false"
endif
args = ""
pytest_args = -k $(filter) $(args)
ifeq ($(args),"")
pytest_args = -k $(filter)
endif
verbosity = ""
ifeq ($(full_suite),"false")
verbosity = -vv
endif
full_suite_args = ""
ifeq ($(full_suite),"true")
full_suite_args = --junitxml junit.xml --durations 10 --cov=pyramid_openapi3 --cov-branch --cov-report html --cov-report xml:cov.xml --cov-report term-missing --cov-fail-under=100
endif
.PHONY: unit
unit:
ifndef path
@$(uv_run) pytest pyramid_openapi3 $(verbosity) $(full_suite_args) $(pytest_args)
else
@$(uv_run) pytest $(path)
endif
.PHONY: test
test: tests
.PHONY: tests
tests: lint-all types unit