Skip to content

Commit

Permalink
Remove 3rd party dependencies from invoke (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
snaselj authored Oct 16, 2023
1 parent 1a24237 commit e8f2142
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 90 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/check-pr-qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
qa:
runs-on: "ubuntu-22.04"
env:
COMPOSE_FILE: "development/compose.yaml"
FROM_IMAGE: "python:3.11-slim"
IMAGE_PREFIX: "ghcr.io/${{ github.repository }}"
IMAGE_TAG: "${{ github.sha }}"
TARGET_WORKDIR: "/${{ github.repository }}"
Expand All @@ -22,7 +24,6 @@ jobs:
- name: "QA"
run: |
docker compose \
--env-file=development/default.env \
up \
--exit-code-from=qa \
--no-color \
Expand Down
47 changes: 0 additions & 47 deletions development/default.env

This file was deleted.

27 changes: 1 addition & 26 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ isort = "*"
pylint = "*"
pytest = "*"
pytest-cookies = "*"
python-dotenv = "*"
ruff = "*"
toml = "*"
yamllint = "*"

[tool.black]
Expand Down
19 changes: 5 additions & 14 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
from pwd import getpwuid
from typing import Generator

import toml
from dotenv import load_dotenv
from invoke.collection import Collection
from invoke.tasks import task

Expand All @@ -34,28 +32,21 @@ def _jsontobool(value: str) -> bool:


def _setup_env():
load_dotenv(_PATH / ".creds.env", verbose=True)
load_dotenv(_PATH / ".env", verbose=True)
load_dotenv(_PATH / "development/default.env", verbose=True)

def setenv(key, value):
if key not in environ:
environ[key] = str(value)

setenv("REPOSITORY_DIR", _PATH.absolute())
setenv("TARGET_WORKDIR", _PATH)

uid = getuid()
setenv("USER_UID", uid)
setenv("USER_NAME", getpwuid(uid).pw_name)

pyproject = toml.load(_PATH / "pyproject.toml")
setenv("PACKAGE_SLUG", pyproject["tool"]["poetry"]["name"])
setenv("PACKAGE_NAME", pyproject["tool"]["poetry"]["name"].replace("-", "_"))
setenv("PACKAGE_VERSION", pyproject["tool"]["poetry"]["version"])

setenv("COMPOSE_PROJECT_NAME", environ["PACKAGE_SLUG"])
setenv("COMPOSE_FILE", "development/compose.yaml")
setenv("COMPOSE_PROJECT_NAME", "cookiecutter-nautobot-app")
setenv("FROM_IMAGE", "python:3.11-slim")
setenv("IMAGE_PREFIX", f"localhost/{environ['COMPOSE_PROJECT_NAME']}")
setenv("IMAGE_TAG", "latest")


_setup_env()
Expand Down Expand Up @@ -137,7 +128,7 @@ def build_task(context, service="", cache=True, force_rm=False, pull=False):
"template": "Name of the cookiecutter template to test",
}
)
def test_template(context, template):
def test_template(context, template=""):
"""Test a specific cookiecutter template."""
test_dir = _PATH / template / "tests"
if not test_dir.exists():
Expand Down

0 comments on commit e8f2142

Please sign in to comment.