From 0814bbec1ba8b33c30ced80b891d3e6f89ee25ed Mon Sep 17 00:00:00 2001 From: Wojciech Maciejewski Date: Mon, 21 Nov 2022 11:26:54 +0100 Subject: [PATCH 1/5] #180 | Test the compatibility of the package --- .github/workflows/django-package.yml | 42 +++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/django-package.yml b/.github/workflows/django-package.yml index 03e23821..0adace87 100644 --- a/.github/workflows/django-package.yml +++ b/.github/workflows/django-package.yml @@ -11,8 +11,47 @@ 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 + + - python-version: 3.7 + django-version: Django==3.1 + + - python-version: 3.7 + django-version: Django==3.2 + + - python-version: 3.8 + django-version: Django==2.2 + + - python-version: 3.8 + django-version: Django==3.1 + + - python-version: 3.8 + django-version: Django==3.2 + + - python-version: 3.8 + django-version: Django==4.0 + + - python-version: 3.8 + django-version: Django==4.1 + + - python-version: 3.9 + django-version: Django==2.2 + + - python-version: 3.9 + django-version: Django==3.1 + + - python-version: 3.9 + django-version: Django==3.2 + + - python-version: 3.9 + django-version: Django==4.0 + + - python-version: 3.9 + django-version: Django==4.1 steps: - uses: actions/checkout@v2 @@ -24,6 +63,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install mypy flake8 pytest pytest-xdist flaky + python -m pip install ${{ matrix.django-version }} 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 From 1fb34643679743b7b0cad8d4546c4b0ad4f7dd96 Mon Sep 17 00:00:00 2001 From: Wojciech Maciejewski Date: Mon, 21 Nov 2022 12:52:40 +0100 Subject: [PATCH 2/5] #180 | Test the compatibility of the package --- .github/workflows/django-package.yml | 2 +- testproject/requirements_test.txt | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 testproject/requirements_test.txt diff --git a/.github/workflows/django-package.yml b/.github/workflows/django-package.yml index 0adace87..6efd188b 100644 --- a/.github/workflows/django-package.yml +++ b/.github/workflows/django-package.yml @@ -64,7 +64,7 @@ jobs: python -m pip install --upgrade pip python -m pip install mypy flake8 pytest pytest-xdist flaky python -m pip install ${{ matrix.django-version }} - if [ -f testproject/requirements.txt ]; then pip install -r testproject/requirements.txt; fi + 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: | diff --git a/testproject/requirements_test.txt b/testproject/requirements_test.txt new file mode 100644 index 00000000..2c3f04f6 --- /dev/null +++ b/testproject/requirements_test.txt @@ -0,0 +1,21 @@ +djangorestframework +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 From 9c182943460409863dccd4453ddd762b1cb79af9 Mon Sep 17 00:00:00 2001 From: Wojciech Maciejewski Date: Mon, 21 Nov 2022 14:26:21 +0100 Subject: [PATCH 3/5] DRF --- .github/workflows/django-package.yml | 133 ++++++++++++++++++++++++++- testproject/requirements_test.txt | 1 - 2 files changed, 131 insertions(+), 3 deletions(-) diff --git a/.github/workflows/django-package.yml b/.github/workflows/django-package.yml index 6efd188b..8bb9e061 100644 --- a/.github/workflows/django-package.yml +++ b/.github/workflows/django-package.yml @@ -16,43 +16,172 @@ jobs: 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==2.2 + djangorestframework-version: djangorestframework==3.14 - 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 }} @@ -63,7 +192,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install mypy flake8 pytest pytest-xdist flaky - python -m pip install ${{ matrix.django-version }} + 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 diff --git a/testproject/requirements_test.txt b/testproject/requirements_test.txt index 2c3f04f6..7914c65f 100644 --- a/testproject/requirements_test.txt +++ b/testproject/requirements_test.txt @@ -1,4 +1,3 @@ -djangorestframework django-environ==0.4.5 django-cors-headers==3.7.0 djangorestframework-simplejwt>=4.8.0 From 36162b570f7720383f6524e177f21515d55fd62d Mon Sep 17 00:00:00 2001 From: Wojciech Maciejewski Date: Mon, 21 Nov 2022 15:13:35 +0100 Subject: [PATCH 4/5] DRF --- .github/workflows/django-package.yml | 120 ++++++++++++++++++--------- README.rst | 6 ++ 2 files changed, 86 insertions(+), 40 deletions(-) diff --git a/.github/workflows/django-package.yml b/.github/workflows/django-package.yml index 8bb9e061..e215902f 100644 --- a/.github/workflows/django-package.yml +++ b/.github/workflows/django-package.yml @@ -17,12 +17,15 @@ jobs: - 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 @@ -30,12 +33,15 @@ jobs: - 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 @@ -43,12 +49,15 @@ jobs: - 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 @@ -56,12 +65,15 @@ jobs: - 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 @@ -69,25 +81,31 @@ jobs: - 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 + 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 @@ -95,12 +113,15 @@ jobs: - 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 @@ -108,12 +129,15 @@ jobs: - 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 @@ -121,12 +145,15 @@ jobs: - 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==2.2 djangorestframework-version: djangorestframework==3.14 @@ -134,12 +161,15 @@ jobs: - 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 @@ -147,12 +177,15 @@ jobs: - 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 @@ -160,12 +193,15 @@ jobs: - 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 @@ -173,52 +209,56 @@ jobs: - 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 - 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 + - 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 From 2395db200ef64f07d55ea5dd7d0b096bff978050 Mon Sep 17 00:00:00 2001 From: Wojciech Maciejewski Date: Tue, 22 Nov 2022 07:45:57 +0100 Subject: [PATCH 5/5] DRF --- .github/workflows/django-package.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/django-package.yml b/.github/workflows/django-package.yml index e215902f..40e9a667 100644 --- a/.github/workflows/django-package.yml +++ b/.github/workflows/django-package.yml @@ -154,10 +154,6 @@ jobs: django-version: Django==2.2 djangorestframework-version: djangorestframework==3.13 - - python-version: 3.9 - django-version: Django==2.2 - djangorestframework-version: djangorestframework==3.14 - - python-version: 3.9 django-version: Django==3.1 djangorestframework-version: djangorestframework==3.11