Skip to content

Commit

Permalink
Migrate test runners to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagaro committed Jan 27, 2021
1 parent d54e2e4 commit 734b1e9
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 77 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
tests_python:
name: Test on Python ${{ matrix.python_version }} and Django ${{ matrix.django_version }}
runs-on: ubuntu-latest
strategy:
matrix:
django_version: [ '1.11', '2.0', '2.1', '2.2', '3.0', '3.1' ]
python_version: [ '3.4', '3.5', '3.6', '3.7', '3.8', '3.9' ]
exclude:
- django_version: '1.11'
python_version: '3.8'
- django_version: '1.11'
python_version: '3.9'

- django_version: '2.0'
python_version: '3.8'
- django_version: '2.0'
python_version: '3.9'

- django_version: '2.1'
python_version: '3.4'
- django_version: '2.1'
python_version: '3.8'
- django_version: '2.1'
python_version: '3.9'

- django_version: '2.2'
python_version: '3.4'

- django_version: '3.0'
python_version: '3.4'
- django_version: '3.0'
python_version: '3.5'

- django_version: '3.1'
python_version: '3.4'
- django_version: '3.1'
python_version: '3.5'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.django_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -U flake8 coveralls argparse
pip install -U Django~=${{ matrix.django_version }}
- name: Lint with flake8
run: |
flake8 --ignore=E501,W504 safedelete
- name: Test Django
if: matrix.django_version != '1.11'
run: |
python -m coverage run `which django-admin.py` test --settings=safedelete.tests.settings
- name: Coverage
if: ${{ success() }}
run: |
coveralls
73 changes: 0 additions & 73 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Django safedelete
=================

.. image:: https://travis-ci.org/makinacorpus/django-safedelete.png
:target: https://travis-ci.org/makinacorpus/django-safedelete
.. image:: https://github.com/makinacorpus/django-safedelete/workflows/Python%20application/badge.svg

.. image:: https://coveralls.io/repos/makinacorpus/django-safedelete/badge.png
:target: https://coveralls.io/r/makinacorpus/django-safedelete
Expand Down
2 changes: 1 addition & 1 deletion safedelete/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def queryset(self, request):
def get_queryset(self, request):
try:
queryset = self.model.all_objects.all()
except:
except Exception:
queryset = self.model._default_manager.all()

ordering = self.get_ordering(request)
Expand Down
2 changes: 1 addition & 1 deletion safedelete/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _filter_visibility(self):
)

self._safedelete_filter_applied = True

def resolve_expression(self, *args, **kwargs):
self._filter_visibility()
return super(SafeDeleteQueryset, self).resolve_expression(*args, **kwargs)
Expand Down

0 comments on commit 734b1e9

Please sign in to comment.