Skip to content

Commit

Permalink
Update test workflow (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrelg committed Oct 26, 2020
1 parent 0f3b660 commit 499a423
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 72 deletions.
61 changes: 0 additions & 61 deletions .github/workflows/pythonpackage.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,73 @@
name: test

on: pull_request

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: "3"
- name: Load cached wheels
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install pip -U
python -m pip install black flake8 isort
- name: Run checks
run: |
flake8 .
black . --check
isort .
test:
needs: linting
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.6", "3.7", "3.8", "3.9" ]
django-version: [ "2.2", "3.0", "3.1" ]
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Use Poetry
uses: sondrelg/install-poetry@v0.2.0
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-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-4
- name: Install dependencies
run: |
source $HOME/.poetry/env
poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Install django ${{ matrix.django-version }}
run: |
source $HOME/.poetry/env
python -m pip install "Django==${{ matrix.django-version }}" --upgrade --force-reinstall
- name: Run tests
run: |
source $HOME/.poetry/env
poetry run pytest --cov=django_guid tests/
poetry run coverage report
11 changes: 0 additions & 11 deletions .isort.cfg

This file was deleted.

17 changes: 17 additions & 0 deletions pyproject.toml
Expand Up @@ -16,13 +16,15 @@ classifiers = [
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: WSGI',
Expand Down Expand Up @@ -60,6 +62,21 @@ exclude = '''
)
'''

[tool.isort]
profile = "black"
src_paths = ["django_guid"]
combine_as_imports = true
line_length = 120
sections = [
'FUTURE',
'STDLIB',
'DJANGO',
'THIRDPARTY',
'FIRSTPARTY',
'LOCALFOLDER'
]
known_django = ['django']

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

0 comments on commit 499a423

Please sign in to comment.