Skip to content

Commit

Permalink
Add github actions with a tox config
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemonteith committed May 18, 2021
1 parent 3c06a67 commit d694a2e
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 9 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Tests

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Tox
run: pip install tox
- name: Run Linting
run: tox -e lint

test:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install Tox
run: pip install tox
- name: Run Tests
# Run tox using the version of Python in `PATH`
run: tox -e py
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ testapp/db.sqlite3
testapp/media/images
__pycache__
Pipfile
.python-version
.python-version
.tox
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

13 changes: 13 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
'Wagtail>=2.0',
]

TESTING_REQUIRES = [
"beautifulsoup4==4.8.2",
"Django>=3.1,<3.2",
"pytest==4.3.0",
"pytest-django==3.4.7",
"pytest-pythonpath==0.7.3",
]

LINTING_REQUIRES = [
"flake8==3.7.5",
]


class CompileCSSCommand(build):
"""Combine CSS from the frontend library with our wagtail-specific fixes"""
Expand Down Expand Up @@ -41,4 +53,5 @@ def run(self):
install_requires=INSTALL_REQUIRES,
packages=find_packages(),
include_package_data=True,
extras_require={"testing": TESTING_REQUIRES, "linting": LINTING_REQUIRES},
)
24 changes: 23 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
[tox]

envlist = py{36,37,38,39}-wagtail{212,213}, lint

[flake8]

# E501: Line too long
# Ignore line length rules. Black should take care of this
ignore=E501

exclude=.git,__pycache__,dist,.tox,venv,*/migrations/*

[pytest]
DJANGO_SETTINGS_MODULE = testapp.settings.dev
python_paths = testapp

[testenv:lint]
extras = linting
commands = flake8 .

[testenv]

install_command = pip install {opts} {packages}
extras = testing
deps =
wagtail212: Wagtail>=2.12,<2.13
wagtail213: Wagtail>=2.13,<2.14

commands =
python testapp/manage.py makemigrations --dry-run --check
pytest .

0 comments on commit d694a2e

Please sign in to comment.