Skip to content

Commit

Permalink
Merge branch 'release/3.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius committed May 4, 2022
2 parents 739a07d + 689cb0e commit 9aef9a5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{cookiecutter.project_name | upper}}_RELOAD=True
{%- if cookiecutter.db_info.name == "sqlite" %}
{{cookiecutter.project_name | upper}}_DB_FILE=db.sqlite3
{%- else %}
{%- elif cookiecutter.db_info.name != 'none' %}
{{cookiecutter.project_name | upper}}_DB_HOST=localhost
{%- endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ jobs:
run: poetry run mypy .
pytest:
runs-on: ubuntu-latest
{%- if cookiecutter.db_info.name != "none" %}
{%- if cookiecutter.db_info.name != "sqlite" %}
{%- if ((cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite") or
(cookiecutter.enable_rmq == "True")) %}
services:
{%- if cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite" %}
{{cookiecutter.project_name}}-db:
image: {{ cookiecutter.db_info.image }}
env:
Expand All @@ -72,7 +73,18 @@ jobs:
{%- endif %}
ports:
- {{ cookiecutter.db_info.port }}
{%- endif %}
{%- endif %}
{%- if cookiecutter.enable_rmq == "True" %}
{{cookiecutter.project_name}}-rmq:
image: rabbitmq:3.9.16-alpine
env:
RABBITMQ_DEFAULT_USER: "guest"
RABBITMQ_DEFAULT_PASS: "guest"
RABBITMQ_DEFAULT_VHOST: "/"
options: --health-cmd="rabbitmq-diagnostics check_running -q" --health-interval=10s --health-timeout=5s --health-retries=8
ports:
- 5672
{%- endif %}
{%- endif %}
steps:
- uses: actions/checkout@v2
Expand All @@ -86,10 +98,15 @@ jobs:
POETRY_VIRTUALENVS_CREATE: false
- name: Run pytest check
run: poetry run pytest -vv --cov="{{cookiecutter.project_name}}" .
env:
{{ cookiecutter.project_name | upper }}_HOST: "0.0.0.0"
{%- if cookiecutter.db_info.name != "none" %}
{%- if cookiecutter.db_info.name != "sqlite" %}
env:
{{ cookiecutter.project_name | upper }}_DB_HOST: localhost
{{ cookiecutter.project_name | upper }}_DB_PORT: {{'${{'}}job.services.{{cookiecutter.project_name}}-db.ports['{{cookiecutter.db_info.port}}']{{'}}'}}
{%- endif %}
{%- endif %}
{%- if cookiecutter.enable_rmq == "True" %}
{{ cookiecutter.project_name | upper }}_RABBIT_HOST: localhost
{{ cookiecutter.project_name | upper }}_RABBIT_PORT: {{'${{'}}job.services.{{cookiecutter.project_name}}-rmq.ports['5672']{{'}}'}}
{%- endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,37 @@ mypy:
pytest:
extends:
- .test-template
{%- if cookiecutter.db_info.name != "none" %}
{%- if cookiecutter.db_info.name != "sqlite" %}
{%- if ((cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite") or
(cookiecutter.enable_rmq == "True")) %}
services:
{%- if cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite" %}
- name: {{ cookiecutter.db_info.image }}
alias: database
{%- endif %}
{%- if cookiecutter.enable_rmq == "True" %}
- name: rabbitmq:3.9.16-alpine
alias: rmq
{%- endif %}
variables:
{%- if cookiecutter.db_info.name == "postgresql" %}
{{ cookiecutter.project_name | upper }}_DB_HOST: localhost
{{ cookiecutter.project_name | upper }}_DB_HOST: database
POSTGRES_PASSWORD: {{ cookiecutter.project_name }}
POSTGRES_USER: {{ cookiecutter.project_name }}
POSTGRES_DB: {{ cookiecutter.project_name }}
{%- endif %}
{%- if cookiecutter.db_info.name == "mysql" %}
{{ cookiecutter.project_name | upper }}_DB_HOST: localhost
{{ cookiecutter.project_name | upper }}_DB_HOST: database
MYSQL_PASSWORD: {{ cookiecutter.project_name }}
MYSQL_USER: {{ cookiecutter.project_name }}
MYSQL_DATABASE: {{ cookiecutter.project_name }}
ALLOW_EMPTY_PASSWORD: yes
{%- endif %}
{%- endif %}
{%- if cookiecutter.enable_rmq == "True" %}
RABBITMQ_DEFAULT_USER: "guest"
RABBITMQ_DEFAULT_PASS: "guest"
RABBITMQ_DEFAULT_VHOST: "/"
{{ cookiecutter.project_name | upper }}_RABBIT_HOST: rmq
{%- endif %}
{%- endif %}
script:
{%- if cookiecutter.db_info.name != "none" %}
Expand All @@ -63,4 +75,10 @@ pytest:
- wait-for-it -t 180 ${{ cookiecutter.project_name | upper }}_DB_HOST:{{cookiecutter.db_info.port}}
{%- endif %}
{%- endif %}
- pytest -vv --cov="{{cookiecutter.project_name}}" .
- pytest -vv --junitxml=report.xml --cov="{{cookiecutter.project_name}}" .
- coverage xml
artifacts:
when: always
reports:
cobertura: coverage.xml
junit: report.xml
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fastapi_template"
version = "3.3.3"
version = "3.3.4"
description = "Feature-rich robust FastAPI template"
authors = ["Pavel Kirilin <[email protected]>"]
packages = [{ include = "fastapi_template" }]
Expand Down

0 comments on commit 9aef9a5

Please sign in to comment.