Skip to content

Commit b0aa174

Browse files
authored
Move the test suite to GitHub Actions (django-es#363)
* Move the test suite to GitHub Actions * Fix brken test * Update ci step name * Change elasticsearch-dsl version * Remove unused dependency * Remove Configure Sysctl Limits block
1 parent 759076b commit b0aa174

File tree

6 files changed

+85
-76
lines changed

6 files changed

+85
-76
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
fail-fast: false
14+
15+
matrix:
16+
python-version: ["2.7", "3.6", "3.7", "3.8"]
17+
django-version: ["1.11", "2.0", "2.2", "2.1", "3.0"]
18+
es-dsl-version: ["6.4", "7.4"]
19+
es-version: ["7.13.4"]
20+
21+
exclude:
22+
- python-version: "2.7"
23+
django-version: "2.0"
24+
- python-version: "2.7"
25+
django-version: "2.1"
26+
- python-version: "2.7"
27+
django-version: "2.2"
28+
- python-version: "2.7"
29+
django-version: "3.0"
30+
31+
- python-version: "3.8"
32+
django-version: "1.11"
33+
- python-version: "3.8"
34+
django-version: "2.0"
35+
- python-version: "3.8"
36+
django-version: "2.1"
37+
38+
steps:
39+
- name: Install and Run Elasticsearch
40+
uses: elastic/elastic-github-actions/elasticsearch@master
41+
with:
42+
stack-version: ${{ matrix.es-version }}
43+
44+
- uses: actions/checkout@v2
45+
46+
- name: Install Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v2
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: Cache Pip Dependencies
52+
uses: actions/cache@v2
53+
with:
54+
path: ~/.cache/pip
55+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements_test.txt') }}
56+
restore-keys: |
57+
${{ runner.os }}-pip-
58+
59+
- name: Install Dependencies
60+
run: |
61+
python -m pip install --upgrade pip
62+
python -m pip install "Django==${{ matrix.django-version }}"
63+
python -m pip install "elasticsearch-dsl==${{ matrix.es-dsl-version }}"
64+
python -m pip install -r requirements_test.txt
65+
66+
- name: Run tests with Python ${{ matrix.python-version }} and Django ${{ matrix.django-version }} and elasticsearch-dsl-py ${{ matrix.es-dsl-version }}
67+
run: |
68+
TOX_ENV=$(echo "py${{ matrix.python-version }}-django-${{ matrix.django-version }}-es${{ matrix.es-dsl-version }}" | tr -d .)
69+
python -m tox -e $TOX_ENV -- --elasticsearch
70+
71+
- name: Publish Coverage Report
72+
uses: codecov/codecov-action@v1

.travis.yml

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

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ Before you submit a pull request, check that it meets these guidelines:
101101
your new functionality into a function with a docstring, and add the
102102
feature to the list in README.rst.
103103
3. The pull request should work for Python 2.7, and 3.4, and for PyPy. Check
104-
https://travis-ci.org/sabricot/django-elasticsearch-dsl/pull_requests
104+
https://github.com/django-es/django-elasticsearch-dsl/actions
105105
and make sure that the tests pass for all supported Python versions.
106106

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
Django Elasticsearch DSL
33
========================
44

5-
.. image:: https://travis-ci.org/sabricot/django-elasticsearch-dsl.png?branch=master
6-
:target: https://travis-ci.org/sabricot/django-elasticsearch-dsl
7-
.. image:: https://codecov.io/gh/sabricot/django-elasticsearch-dsl/coverage.svg?branch=master
8-
:target: https://codecov.io/gh/sabricot/django-elasticsearch-dsl
5+
.. image:: https://github.com/django-es/django-elasticsearch-dsl/actions/workflows/ci.yml/badge.svg
6+
:target: https://github.com/django-es/django-elasticsearch-dsl/actions/workflows/ci.yml
7+
.. image:: https://codecov.io/gh/django-es/django-elasticsearch-dsl/coverage.svg?branch=master
8+
:target: https://codecov.io/gh/django-es/django-elasticsearch-dsl
99
.. image:: https://badge.fury.io/py/django-elasticsearch-dsl.svg
1010
:target: https://pypi.python.org/pypi/django-elasticsearch-dsl
11-
.. image:: https://readthedocs.org/projects/pip/badge/?version=latest&style=flat
11+
.. image:: https://readthedocs.org/projects/django-elasticsearch-dsl/badge/?version=latest&style=flat
1212
:target: https://django-elasticsearch-dsl.readthedocs.io/en/latest/
1313

1414
Django Elasticsearch DSL is a package that allows indexing of django models in elasticsearch.

tests/test_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_get_value_from_instance_with_unknown_attr(self):
5050
class Dummy:
5151
attr1 = "foo"
5252

53-
field = DEDField(attr='attr2')
53+
field = DEDField(attr='attr2', required=True)
5454
self.assertRaises(
5555
VariableLookupError, field.get_value_from_instance, Dummy()
5656
)

tox.ini

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
[tox]
22
envlist =
3-
py27-django-111-es7
4-
{py36,py37,py38}-django-{111,2,21,22,30}-{es7}
3+
py27-django-111-es74
4+
{py36,py37,py38}-django-{111,20,21,22,30}-{es64,es74}
55

66
[testenv]
77
setenv =
88
PYTHONPATH = {toxinidir}:{toxinidir}/django_elasticsearch_dsl
9-
commands = python runtests.py {posargs}
10-
9+
commands = coverage run --source django_elasticsearch_dsl runtests.py {posargs}
1110

1211
deps =
1312
django-111: Django>=1.11,<2.0
14-
django-2: Django>=2.0,<2.1
13+
django-20: Django>=2.0,<2.1
1514
django-21: Django>=2.1,<2.2
1615
django-22: Django>=2.2,<2.3
1716
django-30: Django>=3.0,<3.1
18-
es6: elasticsearch-dsl>=6.4.0,<7.0.0
19-
es7: elasticsearch-dsl>=7,<8
17+
es64: elasticsearch-dsl>=6.4.0,<7.0.0
18+
es74: elasticsearch-dsl>=7.4.0,<8
2019
-r{toxinidir}/requirements_test.txt
2120

2221
basepython =

0 commit comments

Comments
 (0)