# Painless deployment with GitLab CI.
# Visit the docs at https://docs.gitlab.com/ce/ci/

.test: &test_template
  before_script:
  - pip install tox
  script: tox
{% for env in cookiecutter.tests.split(",") %}
test-{{ env }}:
  {% if env in ["flake8", "pylint", "behave"] -%}
  image: python:3.5
  {%- elif env|truncate(2, end="") == "py" -%}
  image: {{ env|replace("py", "python:", 1)|replace("27", "2.7")|replace("33", "3.3")|replace("34", "3.4")|replace("35", "3.5")|replace("python:py", "pypy:2") }}
  {%- endif %}
  variables:
    TOXENV: {{ env }}
  <<: *test_template
{%- endfor %}

staging:
  type: deploy
  script:
  - echo 'This build would deploy to Staging now.'
  only:
  - master

production:
  type: deploy
  script:
  - echo 'This build would deploy to Production now.'
  only:
  - tags

# Painless deployment with GitLab CI.
# Visit the docs at https://docs.gitlab.com/ce/ci/

.test: &test_template
  before_script:
  - pip install tox
  script: tox
{% for env in cookiecutter.tests.split(",") %}
test-{{ env }}:
  {% if env in ["flake8", "pylint", "behave"] -%}
  image: python:3.5
  {%- elif env|truncate(2, True, "", 0) == "py" -%}
  image: {{ env|replace("py", "python:", 1)|replace("27", "2.7")|replace("33", "3.3")|replace("34", "3.4")|replace("35", "3.5")|replace("python:py", "pypy:2") }}
  {%- endif %}
  variables:
    TOXENV: {{ env }}
  <<: *test_template
{%- endfor %}

staging:
  type: deploy
  script:
  - echo 'This build would deploy to Staging now.'
  only:
  - master

production:
  type: deploy
  script:
  - echo 'This build would deploy to Production now.'
  only:
  - tags

Fix backwards-incompatible change in Jinja2 truncate filter
Fix backwards-incompatible change in Jinja2 truncate filter

See Jinja2 PR #610, https://github.com/pallets/jinja/pull/610

leeway parameter default value allows env string not to be cut off
