diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..1aebc39 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,4 @@ +[run] +source = fluentcms_contactform/ +omit = + */migrations/* diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..f0354b5 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,62 @@ +name: CI Testing +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + test: + name: "Python ${{ matrix.python }} Django ${{ matrix.django }}" + runs-on: ubuntu-latest + strategy: + # max-parallel: 8 # default is max available + fail-fast: false + matrix: + include: + # Django 2.2 + - django: "2.2" + python: "3.6" + # Django 3.1 + - django: "3.1" + python: "3.6" + # Django 3.2 + - django: "3.2" + python: "3.6" + # Django 4.0 + - django: "4.0b1" + python: "3.10" + + steps: + - name: Install gettext + run: sudo apt-get install -y gettext + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + + # Way more efficient then caching pip + - name: Cache Python site-packages + uses: actions/cache@v2 + with: + path: ${{ env.pythonLocation }} + key: ${{ env.pythonLocation }}-${{ matrix.django }}-${{ hashFiles('setup.py') }} + + # Using eager strategy to avoid reusing older packages from cache + - name: Install Packages + run: | + python -m pip install -U pip + python -m pip install -U --upgrade-strategy=eager "Django~=${{ matrix.django }}" codecov -e .[tests] + + - name: Run Tests + run: | + echo "Python ${{ matrix.python }} / Django ${{ matrix.django }}" + coverage run --rcfile=.coveragerc runtests.py + codecov + continue-on-error: ${{ contains(matrix.django, '4.0') }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 39340f9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: python -sudo: false -cache: pip -python: -- '3.6' -- '3.4' -- '2.7' -env: -- PACKAGES="django>=1.10,<1.11 django-polymorphic<2.0" -- PACKAGES="django>=1.11,<1.12" -- PACKAGES="django>=2.0,<2.1" -matrix: - exclude: - - python: '2.7' - env: PACKAGES="django>=2.0,<2.1" -before_install: -- pip install codecov -install: -- pip install $PACKAGES -e .[tests] -script: -- coverage run --source=fluentcms_contactform runtests.py -after_success: -- codecov -branches: - only: - - master -notifications: - email: - recipients: - - travis@edoburu.nl - on_success: never - on_failure: always - slack: - secure: WWNa4MHf50AOybB+XW9UKXCk/9Q8r++Jc4xTdEib43rj4odH9wxIaTRrzAbbpo3EO2gYuLgq6mMbaIZPD5l2UmgSnyuIbeYAAKIQblT+8XMamtXwnSS5j9vfBXYdj54rTlh+jKwEMW/JiQKl+SQpfQ2v1NMvYO63m89Ev9vXvcU= - on_success: never - on_failure: always diff --git a/README.rst b/README.rst index f78c89d..548c567 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,8 @@ -.. image:: https://img.shields.io/travis/django-fluent/fluentcms-contactform/master.svg?branch=master - :target: http://travis-ci.org/django-fluent/fluentcms-contactform +fluentcms-contactform +===================== + +.. image:: https://github.com/django-fluent/fluentcms-contactform/actions/workflows/tests.yaml/badge.svg?branch=master + :target: https://github.com/django-fluent/fluentcms-contactform/actions/workflows/tests.yaml .. image:: https://img.shields.io/pypi/v/fluentcms-contactform.svg :target: https://pypi.python.org/pypi/fluentcms-contactform/ .. image:: https://img.shields.io/pypi/l/fluentcms-contactform.svg @@ -7,8 +10,6 @@ .. image:: https://img.shields.io/codecov/c/github/django-fluent/fluentcms-contactform/master.svg :target: https://codecov.io/github/django-fluent/fluentcms-contactform?branch=master -fluentcms-contactform -===================== A plugin for django-fluent-contents_ to show a simple contact form. diff --git a/runtests.py b/runtests.py index 025a07f..5b9b4b6 100755 --- a/runtests.py +++ b/runtests.py @@ -25,11 +25,12 @@ }, SITE_ID=1, INSTALLED_APPS=( + "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", - "django.contrib.sites", - "django.contrib.admin", "django.contrib.messages", + "django.contrib.sessions", + "django.contrib.sites", "crispy_forms", "fluent_contents", "fluent_contents.tests.testapp", @@ -51,16 +52,24 @@ "django.template.context_processors.request", "django.template.context_processors.static", "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", ), }, }, ], - MIDDLEWARE_CLASSES=(), - FLUENT_CONTENTS_CACHE_OUTPUT=False, - TEST_RUNNER="django.test.runner.DiscoverRunner", + MIDDLEWARE=( + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + ), + DEFAULT_AUTO_FIELD="django.db.models.BigAutoField", + SECRET_KEY="testtest", + STATIC_URL="/static/", ROOT_URLCONF="fluentcms_contactform.tests.urls", + TEST_RUNNER="django.test.runner.DiscoverRunner", + # third party: + FLUENT_CONTENTS_CACHE_OUTPUT=False, CRISPY_TEMPLATE_PACK="bootstrap3", - STATIC_URL="/static/", ) DEFAULT_TEST_APPS = [ diff --git a/tox.ini b/tox.ini index 994bdc3..ee94ad5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,28 +1,26 @@ [tox] envlist= - py27-django{110,111}, - py34-django{110,111}, - py36-django{111,20}, - # py33-django-dev, - coverage, - docs, + py36-django{22,31,32}, + coverage [testenv] deps = - django110: Django >= 1.10,<1.11 - django110: django-polymorphic<2.0 - django111: Django >= 1.11,<2.0 - django20: Django >= 2.0,<2.1 - django-dev: https://github.com/django/django/tarball/master + django22: Django ~= 2.2 + django31: Django ~= 3.1 + django32: Django ~= 3.2 + django-dev: https://github.com/django/django/tarball/main + phonenumberslite + django-crispy-forms commands= python runtests.py [testenv:coverage] -basepython=python3.3 +basepython=python3.8 deps= - django==1.9.4 + django coverage + phonenumberslite commands= coverage erase - coverage run --source=fluentcms_contactform runtests.py + coverage run --rcfile=.coveragerc runtests.py coverage report