41 lines
692 B
Python
41 lines
692 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
# type: ignore
|
||
|
from invoke import task
|
||
|
|
||
|
try:
|
||
|
from ops.tasks import * # noqa: F401,F403
|
||
|
except ImportError:
|
||
|
pass
|
||
|
|
||
|
|
||
|
@task
|
||
|
def flake8(ctx, warn=False):
|
||
|
return ctx.run('flake8', warn=warn)
|
||
|
|
||
|
|
||
|
@task
|
||
|
def mypy(ctx, warn=False):
|
||
|
return ctx.run('mypy .', warn=warn)
|
||
|
|
||
|
|
||
|
@task
|
||
|
def tests(ctx, warn=False):
|
||
|
return ctx.run('pytest -v', warn=warn)
|
||
|
|
||
|
|
||
|
@task
|
||
|
def ci(ctx):
|
||
|
result = True
|
||
|
|
||
|
if flake8(ctx, warn=True).exited != 0:
|
||
|
result = False
|
||
|
|
||
|
if mypy(ctx, warn=True).exited != 0:
|
||
|
result = False
|
||
|
|
||
|
if tests(ctx, warn=True).exited != 0:
|
||
|
result = False
|
||
|
|
||
|
if result is False:
|
||
|
raise RuntimeError('Some checks have failed')
|