-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (84 loc) · 3.23 KB
/
Copy pathMakefile
File metadata and controls
98 lines (84 loc) · 3.23 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
.PHONY: help test test-unit test-cov install install-dev lint clean build upload version run-tests test-all
# Default target
help:
@echo "Available targets:"
@echo " help - Show this help"
@echo " install - Install the package and dependencies with uv"
@echo " install-dev - Same as install (dev dependency group included)"
@echo " test - Run tests with unittest"
@echo " test-unit - Run tests with unittest (verbose)"
@echo " test-cov - Run tests with coverage (requires pytest)"
@echo " lint - Run linting checks"
@echo " clean - Clean build artifacts"
@echo " build - Build the package"
@echo " upload - Emergency manual PyPI upload (prefer Trusted Publishing)"
@echo " version - Bump version, commit, and tag vX.Y.Z (VERSION=x.y.z)"
# Install the package and dependencies
install:
uv sync
# Install development dependencies (same as install; dev group is default)
install-dev: install
# Run tests with unittest
test:
uv run python -m unittest discover tests -v
# Run tests with unittest (verbose)
test-unit:
uv run python -m unittest discover tests -v
# Run tests with coverage (requires pytest)
test-cov:
uv run pytest tests/ --cov=vex --cov-report=term-missing --cov-report=html
# Run linting checks
lint:
@echo "Running flake8..."
uv run flake8 vex/ --count --select=E9,F63,F7,F82 --show-source --statistics
@echo "Running black (check only)..."
uv run black --check --diff vex/ tests/
@echo "Running isort (check only)..."
uv run isort --check-only --diff vex/ tests/
# Clean build artifacts
clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf htmlcov/
rm -rf .coverage
rm -rf .pytest_cache/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
# Build the package
build: clean
uv build
# Emergency manual upload. Prefer Trusted Publishing: see `make version` / docs/DEVELOPMENT.md.
upload: build
@echo "WARNING: Prefer Trusted Publishing (tag on main after develop->main PR). Continuing with twine..."
uv run twine upload dist/*
# Bump version, commit, and create an annotated git tag.
# Usage: make version VERSION=1.2.3
# CI publishes to PyPI via Trusted Publishing after the tag is on main.
version:
ifndef VERSION
$(error VERSION is required. Usage: make version VERSION=1.2.3)
endif
uv version $(VERSION)
git add pyproject.toml uv.lock
git commit -m "Bump version to $(VERSION)"
git tag -a "v$(VERSION)" -m "v$(VERSION)"
@echo ""
@echo "Created commit and local tag v$(VERSION)."
@echo ""
@echo "Next steps (main is protected — do not push commits to main):"
@echo " 1. Push the version bump on develop:"
@echo " git push origin develop"
@echo " 2. Open a PR develop -> main on GitHub and merge it."
@echo " 3. After the merge, push the tag:"
@echo " git push origin v$(VERSION)"
@echo " 4. Approve the pypi environment deployment in Actions if prompted."
@echo " 5. Confirm https://pypi.org/project/vex-reader/"
@echo ""
@echo "Do not push the tag before the PR merges (the release job requires"
@echo "the tagged commit to already be on main). See docs/DEVELOPMENT.md."
# Run the test runner script
run-tests:
uv run python run_tests.py --verbose
# Install and run tests
test-all: install-dev test