name: ci on: push: branches: [main] tags: ["v*"] pull_request: branches: [main] jobs: lint-type-test: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: pip - name: Install run: | python -m pip install --upgrade pip pip install -e ".[dev]" - name: Lint (ruff) run: ruff check . - name: Format check (ruff) run: ruff format --check . - name: Type check (mypy) run: mypy - name: Tests (pytest) run: pytest -v publish: needs: lint-type-test if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install build tooling run: | python -m pip install --upgrade pip pip install build twine - name: Verify tag matches pyproject version run: | tag="${GITHUB_REF##*/v}" pkg=$(python -c "import tomllib,pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])") if [ "$tag" != "$pkg" ]; then echo "::error::Tag v$tag does not match pyproject.toml version $pkg" exit 1 fi - name: Build sdist + wheel run: python -m build - name: Publish to Gitea PyPI registry env: TWINE_USERNAME: ${{ secrets.GITEA_PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.GITEA_PYPI_TOKEN }} TWINE_REPOSITORY_URL: https://gitea.kyndemo.live/api/packages/platform/pypi run: twine upload --non-interactive dist/*