add gitHub actions workflow for pypi publishing #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests and upload coverage | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
name: Python ${{ matrix.python-version }} | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
django-version: ['<4.2', '<5.0', '<5.1'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-dependency-glob: tests/requirements/*.txt | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: uv pip install --system -e .[all,dev,test] | |
- name: Install Django | |
run: uv pip install --system "Django${{ matrix.django-version }}" | |
- name: Install Hatch project manager | |
run: uv pip install --system hatch | |
- name: Run tests | |
run: hatch run test:pytest-cov | |
- name: Upload results to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |