Skip to content

Commit

Permalink
Use Github Actions for testing and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePumpingLemma authored and David Grochowski committed Nov 11, 2020
1 parent 4cb4d2d commit dd44c8b
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 26 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
build:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]

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 setuptools wheel
pip install -r requirements/tox.txt
- name: Run tox
run: tox
- name: Publish coverage
uses: codecov/codecov-action@v1
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tool.coverage.run]
parallel = true
branch = true
source = ["simple_history"]

[tool.coverage.paths]
source = ["simple_history", ".tox/*/site-packages"]

[tool.coverage.report]
show_missing = true
skip_covered = true
omit = ["requirements/*"]
2 changes: 2 additions & 0 deletions requirements/coverage.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage==5.3
toml==0.10.2
1 change: 1 addition & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sphinx==3.3.0
2 changes: 2 additions & 0 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
black==20.8.b1
flake8==3.8.4
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-r ./coverage.txt
3 changes: 3 additions & 0 deletions requirements/tox.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-r ./coverage.txt
tox==3.20.1
tox-gh-actions==2.1.0
54 changes: 28 additions & 26 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,47 @@ envlist =
py{36,37,38}-django30,
py{36,37,38}-django31,
py{36,37,38}-djangodev,
py38-flake8,
docs
py{36,38}-black
docs,
lint

[gh-actions]
python =
3.5: py35
3.6: py36
3.7: py37
3.8: py38, docs, lint

[travis]
python =
3.5: py35
3.6: py36, docs
3.7: py37
3.8: py38
3.5: py35
3.6: py36
3.7: py37
3.8: py38, docs, lint

[flake8]
ignore = N802,F401,W503
max-complexity = 10
max-line-length = 88
exclude = __init__.py,simple_history/registry_tests/migration_test_app/migrations/*

[testenv]
deps =
coverage
codecov
-rrequirements/test.txt
django22: Django>=2.2,<2.3
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
djangodev: https://github.com/django/django/tarball/master
commands =
coverage run -a --branch runtests.py

[flake8]
ignore = N802,F401,W503
max-complexity = 10
max-line-length = 88
exclude = __init__.py,simple_history/registry_tests/migration_test_app/migrations/*
coverage run -a runtests.py
coverage report

[testenv:py38-flake8]
deps = flake8
commands = flake8 simple_history

[testenv:py{36,38}-black]
deps =
black==20.8.b1
commands = black --check simple_history setup.py runtests.py
[testenv:lint]
deps = -rrequirements/lint.txt
commands =
black --check simple_history setup.py runtests.py
flake8 simple_history

[testenv:docs]
changedir = docs
deps =
Sphinx
deps = -rrequirements/docs.txt
commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

0 comments on commit dd44c8b

Please sign in to comment.