-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (60 loc) · 2.14 KB
/
Makefile
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
.PHONY: auth auth-install build build-install bump dev-install pip-upgrade publish publish-nobump publish-nobump-nobuild precheck setup test-basic test
# Source: https://web.mit.edu/gnu/doc/html/make_6.html
GOOGLE_CLOUD_PYPI_URL = https://us-central1-python.pkg.dev/moshi-3/pypi/
auth:
gcloud auth login
auth-install:
@echo "🧰 Installing auth dependencies..."
PIP_NO_INPUT=1 pip install twine keyring keyrings.google-artifactregistry-auth
@echo "🧰✅ Auth dependencies installed."
build-install:
@echo "📦 Installing build tools..."
PIP_NO_INPUT=1 pip install --upgrade pip
PIP_NO_INPUT=1 pip install build twine
@echo "📦✅ Installed."
build:
@echo "🏗 Building Python3 package..."
rm -rf dist 2>/dev/null
PIP_NO_INPUT=1 python -m build
@echo "🏗✅ Built."
bump:
@echo "📈 Bumping version..."
./scripts/bump_version.sh
@echo "📈✅ Bumped."
dev-install:
@echo "📦 Installing this package (moshi-audio)..."
PIP_NO_INPUT=1 pip install -e .[dev,test]
@echo "📦✅ Installed."
pip-upgrade:
@echo "📦 Upgrading pip..."
PIP_NO_INPUT=1 pip install --upgrade pip
@echo "📦✅ Upgraded."
publish: bump publish-nobump
publish-nobump: build publish-nobump-nobuild
publish-nobump-nobuild:
@echo "📤 Publishing to $(GOOGLE_CLOUD_PYPI_URL) ..."
python3 -m twine upload \
--repository-url $(GOOGLE_CLOUD_PYPI_URL) \
"dist/*" \
--verbose
@echo "📤✅ Published."
precheck:
@echo "🧪 Checking preconditions..."
@python3 -c 'import sys; assert sys.version_info >= (3, 10), f"Python version >= 3.10 required, found {sys.version_info}"' \
&& echo "✅ Python 3 version >= 3.10" \
|| (echo "❌ Python 3 version < 3.10"; exit 1)
@pip --version >/dev/null 2>&1 \
&& echo "✅ Pip installed" \
|| (echo "❌ Pip not found"; exit 1)
@echo "🧪✅ Preconditions met."
setup: precheck pip-upgrade auth-install build-install dev-install
@echo "🧰 Setup complete."
test:
@echo "🧪 Running unit tests..."
ENV='dev' LOG_LEVEL='DETAIL' LOG_FORMAT='rich' \
pytest
@echo "🧪✅ Tests passed."
test-cov:
@echo "📊 Showing test coverage report..."
coverage report
@echo "📊✅ Done."