Skip to content

Commit

Permalink
Update Django/Python versions in Automated Tests (#100)
Browse files Browse the repository at this point in the history
* Update Django/Python versions in Automated Tests

Updated the automated tests run by Github Actions to only use supported
versions and combinations of Python and Django.
- Added Python 3.10 to Github automated tests for Django 3.2 and 4.0.
- Removed Python 3.6 and Django 2.2/3.1 from tests {deprecated upstream).
- Run linters using the latest version of Python (3.10).

* Update package metadata and deployment tests

- Python 3.7 is now the minimum required version to installl
   crispy-bootstrap5.
- Removed Django 2.2, 3.1, and Python 3.6 (deprecated upstream) from
   classifiers.
- Removed Python 3.6 from publishing test matrix
- Run the deployment process using the latest version of Python (3.10).
- Fixed a broken test results file where it incorrectly expected a
  repeated form-select (test_prepended_appended_select.html)
  • Loading branch information
jmoppel authored Mar 15, 2022
1 parent 2b1a014 commit 32c3fbb
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 74 deletions.
83 changes: 41 additions & 42 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,49 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -e '.[test]'
- name: Run tests
run: |
pytest
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -e '.[test]'
- name: Run tests
run: |
pytest
deploy:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-publish-pip-
- name: Install dependencies
run: |
pip install setuptools wheel twine
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-publish-pip-
- name: Install dependencies
run: |
pip install setuptools wheel twine
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
50 changes: 24 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,39 @@ name: Test
on:
push:
branches:
- main
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
django: [2.2.*, 3.1.*, 3.2.*, 4.0a1]
python-version: [3.7, 3.8, 3.9, "3.10"]
django: [3.2.*, 4.0.*]
exclude:
- python-version: 3.6
django: 4.0a1
- python-version: 3.7
django: 4.0a1
django: 4.0.*
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -e .[test]
pip install django==${{ matrix.django }}
- name: Run tests
run: |
pytest
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -e .[test]
pip install django==${{ matrix.django }}
- name: Run tests
run: |
pytest
lint:
name: Lint
Expand All @@ -47,7 +45,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: "3.10"
- name: Install dependencies
run: |
pip install flake8 isort black
Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,19 @@ def get_long_description():
install_requires=["django-crispy-forms>=1.13.0", "django>=2.2"],
extras_require={"test": ["pytest", "pytest-django"]},
tests_require=["crispy-bootstrap5[test]"],
python_requires=">=3.6",
python_requires=">=3.7",
include_package_data=True,
classifiers=[
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down
4 changes: 2 additions & 2 deletions tests/results/test_prepended_appended_select.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div id="div_id_select_input" class="mb-3"> <label for="id_select_input" class="form-label requiredField"> Select
input<span class="asteriskField">*</span> </label>
<div>
<div class="input-group"> <select name="select_input" class="select form-select form-select"
<div class="input-group"> <select name="select_input" class="select form-select"
id="id_select_input">
<option value="1">Option one</option>
<option value="2">Option two</option>
Expand All @@ -25,7 +25,7 @@
input<span class="asteriskField">*</span> </label>
<div>
<div class="input-group"> <span class="input-group-text">£</span> <select name="select_input"
class="select form-select form-select form-select" id="id_select_input">
class="select form-select" id="id_select_input">
<option value="1">Option one</option>
<option value="2">Option two</option>
<option value="3">Option three</option>
Expand Down

0 comments on commit 32c3fbb

Please sign in to comment.