|
@@ -4,6 +4,9 @@ from invoke import task
|
|
|
from jinja2 import Template
|
|
|
|
|
|
system = "mocka" # Directory name of the project
|
|
|
+main_branch = "main" # The release branch on origin
|
|
|
+dev_branch = "dev" # The main development branch on origin
|
|
|
+
|
|
|
|
|
|
@task
|
|
|
def lint(c):
|
|
@@ -44,8 +47,10 @@ def test(c):
|
|
|
@task
|
|
|
def coverage(c):
|
|
|
"""Run coverage from the 'tests' directory."""
|
|
|
- c.run("coverage run --source . -m unittest discover tests 'test_*' -v")
|
|
|
- c.run("coverage html")
|
|
|
+ c.run("python3 -m coverage erase")
|
|
|
+ c.run("python3 -m coverage run --source . -m unittest discover tests 'test_*' -v")
|
|
|
+ c.run("python3 -m coverage report -m")
|
|
|
+ c.run("python3 -m coverage html")
|
|
|
|
|
|
|
|
|
@task
|
|
@@ -96,18 +101,18 @@ def release(c, version):
|
|
|
_minor = 0
|
|
|
_patch = 0
|
|
|
|
|
|
- c.run(f"git checkout -b release-{_major}.{_minor}.{_patch} dev")
|
|
|
+ c.run(f"git checkout -b release-{_major}.{_minor}.{_patch} {dev_branch}")
|
|
|
c.run(f"sed -i 's/{__version__}/{_major}.{_minor}.{_patch}/g' {system}/__init__.py")
|
|
|
print(f"Update the readme for version {_major}.{_minor}.{_patch}.")
|
|
|
input("Press enter when ready.")
|
|
|
c.run(f"git add -u")
|
|
|
c.run(f'git commit -m "Update changelog version {_major}.{_minor}.{_patch}"')
|
|
|
c.run(f"git push --set-upstream origin release-{_major}.{_minor}.{_patch}")
|
|
|
- c.run(f"git checkout main")
|
|
|
+ c.run(f"git checkout {main_branch}")
|
|
|
c.run(f"git merge --no-ff release-{_major}.{_minor}.{_patch}")
|
|
|
c.run(f'git tag -a {_major}.{_minor}.{_patch} -m "Release {_major}.{_minor}.{_patch}"')
|
|
|
c.run(f"git push")
|
|
|
- c.run(f"git checkout dev")
|
|
|
+ c.run(f"git checkout {dev_branch}")
|
|
|
c.run(f"git merge --no-ff release-{_major}.{_minor}.{_patch}")
|
|
|
c.run(f"git push")
|
|
|
c.run(f"git branch -d release-{_major}.{_minor}.{_patch}")
|