Publish TPV to PyPI
.github/workflows/deploy.yaml (opens in new tab)Triggers
release push
Jobs
| Job | Runs on | Steps | Actions used |
|---|---|---|---|
| Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI | ubuntu-latest | 5 | actions/checkout@v4 actions/setup-python@v5 astral-sh/setup-uv@v5 pypa/gh-action-pypi-publish@release/v1 |
Raw YAML
name: Publish TPV to PyPI
on:
release:
types: [published]
push:
tags:
- '*'
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Create and check packages
run: |
python3 setup.py sdist bdist_wheel
uvx twine check dist/*
ls -l dist
- name: Publish distribution 📦 to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
Last fetched:
Triggers
push pull_request
Jobs
| Job | Runs on | Steps | Actions used |
|---|---|---|---|
| lint code | ubuntu-latest | 6 | actions/checkout@v3 actions/setup-python@v5 astral-sh/setup-uv@v5 actions/cache@v4 actions/cache@v4 |
| mypy type checks | ubuntu-latest | 6 | actions/checkout@v3 actions/setup-python@v5 astral-sh/setup-uv@v5 actions/cache@v4 actions/cache@v4 |
| tox tests | ubuntu-latest | 7 | actions/checkout@v3 actions/setup-python@v5 astral-sh/setup-uv@v5 actions/cache@v4 actions/cache@v4 AndreMiras/coveralls-python-action@develop |
Raw YAML
name: tests
# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
lint:
name: lint code
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Cache uv dir
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: uv-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/setup.py', '**/requirements.txt', '**/requirements_test.txt', '**/tox.ini') }}-lint
- name: Cache tox dir
uses: actions/cache@v4
with:
path: .tox
key: tox-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/setup.py', '**/requirements.txt', '**/requirements_test.txt', '**/tox.ini') }}-lint
- name: Run tox
run: uvx --with tox-uv tox -e lint
mypy:
# Name the Job
name: mypy type checks
# Set the type of machine to run on
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Cache uv dir
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: uv-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/setup.py', '**/requirements.txt', '**/requirements_test.txt', '**/tox.ini') }}-py310
- name: Cache tox dir
uses: actions/cache@v4
with:
path: .tox
key: tox-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/setup.py', '**/requirements.txt', '**/requirements_test.txt', '**/tox.ini') }}-py310
- name: Run tox
run: uvx --with tox-uv tox -e mypy
py310:
# Name the Job
name: tox tests
needs: [lint, mypy]
# Set the type of machine to run on
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Cache uv dir
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: uv-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/setup.py', '**/requirements.txt', '**/requirements_test.txt', '**/tox.ini') }}-py310
- name: Cache tox dir
uses: actions/cache@v4
with:
path: .tox
key: tox-cache-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/setup.py', '**/requirements.txt', '**/requirements_test.txt', '**/tox.ini') }}-py310
- name: Run tox
run: uvx --with tox-uv tox -e py${{ matrix.python-version }}
env:
PYTHONUNBUFFERED: "True"
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.python-version }}
Last fetched: