Skip to content

Commit a997efa

Browse files
committed
Replace Travis with GitHub Actions, update test matrix
1 parent 68b2c63 commit a997efa

File tree

5 files changed

+94
-112
lines changed

5 files changed

+94
-112
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
source = capture_tag/

.github/workflows/tests.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI Testing
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
test:
12+
name: "Python ${{ matrix.python }} Django ${{ matrix.django }}"
13+
runs-on: ubuntu-latest
14+
strategy:
15+
# max-parallel: 8 # default is max available
16+
fail-fast: false
17+
matrix:
18+
include:
19+
# Django 2.2
20+
- django: "2.2"
21+
python: "3.6"
22+
# Django 3.1
23+
- django: "3.1"
24+
python: "3.6"
25+
# Django 3.2
26+
- django: "3.2"
27+
python: "3.6"
28+
# Django 4.0
29+
- django: "4.0b1"
30+
python: "3.10"
31+
32+
steps:
33+
- name: Install gettext
34+
run: sudo apt-get install -y gettext
35+
36+
- name: Checkout code
37+
uses: actions/checkout@v2
38+
39+
- name: Setup Python ${{ matrix.python }}
40+
uses: actions/setup-python@v2
41+
with:
42+
python-version: ${{ matrix.python }}
43+
44+
- name: Install Packages
45+
run: |
46+
python -m pip install -U pip
47+
python -m pip install "Django~=${{ matrix.django }}" codecov -e .[tests]
48+
49+
- name: Run Tests
50+
run: |
51+
echo "Python ${{ matrix.python }} / Django ${{ matrix.django }}"
52+
coverage run --rcfile=.coveragerc runtests.py
53+
codecov
54+
continue-on-error: ${{ contains(matrix.django, '4.0') }}

.travis.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
django-capture-tag
22
==================
33

4-
.. image:: https://img.shields.io/travis/edoburu/django-capture-tag/master.svg?branch=master
5-
:target: http://travis-ci.org/edoburu/django-capture-tag
4+
.. image:: https://github.com/edoburu/django-capture-tag/actions/workflows/tests.yaml/badge.svg?branch=master
5+
:target: https://github.com/edoburu/django-capture-tag/actions/workflows/tests.yaml
66
.. image:: https://img.shields.io/pypi/v/django-capture-tag.svg
77
:target: https://pypi.python.org/pypi/django-capture-tag/
88
.. image:: https://img.shields.io/pypi/l/django-capture-tag.svg

runtests.py

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,52 @@
11
#!/usr/bin/env python
22
import sys
3+
34
import django
4-
from django.conf import settings, global_settings as default_settings
5+
from django.conf import settings
56
from django.core.management import execute_from_command_line
6-
from os import path
77

88
if not settings.configured:
9-
module_root = path.dirname(path.realpath(__file__))
10-
11-
sys.path.insert(0, path.join(module_root, 'example'))
12-
13-
if django.VERSION >= (1, 8):
14-
template_settings = dict(
15-
TEMPLATES = [
16-
{
17-
'BACKEND': 'django.template.backends.django.DjangoTemplates',
18-
'DIRS': (),
19-
'OPTIONS': {
20-
'loaders': (
21-
'django.template.loaders.filesystem.Loader',
22-
'django.template.loaders.app_directories.Loader',
23-
),
24-
'context_processors': (
25-
'django.template.context_processors.debug',
26-
'django.template.context_processors.i18n',
27-
'django.template.context_processors.media',
28-
'django.template.context_processors.request',
29-
'django.template.context_processors.static',
30-
'django.contrib.auth.context_processors.auth',
31-
),
32-
},
33-
},
34-
]
35-
)
36-
else:
37-
template_settings = dict(
38-
TEMPLATE_LOADERS = (
39-
'django.template.loaders.app_directories.Loader',
40-
'django.template.loaders.filesystem.Loader',
41-
),
42-
TEMPLATE_CONTEXT_PROCESSORS = list(default_settings.TEMPLATE_CONTEXT_PROCESSORS) + [
43-
'django.core.context_processors.request',
44-
],
45-
)
46-
479
settings.configure(
48-
DEBUG = False, # will be False anyway by DjangoTestRunner.
49-
TEMPLATE_DEBUG = True,
50-
DATABASES = {
51-
'default': {
52-
'ENGINE': 'django.db.backends.sqlite3',
53-
'NAME': ':memory:'
54-
}
10+
DATABASES={
11+
"default": {
12+
"ENGINE": "django.db.backends.sqlite3",
13+
"NAME": ":memory:",
14+
},
5515
},
56-
INSTALLED_APPS = (
57-
'capture_tag',
16+
SITE_ID=1,
17+
INSTALLED_APPS=(
18+
"capture_tag",
5819
),
59-
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner' if django.VERSION < (1, 6) else 'django.test.runner.DiscoverRunner',
60-
**template_settings
20+
MIDDLEWARE=(),
21+
TEMPLATES=[
22+
{
23+
"BACKEND": "django.template.backends.django.DjangoTemplates",
24+
"DIRS": (),
25+
"OPTIONS": {
26+
"loaders": (
27+
"django.template.loaders.filesystem.Loader",
28+
),
29+
"context_processors": (),
30+
},
31+
},
32+
],
33+
TEST_RUNNER="django.test.runner.DiscoverRunner",
34+
DEFAULT_AUTO_FIELD="django.db.models.BigAutoField",
6135
)
6236

37+
DEFAULT_TEST_APPS = [
38+
"capture_tag",
39+
]
40+
6341

6442
def runtests():
65-
argv = sys.argv[:1] + ['test', 'capture_tag'] + sys.argv[1:]
43+
other_args = list(filter(lambda arg: arg.startswith("-"), sys.argv[1:]))
44+
test_apps = (
45+
list(filter(lambda arg: not arg.startswith("-"), sys.argv[1:])) or DEFAULT_TEST_APPS
46+
)
47+
argv = sys.argv[:1] + ["test", "--traceback"] + other_args + test_apps
6648
execute_from_command_line(argv)
6749

68-
if __name__ == '__main__':
50+
51+
if __name__ == "__main__":
6952
runtests()

0 commit comments

Comments
 (0)