diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 0000000..6fe3e73 --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,41 @@ +name: Python package + +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['2.7', '3.6', '3.7', '3.8', '3.9', '3.10'] + + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install psycopg2 prerequisites + run: sudo apt-get install libpq-dev + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r requirements-test.txt + pip install tox tox-gh-actions + - name: Test with tox + run: tox diff --git a/README.md b/README.md index b595831..ba55785 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![](https://badges.pufler.dev/visits/fabiocaccamo/django-admin-interface?label=visitors&color=blue)](https://badges.pufler.dev) [![](https://img.shields.io/pypi/l/django-admin-interface.svg?color=blue)](https://github.com/fabiocaccamo/django-admin-interface/blob/master/LICENSE.txt) -[![](https://img.shields.io/travis/fabiocaccamo/django-admin-interface?logo=travis&label=build)](https://travis-ci.org/fabiocaccamo/django-admin-interface) +[![](https://img.shields.io/github/workflow/status/fabiocaccamo/django-admin-interface/Python%20package?label=build&logo=github)](https://github.com/fabiocaccamo/django-admin-interface) [![](https://img.shields.io/codecov/c/gh/fabiocaccamo/django-admin-interface?logo=codecov)](https://codecov.io/gh/fabiocaccamo/django-admin-interface) [![](https://img.shields.io/codacy/grade/21cb657283c04e70b56fb935277a1ad1?logo=codacy)](https://www.codacy.com/app/fabiocaccamo/django-admin-interface) [![](https://img.shields.io/codeclimate/maintainability/fabiocaccamo/django-admin-interface?logo=code-climate)](https://codeclimate.com/github/fabiocaccamo/django-admin-interface/) @@ -152,6 +152,7 @@ git clone https://github.com/fabiocaccamo/django-admin-interface.git src && cd s # install dependencies pip install -r requirements.txt +pip install -r requirements-test.txt # run tests tox @@ -176,8 +177,6 @@ If you are using this package in commercial project(s), please consider the idea - [GitHub Sponsor](https://github.com/sponsors/fabiocaccamo) - [PayPal](https://www.paypal.me/fabiocaccamo) -- BTC: bc1q2t0pv8z3udpyuvfnx5kskhqdad4dcvtfuzmvjw -- ETH: 0x8B55Fb7798b5A9F797A4455C00821B6e53daca74 ## See also diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..c138fc7 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,4 @@ +codecov +coverage +psycopg2 +tox diff --git a/requirements.txt b/requirements.txt index ade42a1..47d2349 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,5 @@ -codecov -coverage django>=1.7 django-colorfield django-flat-theme django-flat-responsive six>=1.9.0 -tox \ No newline at end of file diff --git a/setup.py b/setup.py index 7d2f91d..5d70d28 100644 --- a/setup.py +++ b/setup.py @@ -69,6 +69,7 @@ setup( 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Topic :: Software Development :: Build Tools', ], license='MIT', diff --git a/tests/settings.py b/tests/settings.py index e4e6ad4..03ffb26 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -89,6 +89,12 @@ database_config = { } } +github_workflow = os.environ.get('GITHUB_WORKFLOW') +if github_workflow: + database_config['postgres']['NAME'] = 'postgres' + database_config['postgres']['HOST'] = '127.0.0.1' + database_config['postgres']['PORT'] = '5432' + DATABASES = { 'default': database_config.get(database_engine), } diff --git a/tox.ini b/tox.ini index 9bd4384..f262841 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,23 @@ [tox] envlist = py27-{dj17,dj18,dj19,dj110,dj111}-{sqlite,postgres}, - py35-{dj18,dj19,dj110,dj111,dj20,dj21,dj22}-{sqlite,postgres}, - py36-{dj18,dj19,dj110,dj111,dj20,dj21,dj22,dj30,dj31,dj32,djmaster}-{sqlite,postgres}, - py37-{dj20,dj21,dj22,dj30,dj31,dj32,djmaster}-{sqlite,postgres}, - py38-{dj22,dj30,dj31,dj32,djmaster}-{sqlite,postgres}, - py39-{dj22,dj30,dj31,dj32,djmaster}-{sqlite,postgres}, + py36-{dj18,dj19,dj110,dj111,dj20,dj21,dj22,dj30,dj31,dj32}-{sqlite,postgres}, + py37-{dj20,dj21,dj22,dj30,dj31,dj32}-{sqlite,postgres}, + py38-{dj22,dj30,dj31,dj32}-{sqlite,postgres}, + py39-{dj22,dj30,dj31,dj32}-{sqlite,postgres}, + py310-{dj32}-{sqlite,postgres}, + +[gh-actions] +python = + 2.7: py27 + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 + 3.10: py310 + [testenv] -passenv = CI TRAVIS TRAVIS_* +passenv = CI GITHUB_WORKFLOW deps = dj17: Django == 1.7.* dj18: Django == 1.8.* @@ -20,7 +30,6 @@ deps = dj30: Django == 3.0.* dj31: Django == 3.1.* dj32: Django == 3.2.* - djmaster: https://github.com/django/django/archive/master.tar.gz # mysql: mysqlclient postgres: psycopg2-binary coverage