Add release tasks (#6)

Added two tasks to tasks.py, release and release_tests.

Applied black formatter

authored-by: Raymundo Ramirez Mata <raymundora@google.com>
This commit is contained in:
Ray
2022-08-16 14:50:30 -04:00
committed by GitHub
parent 431445e6a2
commit 216ce2abd0
3 changed files with 34 additions and 19 deletions

View File

@@ -29,11 +29,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[test,development,documentation]"
python -m pip install ".[build,test,development,documentation]"
- name: Test with pytest
run: |
pytest
- name: Build
run: |
inv build
inv mkdocs
inv build.mkdocs

View File

@@ -57,12 +57,13 @@ console_scripts =
bumble-link-relay = bumble.apps.link_relay.link_relay:main
[options.extras_require]
build =
build >= 0.7
test =
pytest >= 6.2
pytest-asyncio >= 0.17
development =
invoke >= 1.4
build >= 0.7
nox >= 2022
documentation =
mkdocs >= 1.2.3

View File

@@ -24,34 +24,48 @@ ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
ns = Collection()
build_tasks = Collection()
ns.add_collection(build_tasks, name='build')
ns.add_collection(build_tasks, name="build")
@task
def build(ctx):
ctx.run('python -m build')
ctx.run("python -m build")
build_tasks.add_task(build, default=True, name='build')
test_tasks = Collection()
ns.add_collection(test_tasks, name='test')
build_tasks.add_task(build, default=True, name="build")
@task
def test(ctx, filter=None, junit=False):
def release_build(ctx):
ctx.run('python -m pip install .[build]')
build(ctx)
build_tasks.add_task(release_build, name="release")
@task
def mkdocs(ctx):
ctx.run("mkdocs build -f docs/mkdocs/mkdocs.yml")
build_tasks.add_task(mkdocs, name="mkdocs")
test_tasks = Collection()
ns.add_collection(test_tasks, name="test")
@task
def test(ctx, filter=None, junit=False, install=False):
# Install the package before running the tests
if install:
ctx.run("python -m pip install .[test]")
args = ""
if junit:
args += "--junit-xml test-results.xml"
if filter is not None:
args += " -k '{}'".format(filter)
ctx.run('python -m pytest {} {}'
.format(os.path.join(ROOT_DIR, "tests"), args))
test_tasks.add_task(test, name='test', default=True)
ctx.run("python -m pytest {} {}".format(os.path.join(ROOT_DIR, "tests"), args))
@task
def mkdocs(ctx):
ctx.run('mkdocs build -f docs/mkdocs/mkdocs.yml')
ns.add_task(mkdocs)
test_tasks.add_task(test, name="test", default=True)