Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#180 test the compatibility of the package #188

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 244 additions & 39 deletions .github/workflows/django-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,250 @@ jobs:
DJANGO_SETTINGS_MODULE: settings
SECRET_KEY: this_is_no_secret_at_all
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
include:
- python-version: 3.7
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.10

- python-version: 3.7
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.11

- python-version: 3.7
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.12

- python-version: 3.7
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.13

- python-version: 3.7
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.11

- python-version: 3.7
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.12

- python-version: 3.7
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.13

- python-version: 3.7
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.14

- python-version: 3.7
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.11

- python-version: 3.7
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.12

- python-version: 3.7
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.13

- python-version: 3.7
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.14

- python-version: 3.8
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.10

- python-version: 3.8
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.11

- python-version: 3.8
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.12

- python-version: 3.8
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.13

- python-version: 3.8
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.11

- python-version: 3.8
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.12

- python-version: 3.8
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.13

- python-version: 3.8
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.14

- python-version: 3.8
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.11

- python-version: 3.8
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.12

- python-version: 3.8
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.13

- python-version: 3.8
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.14

- python-version: 3.8
django-version: Django==4.0
djangorestframework-version: djangorestframework==3.11

- python-version: 3.8
django-version: Django==4.0
djangorestframework-version: djangorestframework==3.12

- python-version: 3.8
django-version: Django==4.0
djangorestframework-version: djangorestframework==3.13

- python-version: 3.8
django-version: Django==4.0
djangorestframework-version: djangorestframework==3.14

- python-version: 3.8
django-version: Django==4.1
djangorestframework-version: djangorestframework==3.11

- python-version: 3.8
django-version: Django==4.1
djangorestframework-version: djangorestframework==3.12

- python-version: 3.8
django-version: Django==4.1
djangorestframework-version: djangorestframework==3.13

- python-version: 3.8
django-version: Django==4.1
djangorestframework-version: djangorestframework==3.14

- python-version: 3.9
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.11

- python-version: 3.9
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.12

- python-version: 3.9
django-version: Django==2.2
djangorestframework-version: djangorestframework==3.13

- python-version: 3.9
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.11

- python-version: 3.9
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.12

- python-version: 3.9
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.13

- python-version: 3.9
django-version: Django==3.1
djangorestframework-version: djangorestframework==3.14

- python-version: 3.9
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.11

- python-version: 3.9
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.12

- python-version: 3.9
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.13

- python-version: 3.9
django-version: Django==3.2
djangorestframework-version: djangorestframework==3.14

- python-version: 3.9
django-version: Django==4.0
djangorestframework-version: djangorestframework==3.11

- python-version: 3.9
django-version: Django==4.0
djangorestframework-version: djangorestframework==3.12

- python-version: 3.9
django-version: Django==4.0
djangorestframework-version: djangorestframework==3.13

- python-version: 3.9
django-version: Django==4.0
djangorestframework-version: djangorestframework==3.14

- python-version: 3.9
django-version: Django==4.1
djangorestframework-version: djangorestframework==3.11

- python-version: 3.9
django-version: Django==4.1
djangorestframework-version: djangorestframework==3.12

- python-version: 3.9
django-version: Django==4.1
djangorestframework-version: djangorestframework==3.13

- python-version: 3.9
django-version: Django==4.1
djangorestframework-version: djangorestframework==3.14

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install mypy flake8 pytest pytest-xdist flaky
if [ -f testproject/requirements.txt ]; then pip install -r testproject/requirements.txt; fi
ln -s $(pwd)/trench/ $(pwd)/testproject/trench
- name: Lint trench package with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names.
flake8 ./trench/ --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide.
flake8 ./trench/ --count --exit-zero --max-complexity=10 --statistics
- name: Check trench package's type hints with mypy
run: |
mypy ./trench/
- name: Lint testproject with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names.
flake8 ./testproject/ --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide.
flake8 ./testproject/ --count --exit-zero --max-complexity=10 --statistics
- name: Check testproject's type hints with mypy
run: |
mypy ./testproject/
- name: Test with pytest
run: |
python -m pytest -n 8 --cov-report=xml --cov=testproject/trench testproject/tests/
- uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
fail_ci_if_error: true
name: trench
verbose: true
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install mypy flake8 pytest pytest-xdist flaky
python -m pip install ${{ matrix.django-version }} ${{ matrix.djangorestframework-version }}
if [ -f testproject/requirements_test.txt ]; then pip install -r testproject/requirements_test.txt; fi
ln -s $(pwd)/trench/ $(pwd)/testproject/trench
- name: Lint trench package with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names.
flake8 ./trench/ --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide.
flake8 ./trench/ --count --exit-zero --max-complexity=10 --statistics
- name: Check trench package's type hints with mypy
run: |
mypy ./trench/
- name: Lint testproject with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names.
flake8 ./testproject/ --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide.
flake8 ./testproject/ --count --exit-zero --max-complexity=10 --statistics
- name: Check testproject's type hints with mypy
run: |
mypy ./testproject/
- name: Test with pytest
run: |
python -m pytest -n 8 --cov-report=xml --cov=testproject/trench testproject/tests/
- uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
fail_ci_if_error: true
name: trench
verbose: true
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,9 @@ the package (steps 6-7) for the changes to be present during e.g. running the te
.. code-block:: shell

pytest -n 8 --cov=testproject/trench testproject/tests/

9. [OPTIONAL] Check GitHub workflows locally (https://github.com/nektos/act):

.. code-block:: shell

act --container-architecture linux/amd64
20 changes: 20 additions & 0 deletions testproject/requirements_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
django-environ==0.4.5
django-cors-headers==3.7.0
djangorestframework-simplejwt>=4.8.0
pyotp>=2.6.0
twilio>=7.0.0
yubico-client>=1.13.0
smsapi-client>=2.4.5
pyjwt<=2.0.1

drf-spectacular==0.22.1

pytest==6.2.3
pytest-cov==2.11.1
pytest-django==4.1.0
attrs==20.3.0
coverage==5.5
flaky==3.7.0

isort
flake8