From 81a8c7a89eaefcc7ed1a0051be2db721608606b8 Mon Sep 17 00:00:00 2001 From: Gagaro Date: Mon, 12 Apr 2021 12:38:24 +0200 Subject: [PATCH] Added gh actions --- .github/workflows/main.yml | 62 ++++++++++++++++++++++++++++++++++++++ quicktest.py | 6 +--- tox.ini | 9 +++++- 3 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..f0ffea6 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,62 @@ +# 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: [ '2.2', '3.0', '3.1', '3.2' ] + python_version: [ '3.5', '3.6', '3.7', '3.8', '3.9' ] + exclude: + - django_version: '3.0' + python_version: '3.5' + + - django_version: '3.1' + python_version: '3.5' + + - django_version: '3.2' + python_version: '3.5' + env: + SPATIALITE_LIBRARY_PATH: 'mod_spatialite.so' + 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: | + sudo apt-get update -qq + sudo apt-get install -y libproj-dev libgeos-dev gdal-bin libgdal-dev libsqlite3-mod-spatialite + python -m pip install --upgrade pip + pip install -U flake8 coveralls argparse jsonfield + pip install -U Django~=${{ matrix.django_version }}.0 + - name: Lint with flake8 + run: | + flake8 --ignore=E501,W504 djgeojson + - name: Test + run: | + python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m coverage run ./quicktest.py djgeojson + - name: Coverage + if: ${{ success() }} + run: | + coveralls diff --git a/quicktest.py b/quicktest.py index 95bbe70..f63a99c 100644 --- a/quicktest.py +++ b/quicktest.py @@ -39,14 +39,10 @@ def run_tests(self): 'default': { 'ENGINE': 'django.contrib.gis.db.backends.spatialite', 'NAME': os.path.join(self.DIRNAME, 'database.db'), - 'USER': '', - 'PASSWORD': '', - 'HOST': '', - 'PORT': '', } }, INSTALLED_APPS=self.INSTALLED_APPS + self.apps, - SPATIALITE_LIBRARY_PATH='mod_spatialite', + SPATIALITE_LIBRARY_PATH=os.getenv('SPATIALITE_LIBRARY_PATH', 'mod_spatialite'), TEMPLATES=[ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', diff --git a/tox.ini b/tox.ini index 51098e2..6819613 100644 --- a/tox.ini +++ b/tox.ini @@ -5,10 +5,17 @@ [tox] envlist = - py35-django{22} py36-django{22,30,31} py37-django{22,30,31} py38-django{22,30,31} + py39-django{30,31} + +[gh-actions] +python = + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 [testenv] commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning -W ignore:::site -W ignore:::distutils quicktest.py djgeojson