Skip to content

Commit

Permalink
Migrate Travis to GitHub actions, update test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
vdboor committed Nov 16, 2021
1 parent 7290b75 commit 8b74a78
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 60 deletions.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
source = fluentcms_contactform/
omit =
*/migrations/*
62 changes: 62 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -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') }}
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

9 changes: 5 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
.. 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
:target: https://pypi.python.org/pypi/fluentcms-contactform/
.. 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.

Expand Down
21 changes: 15 additions & 6 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [
Expand Down
26 changes: 12 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8b74a78

Please sign in to comment.