Adds support for tox. #59
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: test | |
on: | |
push: | |
branches: [main] | |
paths-ignore: [ "docs/**", "README.md", "CHANGELOG.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "Justfile"] | |
pull_request: | |
branches: [main] | |
paths-ignore: [ "docs/**", "README.md", "CHANGELOG.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "Justfile"] | |
concurrency: | |
group: test-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
PYTHONUNBUFFERED: "1" | |
FORCE_COLOR: "1" | |
DJANGO_DEBUG: "1" | |
jobs: | |
run: | |
name: Python ${{ matrix.python-version }} ${{ matrix.django-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11", "3.12"] | |
django-version: ["5.0", "5.1"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set up Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
- name: Setup cache | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ matrix.python-version}}-${{ hashFiles('uv.lock') }} | |
restore-keys: venv-${{ runner.os }}-${{ matrix.python-version}}- | |
- name: Create venv, install dependencies | |
run: | | |
uv sync | |
source .venv/bin/activate | |
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH | |
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV | |
- name: Run tests | |
run: | | |
uv run --no-sync --with Django~="${{ matrix.django-version }}.0" -m pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/django_markov | |
uv run --no-sync --with Django~="${{ matrix.django-version }}.0" -m coverage lcov | |
- name: Submit coverage data to coveralls.io | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: "coverage.lcov" |