Skip to content

Commit

Permalink
Merge pull request #81 from mfogel/dev/5.0
Browse files Browse the repository at this point in the history
5.0, breaking changes (see changelog)
  • Loading branch information
mfogel committed Feb 9, 2022
2 parents f6560c3 + 676a8e0 commit 5d6c1ab
Show file tree
Hide file tree
Showing 26 changed files with 1,500 additions and 931 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[flake8]
ignore=W503
max-line-length=100
max-line-length=120
202 changes: 114 additions & 88 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,59 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
name: Lint with flake8
name: Lint

steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Git checkout
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
- name: Set up Python
uses: actions/setup-python@v2

- name: Install Poetry
uses: snok/install-poetry@v1.1.6
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Lint with flake8
run: poetry run flake8 --exclude .venv
- name: Lint with black
run: poetry run black --check --diff .

- name: Lint with flake8
run: poetry run flake8 --exclude .venv

- name: Lint with isort
run: poetry run isort --check --diff .

- name: Lint with pylint
run: poetry run pylint tests timezone_field setup.py

test:
runs-on: ubuntu-latest
name: Test with py${{ matrix.python-version }}, dj${{ matrix.django-version }}, ${{ matrix.db-engine }}

strategy:
matrix:
# skipping python 3.5 (doesn't seem to play well with install-poetry action)
# https://docs.djangoproject.com/en/4.0/faq/install/#what-python-version-can-i-use-with-django
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
django-version: ["2.2", "3.0", "3.1", "3.2"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
django-version: ["2.2", "3.2", "4.0"]
db-engine: [sqlite, postgres]
exclude:
- python-version: "3.10"
django-version: "2.2"
- python-version: "3.10"
django-version: "3.0"
- python-version: "3.10"
django-version: "3.1"
- python-version: "3.7"
django-version: "4.0"

env:
PYTHON_VERSION: ${{ matrix.python-version }}
Expand All @@ -71,65 +77,85 @@ jobs:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Git checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-py${{ matrix.python-version}}-dj${{ matrix.django-version }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install django ${{ matrix.django-version }}
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
source .venv/bin/activate
pip install "Django~=${{ matrix.django-version }}"
- name: Test with coverage
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
run: poetry run pytest --cov=timezone_field

- name: Generate coverage report
run: poetry run coverage xml

- name: Upload coverage report to codecov
uses: codecov/codecov-action@v2
with:
env_vars: PYTHON_VERSION,DJANGO_VERSION,DB_ENGINE
fail_ci_if_error: true

build:
runs-on: ubuntu-latest
name: Build

steps:
- name: Git checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1.1.6
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-py${{ matrix.python-version}}-dj${{ matrix.django-version }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

# pytest v6.2 is required for python 3.10 but doesn't support python 3.5
# so as long as we support python 3.5 it can't go in our pyproject.toml
- name: Upgrade pytest
if: matrix.python-version == '3.10'
run: |
source .venv/bin/activate
pip install 'pytest==6.2.5'
- name: Install django ${{ matrix.django-version }}
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
source .venv/bin/activate
pip install "Django==${{ matrix.django-version }}"
- name: Test with coverage
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
run: poetry run pytest --cov=timezone_field

- name: Generate coverage report
run: poetry run coverage xml

- name: Upload coverage report to codecov
uses: codecov/codecov-action@v1
with:
env_vars: PYTHON_VERSION,DJANGO_VERSION,DB_ENGINE
fail_ci_if_error: true
- name: Git checkout
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Build with poetry
run: poetry build
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit 5d6c1ab

Please sign in to comment.