From 47b6a8b95849b82ebbd8291ee3e546eecc8a4cc2 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 21 Aug 2021 09:25:06 +0200 Subject: [PATCH] Add requirements file for invoke & update invoke tasks --- requirements.txt | 1 + tasks.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..460820d --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +invoke diff --git a/tasks.py b/tasks.py index bfecd11..9c1f67e 100644 --- a/tasks.py +++ b/tasks.py @@ -22,10 +22,23 @@ BASE_DIR = Path(__file__).parent.resolve(strict=True) @task -def tag(context, tag): +def test(context): + """Run tests""" + context.run("go test ./...") + + +@task(pre=[test]) +def release(context, version_name): + """Create & push git tag + build binaries""" + tag(context, version_name) + build(context, version_name) + + +@task(pre=[test]) +def tag(context, version_name): """Create & push a git tag""" context: Context - context.run(f"git tag -a {tag} -m '{tag}'") + context.run(f"git tag -a {version_name} -m '{version_name}'") context.run("git push --follow-tags")