Skip to content

Merge pull request #59 from GitRon/refactor/removed-mock-try-excepts-… #129

Merge pull request #59 from GitRon/refactor/removed-mock-try-excepts-…

Merge pull request #59 from GitRon/refactor/removed-mock-try-excepts-… #129

Workflow file for this run

name: Build
on:
- push
- pull_request
env:
GITHUB_WORKFLOW: true
jobs:
flake8:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install required packages
run: pip install flake8 pep8-naming
- name: Run flake8
run: flake8
test:
name: Test and coverage
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
django:
- "4.2"
- "5.0"
- "5.1"
database:
- sqlite
- mysql
- postgres
exclude:
- python-version: "3.8"
django: "5.0"
- python-version: "3.9"
django: "5.0"
- python-version: "3.8"
django: "5.1"
- python-version: "3.9"
django: "5.1"
services:
# postgres service
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=5
# mysql service
mysql:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install Django 4.2
if: matrix.django == 4.2
run: pip install "Django>=4.2,<5.0"
- name: Install Django 5.0
if: matrix.django == 5.0
run: pip install "Django>=5.0,<5.1"
- name: Install Django 5.1
if: matrix.django == 5.1
run: pip install "Django>=5.1,<5.2"
- name: Install MySQL libs
if: matrix.database == 'mysql'
run: pip install mysqlclient>=2.2.4 django-mysql>=4.14.0
- name: Install postgres libs
if: matrix.database == 'postgres'
run: pip install psycopg==3.1.19
- name: Install requirements
run: pip install -r requirements.txt
- name: Install package
run: pip install -e .
- name: Run tests and coverage
run: coverage run --source=django_scrubber manage.py test
env:
DATABASE_ENGINE: ${{ matrix.database }}
- name: Publish coverage
if: |
github.repository == 'RegioHelden/django-scrubber'
&&
(
github.event_name == 'push'
||
(
github.event_name == 'pull_request'
&&
github.head_ref == 'master'
)
)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: coveralls
publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install deployment packages
run: python -m pip install -U setuptools wheel
- name: Build a binary wheel and a source tarball
run: python setup.py sdist bdist_wheel
- name: Publish Package on PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}