Skip to content

Commit

Permalink
Switch to GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjoe committed Oct 11, 2019
1 parent ce0c0ab commit 59ce923
Show file tree
Hide file tree
Showing 26 changed files with 154 additions and 130 deletions.
1 change: 1 addition & 0 deletions .checks.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- bandit
- flake8
- pydocstyle
- isort
21 changes: 8 additions & 13 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,21 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf
max_line_length = 88

[*.{rst,ini,cfg}]
indent_style = space
indent_size = 4
[*.py]
max_line_length = 120

[*.{yml,html,xml,xsl,json}]
indent_style = space
[*.{yml, html, xml, xsl, json}]
indent_size = 2

[*.{css,less}]
indent_style = space
[*.{css, less}]
indent_size = 2

[*.dot]
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Docs

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
- name: Install binary dependencies
run: sudo apt-get install -y python3-enchant graphviz
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install sphinxcontrib-spelling
python setup.py develop
- name: Build documentation
run: python setup.py build_sphinx -W -b spelling
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: PyPi Release

on: [release]

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel twine
- name: Build dist packages
run: python setup.py sdist bdist_wheel
- name: Upload packages
run: python -m twine upload dist/*
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
33 changes: 33 additions & 0 deletions .github/workflows/reversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests with reversion extras

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7]
django-version: [2.2.*]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install binary dependencies
run: |
sudo apt-get update
sudo apt-get install -y graphviz redis-server
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel codecov
pip install -e .[reversion,test]
pip install django==${{ matrix.django-version }}
- name: Run tests
run: PATH=$PATH:$(pwd)/bin py.test
- run: codecov
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7]
django-version: [2.2.*]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install binary dependencies
run: |
sudo apt-get update
sudo apt-get install -y graphviz redis-server
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel codecov
pip install -e .[test]
pip install django==${{ matrix.django-version }}
- name: Run tests
run: PATH=$PATH:$(pwd)/bin py.test
- run: codecov
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import django


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings")
sys.path.insert(0, os.path.abspath('..'))
django.setup()
Expand All @@ -20,7 +19,7 @@
]

try:
import sphinxcontrib.spelling
import sphinxcontrib.spelling # noqa
except ImportError:
pass
else:
Expand Down
1 change: 0 additions & 1 deletion joeflow/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from . import models
from .contrib.reversion import VersionAdmin


__all__ = (
'ProcessAdmin',
)
Expand Down
1 change: 1 addition & 0 deletions joeflow/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.db import transaction

from joeflow.contrib.reversion import with_reversion

from . import locking

logger = logging.getLogger('joeflow')
Expand Down
2 changes: 1 addition & 1 deletion joeflow/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class JoeflowAppConfig(AppConf):
JOEFLOW_REDIS_LOCK_TIMEOUT = 60
"""
Process lock timeout in seconds.
Processes are lock and only one machine task at a time can change the
process state.
"""
Expand Down
1 change: 0 additions & 1 deletion joeflow/locking.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from .conf import settings


__all__ = (
'lock',
)
Expand Down
3 changes: 2 additions & 1 deletion joeflow/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Generated by Django 2.1.3 on 2018-11-29 15:10

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion

import joeflow.models


Expand Down
17 changes: 9 additions & 8 deletions joeflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.db import models, transaction
from django.db.models.functions import Now
from django.urls import path, reverse, NoReverseMatch
from django.urls import NoReverseMatch, path, reverse
from django.utils import timezone
from django.utils.safestring import SafeString
from django.utils.translation import ugettext_lazy as t
from django.views.generic.edit import BaseCreateView

from joeflow import views, celery, tasks, utils
from joeflow import celery, tasks, utils, views

from .conf import settings

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -95,10 +96,10 @@ class Meta:
edges = None
"""
Edges define the transitions between tasks.
They are the glue that binds tasks together. Edges have no
behavior but define the structure of a workflow.
Returns:
(list[tuple]):
List of edges. An edge is represented by a tuple
Expand Down Expand Up @@ -315,8 +316,8 @@ def process_subclasses():
apps.check_models_ready()
query = models.Q()
for model in utils.get_processes():
opts = model._meta
query |= models.Q(app_label=opts.app_label, model=opts.model_name)
opts = model._meta
query |= models.Q(app_label=opts.app_label, model=opts.model_name)
return query


Expand Down Expand Up @@ -355,8 +356,8 @@ class Task(models.Model):
_process = models.ForeignKey(
'joeflow.Process',
on_delete=models.CASCADE,
db_column='process_id'
, editable=False,
db_column='process_id',
editable=False,
)
content_type = models.ForeignKey(
'contenttypes.ContentType',
Expand Down
2 changes: 1 addition & 1 deletion joeflow/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
A task can be considered as a simple transaction that changes state of a process.
There are two types of tasks, human and machine tasks.
"""
from .machine import * # NoQA
from .human import * # NoQA
from .machine import * # NoQA

HUMAN = 'human'
MACHINE = 'machine'
1 change: 0 additions & 1 deletion joeflow/tasks/human.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from joeflow.views import TaskViewMixin


__all__ = (
'StartView',
'UpdateView',
Expand Down
2 changes: 1 addition & 1 deletion joeflow/tasks/machine.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Set of reusable machine tasks."""
from typing import Iterable
from django.utils import timezone

from django.utils import timezone

__all__ = (
'Start',
Expand Down
Loading

0 comments on commit 59ce923

Please sign in to comment.