.PHONY: build test dev wheel clean release first-release
build:
cargo build --release
test:
cargo test
dev:
uv run maturin develop --features python
wheel:
uv run maturin build --release --strip
clean:
cargo clean
rm -rf target/wheels __pycache__
first-release: wheel
uv run maturin sdist -o target/wheels/
@test -f .pypirc || (echo "Missing .pypirc -- cp .pypirc.example .pypirc" && exit 1)
@test -f .cargo-credentials || (echo "Missing .cargo-credentials -- cp .cargo-credentials.example .cargo-credentials" && exit 1)
@echo "--- Uploading to PyPI ---"
uv tool install twine
uv run twine upload --config-file .pypirc target/wheels/*.whl target/wheels/*.tar.gz
@echo "--- Publishing to crates.io ---"
cargo publish --token "$$(grep '^token' .cargo-credentials | sed 's/.*= *"\(.*\)"/\1/')"
@echo ""
@echo "Done. Packages live on PyPI and crates.io."
@echo ""
@echo "For automatic CI releases, push .pypirc and .cargo-credentials"
@echo "as Codeberg repo secrets (Settings > Actions > Secrets):"
@echo " PYPI_TOKEN - the password value from .pypirc"
@echo " CARGO_REGISTRY_TOKEN - the token value from .cargo-credentials"
@echo " RELEASE_TOKEN - the token value from .release-token"
@echo ""
@echo "Then all future releases: make release V=0.1.1"
release:
@test -n "$(V)" || (echo "Usage: make release V=0.1.1" && exit 1)
sed -i 's/^version = ".*"/version = "$(V)"/' Cargo.toml pyproject.toml
git add Cargo.toml pyproject.toml
git commit -m "release v$(V)"
git tag "v$(V)"
git push origin main "v$(V)"