Skip to content

Commit

Permalink
Adds release tasks for invoke
Browse files Browse the repository at this point in the history
  • Loading branch information
HazardDede committed May 5, 2020
1 parent 3c78618 commit 73009ce
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 363 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,7 @@ ENV/
*.logging

# ARM emulator
qemu-arm-static
qemu-arm-static

# Artifacts
requirements.dev
1 change: 1 addition & 0 deletions Dockerfile.amd64
File renamed without changes.
143 changes: 0 additions & 143 deletions Makefile

This file was deleted.

81 changes: 0 additions & 81 deletions requirements.dev

This file was deleted.

31 changes: 0 additions & 31 deletions scripts/process_docs.py

This file was deleted.

19 changes: 10 additions & 9 deletions tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
from invoke import Collection, task
from invoke import Collection

from tasks import (
build,
config,
docker,
docs,
linting,
release,
testing
)
from tasks.config import VERSION


@task
def version(ctx):
print(VERSION)


ns = Collection()

config = Collection.from_module(config, name="config")
docker = Collection.from_module(docker, name="docker")
docs = Collection.from_module(docs, name="docs")
linting = Collection.from_module(linting, name="lint")
release = Collection.from_module(release, name="release")
testing = Collection.from_module(testing, name="test")

# Subtasks
ns.add_collection(config)
ns.add_collection(docker)
ns.add_collection(docs)
ns.add_collection(linting)
ns.add_collection(release)
ns.add_collection(testing)

# Tasks
ns.add_task(version)
ns.add_task(build.version)
ns.add_task(build.clean)
20 changes: 20 additions & 0 deletions tasks/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from invoke import task

from tasks.config import VERSION


@task
def version(ctx):
"""Show the current version."""
print(VERSION)


@task
def clean(ctx):
"""Removes python build artifacts (*.pyc, *.pyo, caches, ...)"""
ctx.run(
"find . -type f -name '*.pyc' -delete && "
"find . -type f -name '*.pyo' -delete && "
"rm -rf .pytest_cache && "
"rm -rf .mypy_cache"
)
29 changes: 16 additions & 13 deletions tasks/config.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import os

from invoke import task

# VERSION
VERSION = "0.22.0"

# PROJECT ROOT
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

# PATH STUFF
CONFIGS_PATH = os.path.join(PROJECT_ROOT, 'config')
DOCS_PATH = os.path.join(PROJECT_ROOT, 'docs')
SCRIPTS_PATH = os.path.join(PROJECT_ROOT, 'scripts')
SOURCE_PATH = os.path.join(PROJECT_ROOT, 'pnp')
TASKS_PATH = os.path.join(PROJECT_ROOT, 'tasks')
TEST_PATH = os.path.join(PROJECT_ROOT, 'tests')
PROJECT_ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
CONFIGS_PATH = os.path.join(PROJECT_ROOT_PATH, 'config')
DOCS_PATH = os.path.join(PROJECT_ROOT_PATH, 'docs')
SCRIPTS_PATH = os.path.join(PROJECT_ROOT_PATH, 'scripts')
SOURCE_PATH = os.path.join(PROJECT_ROOT_PATH, 'pnp')
TASKS_PATH = os.path.join(PROJECT_ROOT_PATH, 'tasks')
TEST_PATH = os.path.join(PROJECT_ROOT_PATH, 'tests')


# DOCKER STUFF
LOCAL_IMAGE_NAME = 'pnp'
LOCAL_IMAGE_TAG = 'local'
ARM_SUFFIX_TAG = 'arm'
PUBLIC_IMAGE_NAME = 'hazard/pnp'
@task(default=True)
def config(ctx):
"""Shows the general configuration."""
for k, v in globals().items():
if k.endswith("_PATH"):
print(k.ljust(20), v)

0 comments on commit 73009ce

Please sign in to comment.