erldistpy/.gitlab-ci.yml
russell@unturf.com 001a471549
packaging: ship to PyPI via tag + GitLab CI (mirrors ago's pattern)
pyproject.toml gains the metadata PyPI expects:
  - Real author name + email
  - Keywords (erlang, elixir, distribution, gen_server, ...)
  - Classifiers (status, license, Python versions, topic)
  - Project URLs (Homepage / Repository / Bug Tracker)
  - readme content-type = text/markdown so PyPI renders our README
  - build + twine added to the [dev] extra

.gitlab-ci.yml mirrors ago's two-stage pattern:
  - test stage on every push (venv + pip install -e .[dev] + pytest)
  - pypi-twine stage only on tags: python -m build, twine check,
    twine upload. Credentials come from GitLab CI variables
    TWINE_USERNAME (typically __token__) and TWINE_PASSWORD.

Makefile gains build / dist-check / publish-test / publish targets so
the release flow is also runnable locally if a dry run is needed.

Release flow:
  1. Bump version in pyproject.toml
  2. Commit + push
  3. git tag -a vX.Y.Z -m 'release vX.Y.Z' && git push --tags
  4. CI's pypi-twine stage picks up the tag and uploads

README.md adds an Install section + Quick start (plain dist + TLS dist)
so PyPI's project page shows usable copy on first visit. dist/ artifacts
build cleanly and both pass twine check.
2026-06-16 13:45:08 -04:00

43 lines
1.4 KiB
YAML

stages:
- test
- pypi-twine
# ---------------------------------------------------------------------------
# Tests run on every push to any branch.
#
# Live-integration tests need EPMD on the runner — ``make all`` skips
# them automatically when EPMD isn't reachable. CI runners typically
# don't run EPMD, so we get unit-level coverage in CI and full
# integration coverage on the dev machine.
# ---------------------------------------------------------------------------
test:
stage: test
tags: ["build"]
script:
- python3 -m venv .venv
- . .venv/bin/activate
- pip install --upgrade pip wheel
- pip install -e ".[dev]"
- pytest -v
# ---------------------------------------------------------------------------
# Ship to PyPI on tag pushes.
#
# Tag the commit (``git tag -a v0.0.1 -m 'release'`` then
# ``git push --tags``) and CI builds sdist + wheel and uploads with
# twine. Credentials come from GitLab CI variables ``TWINE_USERNAME``
# (typically ``__token__``) and ``TWINE_PASSWORD`` (the PyPI API token).
# ---------------------------------------------------------------------------
pypi-twine:
stage: pypi-twine
tags: ["build"]
only:
- tags
script:
- python3 -m venv .venv
- . .venv/bin/activate
- pip install --upgrade pip
- pip install build twine
- python -m build
- twine check dist/*
- twine upload dist/*