Skip to content

Merge branch 'hotfix/update-setup-uv' #113

Merge branch 'hotfix/update-setup-uv'

Merge branch 'hotfix/update-setup-uv' #113

on:
push:
branches: [master, develop]
tags:
- '*'
pull_request:
workflow_dispatch:
name: Tests
env:
PYTHONWARNINGS: all
TERM: xterm-256color
jobs:
pre-commit:
name: Various quality checks with pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.MAIN_PYTHON }}
- uses: pre-commit/[email protected]
env:
SKIP: "mypy,ruff"
ruff:
name: Lint with ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ vars.UV_VERSION }}
enable-cache: true
- name: Set up Python
run: uv python install ${{ vars.MAIN_PYTHON }}
- name: Ruff Lint
run: uv run ruff check .
- name: Ruff Format
run: uv run ruff format .
mypy:
name: Type check with mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ vars.UV_VERSION }}
enable-cache: true
- name: Set up Python
run: uv python install ${{ vars.MAIN_PYTHON }}
- run: uv run mypy .
initial-test:
name: Test One Version First
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ vars.UV_VERSION }}
enable-cache: true
- name: Set up Python
run: uv python install ${{ vars.MAIN_PYTHON }}
- name: Install the project
run: uv sync --all-extras --dev
- run: uv run pytest
name: Run tests
- run: uv run coverage lcov
name: Generate coverage report for this run
- name: Upload coverage report for this run to coveralls
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: .cov/coverage.lcov
parallel: true
test:
name: Pytest via uv
needs:
- pre-commit
- ruff
- mypy
- initial-test
strategy:
matrix:
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8", "pypy3.10", "3.13.0-rc.1", "3.14.0-alpha.0"]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: ubuntu-latest
python-version: ${{ vars.MAIN_PYTHON }}
#we already did this one
continue-on-error: ${{ contains(matrix.python-version,'3.13') || contains(matrix.python-version,'3.14') || (contains(matrix.python-version, 'pypy') && matrix.os == 'windows-latest')}}
runs-on: ${{ matrix.os }}
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ vars.UV_VERSION }}
enable-cache: true
- name: Set up Python
if: ${{ ! (contains(matrix.python-version,'3.13') || contains(matrix.python-version,'3.14')) }}
run: uv python install ${{ matrix.python-version }}
- uses: actions/setup-python@v5
if: ${{ (contains(matrix.python-version,'3.13') || contains(matrix.python-version,'3.14')) }}
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
run: uv sync --all-extras --dev
- run: uv run pytest
name: Run tests
- run: uv run coverage lcov
name: Generate coverage report for this run
- name: Upload coverage report for this run to coveralls
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: .cov/coverage.lcov
parallel: true
coveralls:
name: Finalize coveralls data
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@main
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: .cov/coverage.lcov
parallel-finished: true
results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Status of final test results
needs: [test]
steps:
- run: |
result="${{ needs.test.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi
build-and-publish:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
permissions:
id-token: write
needs:
- pre-commit
- ruff
- mypy
- test
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ vars.UV_VERSION }}
enable-cache: true
- name: Build package
run: uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1