Added {% raw %} and {% endraw %} to allow jinja to parse the tempaltes correctly.

This commit is contained in:
Arnav Choudhury 2020-09-19 02:35:39 +05:30
commit 8a879fdf74
4 changed files with 29 additions and 63 deletions

View File

@ -123,10 +123,6 @@ def remove_dotgitlabciyml_file():
os.remove(".gitlab-ci.yml") os.remove(".gitlab-ci.yml")
# def remove_dotgithubciyml_file():
# os.remove(".github-ci.yml")
def remove_dotgithub_folder(): def remove_dotgithub_folder():
shutil.rmtree(".github") shutil.rmtree(".github")
@ -403,9 +399,6 @@ def main():
if "{{ cookiecutter.ci_tool }}".lower() != "gitlab": if "{{ cookiecutter.ci_tool }}".lower() != "gitlab":
remove_dotgitlabciyml_file() remove_dotgitlabciyml_file()
# if "{{ cookiecutter.ci_tool }}".lower() != "github":
# remove_dotgithubciyml_file()
if "{{ cookiecutter.ci_tool }}".lower() != "github": if "{{ cookiecutter.ci_tool }}".lower() != "github":
remove_dotgithub_folder() remove_dotgithub_folder()

View File

@ -10,7 +10,6 @@ from binaryornot.check import is_binary
PATTERN = r"{{(\s?cookiecutter)[.](.*?)}}" PATTERN = r"{{(\s?cookiecutter)[.](.*?)}}"
RE_OBJ = re.compile(PATTERN) RE_OBJ = re.compile(PATTERN)
@pytest.fixture @pytest.fixture
def context(): def context():
return { return {
@ -139,6 +138,7 @@ def check_paths(paths):
@pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id) @pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id)
def test_project_generation(cookies, context, context_override): def test_project_generation(cookies, context, context_override):
"""Test that project is generated and fully rendered.""" """Test that project is generated and fully rendered."""
result = cookies.bake(extra_context={**context, **context_override}) result = cookies.bake(extra_context={**context, **context_override})
assert result.exit_code == 0 assert result.exit_code == 0
assert result.exception is None assert result.exception is None
@ -245,6 +245,7 @@ def test_github_invokes_flake8_and_pytest(
assert result.project.basename == context["project_slug"] assert result.project.basename == context["project_slug"]
assert result.project.isdir() assert result.project.isdir()
with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml: with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml:
try: try:
github_config = yaml.safe_load(github_yml) github_config = yaml.safe_load(github_yml)

View File

@ -0,0 +1,7 @@
version: 2
updates:
# Update Github actions in workflows
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@ -1,63 +1,28 @@
FROM python:3.8-slim-buster
# Python build stage
FROM python:3.8-slim-buster as python-build-stage
ENV PYTHONDONTWRITEBYTECODE 1
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg2 dependencies
libpq-dev \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
# create python dependency wheels
RUN pip wheel --no-cache-dir --no-deps --use-feature=2020-resolver --wheel-dir /usr/src/app/wheels \
-r /requirements/local.txt -r /requirements/production.txt \
&& rm -rf /requirements
# Python 'run' stage
FROM python:3.8-slim-buster as python-run-stage
ARG BUILD_ENVIRONMENT
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONDONTWRITEBYTECODE 1
RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Translations dependencies
&& apt-get install -y gettext \
# Uncomment below lines to enable Sphinx output to latex and pdf
# && apt-get install -y texlive-latex-recommended \
# && apt-get install -y texlive-fonts-recommended \
# && apt-get install -y texlive-latex-extra \
# && apt-get install -y latexmk \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
# Requirements are installed here to ensure they will be cached.
RUN apt-get update && apt-get install --no-install-recommends -y \ COPY ./requirements /requirements
# dependencies for building Python packages # All imports needed for autodoc.
build-essential \ RUN pip install -r /requirements/local.txt -r /requirements/production.txt
# psycopg2 dependencies
libpq-dev \
# Translations dependencies
gettext \
# Uncomment below lines to enable Sphinx output to latex and pdf
# texlive-latex-recommended \
# texlive-fonts-recommended \
# texlive-latex-extra \
# latexmk \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
# copy python dependency wheels from python-build-stage
COPY --from=python-build-stage /usr/src/app/wheels /wheels
# use wheels to install python dependencies
RUN pip install --no-cache /wheels/* \
&& rm -rf /wheels
WORKDIR /docs WORKDIR /docs