- job:
    name: horizon-tox-python3-django
    abstract: true
    parent: horizon-openstack-tox-base
    description: |
      Run tox with different Django version.

      .. zuul:jobvar: tox_envlist

         Which tox environment to run

      .. zuul:jobvar: django_version

         Django version to be used.
         pip version specifier like ``>=4.2,<4.3`` should be passed.

    pre-run: playbooks/horizon-tox-django/pre.yaml
    run: playbooks/horizon-tox-django/run.yaml
    vars:
      tox_envlist: py312
      # The following should match the base openstack-tox-pyNN job.
      bindep_profile: test py312
      python_version: "3.12"
    required-projects:
      - name: openstack/horizon

# Let's keep at least one job definition as a template even when we support
# only one version of Django covered by the default job.
- job:
    name: horizon-tox-python3-django42
    parent: horizon-tox-python3-django
    vars:
      django_version: '>=4.2,<4.3'

- project-template:
    name: horizon-non-primary-django-jobs
    description: |
      Run unit tests with non-primary Django versions.
    check:
      jobs:
        # We specify a job in openstack-python3-jobs(-horizon) as a
        # sentinel to make this project template valid even when we support
        # only one version of Django used as the default.  Zuul project
        # template configuration requires at least one job included.
        - openstack-tox-py312
        # Let's keep at least one job as a template even when we support
        # only one version of Django covered by the default job.
        # Just comment it out for such case.
        - horizon-tox-python3-django42
    gate:
      jobs:
        # Default python job in openstack-python3-antelope-jobs(-horizon)
        - openstack-tox-py312
        - horizon-tox-python3-django42
