@@ -35,25 +35,37 @@ mypy:
3535pytest :
3636 extends :
3737 - .test-template
38- {%- if cookiecutter.db_info.name != "none" %}
39- {%- if cookiecutter.db_info.name != "sqlite" %}
38+ {%- if (( cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite") or
39+ ( cookiecutter.enable_rmq == "True")) %}
4040 services :
41+ {%- if cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite" %}
4142 - name : {{ cookiecutter.db_info.image }}
43+ alias : database
44+ {%- endif %}
45+ {%- if cookiecutter.enable_rmq == "True" %}
46+ - name : rabbitmq:3.9.16-alpine
47+ alias : rmq
48+ {%- endif %}
4249 variables :
4350 {%- if cookiecutter.db_info.name == "postgresql" %}
44- {{ cookiecutter.project_name | upper }}_DB_HOST: localhost
51+ {{ cookiecutter.project_name | upper }}_DB_HOST: database
4552 POSTGRES_PASSWORD : {{ cookiecutter.project_name }}
4653 POSTGRES_USER : {{ cookiecutter.project_name }}
4754 POSTGRES_DB : {{ cookiecutter.project_name }}
4855 {%- endif %}
4956 {%- if cookiecutter.db_info.name == "mysql" %}
50- {{ cookiecutter.project_name | upper }}_DB_HOST: localhost
57+ {{ cookiecutter.project_name | upper }}_DB_HOST: database
5158 MYSQL_PASSWORD : {{ cookiecutter.project_name }}
5259 MYSQL_USER : {{ cookiecutter.project_name }}
5360 MYSQL_DATABASE : {{ cookiecutter.project_name }}
5461 ALLOW_EMPTY_PASSWORD : yes
5562 {%- endif %}
56- {%- endif %}
63+ {%- if cookiecutter.enable_rmq == "True" %}
64+ RABBITMQ_DEFAULT_USER : " guest"
65+ RABBITMQ_DEFAULT_PASS : " guest"
66+ RABBITMQ_DEFAULT_VHOST : " /"
67+ {{ cookiecutter.project_name | upper }}_RABBIT_HOST: rmq
68+ {%- endif %}
5769 {%- endif %}
5870 script :
5971 {%- if cookiecutter.db_info.name != "none" %}
@@ -63,4 +75,10 @@ pytest:
6375 - wait-for-it -t 180 ${{ cookiecutter.project_name | upper }}_DB_HOST:{{cookiecutter.db_info.port}}
6476 {%- endif %}
6577 {%- endif %}
66- - pytest -vv --cov="{{cookiecutter.project_name}}" .
78+ - pytest -vv --junitxml=report.xml --cov="{{cookiecutter.project_name}}" .
79+ - coverage xml
80+ artifacts :
81+ when : always
82+ reports :
83+ cobertura : coverage.xml
84+ junit : report.xml
0 commit comments