diff --git a/.github/workflows/django-package.yml b/.github/workflows/django-package.yml index 03e23821..40e9a667 100644 --- a/.github/workflows/django-package.yml +++ b/.github/workflows/django-package.yml @@ -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 diff --git a/README.rst b/README.rst index 8d5e47cd..3f12b2ba 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/testproject/requirements_test.txt b/testproject/requirements_test.txt new file mode 100644 index 00000000..7914c65f --- /dev/null +++ b/testproject/requirements_test.txt @@ -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