- job:
    name: tox
    parent: unittests
    description: |
      Base job containing setup and teardown for tox-based test jobs.

      This performs basic host and general project setup tasks common
      to all tox unit test jobs.

      Responds to these variables:

      .. zuul:jobvar:: tox_envlist

         Use the specified tox environments (``ALL`` selects all).

      .. zuul:jobvar:: tox_environment
         :type: dict

         Environment variables to pass in to the tox run.

      .. zuul:jobvar:: tox_extra_args

         String containing extra arguments to append to the tox command line.

      .. zuul:jobvar:: tox_constraints_file

         Path to a pip constraints file. Will be provided to tox in the
         TOX_CONSTRAINTS_FILE environment variable if it exists.

      .. zuul:jobvar:: tox_install_siblings
         :default: true

         Override tox requirements that have corresponding zuul git repos
         on the node by installing the git versions into the tox virtualenv.

      .. zuul:jobvar:: tox_install_bindep
         :default: true

         Whether or not to run the binary dependencies detection and
         installation with bindep.
    run: playbooks/tox/run.yaml
    pre-run: playbooks/tox/pre.yaml
    post-run: playbooks/tox/post.yaml
    vars:
      tox_environment:
        NOSE_WITH_HTML_OUTPUT: 1
        NOSE_HTML_OUT_FILE: nose_results.html
        NOSE_WITH_XUNIT: 1

- job:
    name: tox-fips
    parent: unittests-fips
    description: |
      Base job containing setup and teardown for fips and tox-based test jobs.

      This performs basic host and general project setup tasks common
      to all tox unit test jobs related to fips.

      Responds to these variables:

      .. zuul:jobvar:: tox_envlist

         Use the specified tox environments (``ALL`` selects all).

      .. zuul:jobvar:: tox_environment
         :type: dict

         Environment variables to pass in to the tox run.

      .. zuul:jobvar:: tox_extra_args

         String containing extra arguments to append to the tox command line.

      .. zuul:jobvar:: tox_constraints_file

         Path to a pip constraints file. Will be provided to tox in the
         TOX_CONSTRAINTS_FILE environment variable if it exists.

      .. zuul:jobvar:: tox_install_siblings
         :default: true

         Override tox requirements that have corresponding zuul git repos
         on the node by installing the git versions into the tox virtualenv.

      .. zuul:jobvar:: tox_install_bindep
         :default: true

         Whether or not to run the binary dependencies detection and
         installation with bindep.
    run: playbooks/tox/run.yaml
    pre-run: playbooks/tox/pre.yaml
    post-run: playbooks/tox/post.yaml
    vars:
      tox_environment:
        NOSE_WITH_HTML_OUTPUT: 1
        NOSE_HTML_OUT_FILE: nose_results.html
        NOSE_WITH_XUNIT: 1

- job:
    name: tox-py27
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 2.7.

      Uses tox with the ``py27`` environment.
    vars:
      tox_envlist: py27
      python_version: "2.7"

- job:
    name: tox-py34
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.4.

      Uses tox with the ``py34`` environment.

      Changes to the zuul-jobs collection are no longer regression tested with
      Python 3.4, but this job definition is being retained for backward
      compatibility.
    vars:
      tox_envlist: py34
      python_version: "3.4"

- job:
    name: tox-py35
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.5.

      Uses tox with the ``py35`` environment.

      Changes to the zuul-jobs collection are no longer regression tested with
      Python 3.5, but this job definition is being retained for backward
      compatibility.
    vars:
      tox_envlist: py35
      python_version: "3.5"

- job:
    name: tox-py36
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.6.

      Uses tox with the ``py36`` environment.
    vars:
      tox_envlist: py36
      python_version: "3.6"

- job:
    name: tox-py37
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.7.

      Uses tox with the ``py37`` environment.
    vars:
      tox_envlist: py37
      python_version: "3.7"

- job:
    name: tox-py38
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.8.

      Uses tox with the ``py38`` environment.
    vars:
      tox_envlist: py38
      python_version: "3.8"

- job:
    name: tox-py39
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.9.

      Uses tox with the ``py39`` environment.
    vars:
      tox_envlist: py39
      python_version: "3.9"

- job:
    name: tox-py310
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.10.

      Uses tox with the ``py310`` environment.
    vars:
      tox_envlist: py310
      python_version: "3.10"

- job:
    name: tox-py311
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.11.

      Uses tox with the ``py311`` environment.
    vars:
      tox_envlist: py311
      python_version: "3.11"

- job:
    name: tox-py312
    parent: tox
    description: |
      Run unit tests for a Python project under cPython version 3.12.

      Uses tox with the ``py312`` environment.
    vars:
      tox_envlist: py312
      python_version: "3.12"

- job:
    name: tox-docs
    # This is not parented to tox since we do not need
    # the roles from its parent unittests.
    description: |
      Run documentation unit tests.

      Uses tox with the ``docs`` environment.
    vars:
      tox_envlist: docs
      bindep_profile: compile doc
    run: playbooks/tox/run.yaml
    pre-run:
      - playbooks/tox-docs/pre.yaml
      - playbooks/tox/pre.yaml
    post-run:
      - playbooks/tox/docs-post.yaml
      - playbooks/tox/post.yaml

- job:
    name: tox-linters
    parent: tox
    description: |
      Runs code linting tests.

      Uses tox with the ``linters`` environment.
    vars:
      tox_envlist: linters
      test_setup_skip: true

- job:
    name: tox-molecule
    parent: tox
    pre-run: playbooks/tox/pre-molecule.yaml
    description: |
      Runs Ansible molecule testing on a system where docker is available.

      Uses tox with the ``molecule`` environment.
    vars:
      tox_envlist: molecule

- job:
    name: tox-pep8
    parent: tox
    description: |
      Runs code pep8 tests.

      Uses tox with the ``pep8`` environment.
    vars:
      tox_envlist: pep8
      test_setup_skip: true

- job:
    name: tox-cover
    parent: tox
    description: |
      Run code coverage tests.

      Uses tox with the ``cover`` environment.
    post-run: playbooks/tox/cover-post.yaml
    vars:
      tox_envlist: cover

- job:
    name: tox-bashate
    parent: tox
    description: |
      Run bashate tests.

      Uses tox with the ``bashate`` environment.
    vars:
      tox_envlist: bashate

- job:
    name: tox-nodejs-npm
    parent: tox
    description: |
      Run tests using tox but with the javascript toolchain installed
      and available as well. A combination of the tox and nodejs-npm
      jobs. By default will run npm before running the tox environment listed.

      Responds to these variables:

      .. zuul:jobvar:: tox_envlist

         Use the specified tox environments (``ALL`` selects all).

      .. zuul:jobvar:: tox_environment
         :type: dict

         Environment variables to pass in to the tox run.

      .. zuul:jobvar:: tox_extra_args

         String containing extra arguments to append to the tox command line.

      .. zuul:jobvar:: tox_constraints_file

         Path to a pip constraints file. Will be provided to tox in the
         TOX_CONSTRAINTS_FILE environment variable if it exists.

      .. zuul:jobvar:: tox_install_siblings
         :default: true

         Override tox requirements that have corresponding zuul git repos
         on the node by installing the git versions into the tox virtualenv.

      .. zuul:jobvar:: npm_command
         :default: build

         Command to pass to npm.

      .. zuul:jobvar:: node_version
         :default: 14

         The version of Node to use.

      .. zuul:jobvar:: javascript_content_dir
         :default: dist

         Directory, relative to zuul_work_dir, holding build content.

      .. zuul:jobvar:: zuul_work_dir
         :default: {{ zuul.project.src_dir }}

         Path to operate in.
    pre-run: playbooks/javascript/pre.yaml
    run: playbooks/tox/npm.yaml
    post-run: playbooks/javascript/post.yaml
    vars:
      npm_command: build

- job:
    name: nox
    parent: unittests
    description: |
      Base job containing setup and teardown for nox-based test jobs.

      This performs basic host and general project setup tasks common
      to all nox unit test jobs.

      Responds to these variables:

      .. zuul:jobvar:: nox_session

         Use the specified nox sessions

      .. zuul:jobvar:: nox_keyword

         Use the specified nox keyword

      .. zuul:jobvar:: nox_tag

         Use the specified nox tag

      .. zuul:jobvar:: nox_force_python

         Force nox to run the selected sessions under this version of python.

      .. zuul:jobvar:: nox_config_file

         Override the default noxfile.py configuration path.

      .. zuul:jobvar:: nox_environment
         :type: dict

         Environment variables to pass in to the nox run.
         Nox behaves differently when CI=1 is set. Consider setting this
         if you override the role defaults.

      .. zuul:jobvar:: nox_extra_args

         String containing extra arguments to append to the nox command line.

      .. zuul:jobvar:: nox_constraints_file

         Path to a pip constraints file. Will be provided to nox in the
         NOX_CONSTRAINTS_FILE environment variable if it exists.

      .. zuul:jobvar:: nox_install_siblings
         :default: true

         Override nox requirements that have corresponding zuul git repos
         on the node by installing the git versions into the nox virtualenv.

      .. zuul:jobvar:: nox_install_bindep
         :default: true

         Whether or not to run the binary dependencies detection and
         installation with bindep.
    run: playbooks/nox/run.yaml
    pre-run: playbooks/nox/pre.yaml

- job:
    name: nox-py36
    parent: nox
    description: |
      Run unit tests for a Python project under cPython version 3.6.

      Uses nox with the ``test`` keyword forcing python 3.6.
    vars:
      nox_keyword: tests
      nox_force_python: "3.6"
      python_version: "3.6"

- job:
    name: nox-py37
    parent: nox
    description: |
      Run unit tests for a Python project under cPython version 3.7.

      Uses nox with the ``test`` keyword forcing python 3.7.
    vars:
      nox_keyword: tests
      nox_force_python: "3.7"
      python_version: "3.7"

- job:
    name: nox-py38
    parent: nox
    description: |
      Run unit tests for a Python project under cPython version 3.8.

      Uses nox with the ``test`` keyword forcing python 3.8.
    vars:
      nox_keyword: tests
      nox_force_python: "3.8"
      python_version: "3.8"

- job:
    name: nox-py39
    parent: nox
    description: |
      Run unit tests for a Python project under cPython version 3.9.

      Uses nox with the ``test`` keyword forcing python 3.9.
    vars:
      nox_keyword: tests
      nox_force_python: "3.9"
      python_version: "3.9"

- job:
    name: nox-py310
    parent: nox
    description: |
      Run unit tests for a Python project under cPython version 3.10.

      Uses nox with the ``test`` keyword forcing python 3.10.
    vars:
      nox_keyword: tests
      nox_force_python: "3.10"
      python_version: "3.10"

- job:
    name: nox-py311
    parent: nox
    description: |
      Run unit tests for a Python project under cPython version 3.11.

      Uses nox with the ``test`` keyword forcing python 3.11.
    vars:
      nox_keyword: tests
      nox_force_python: "3.11"
      python_version: "3.11"

- job:
    name: nox-py312
    parent: nox
    description: |
      Run unit tests for a Python project under cPython version 3.12.

      Uses nox with the ``test`` keyword forcing python 3.12.
    vars:
      nox_keyword: tests
      nox_force_python: "3.12"
      python_version: "3.12"

- job:
    name: nox-cover
    parent: nox
    description: |
      Run code coverage tests.

      Uses nox with the ``cover`` keyword.
    post-run: playbooks/nox/cover-post.yaml
    vars:
      nox_keyword: cover

- job:
    name: nox-linters
    parent: nox
    description: |
      Runs code linting tests.

      Uses nox with the ``linters`` keyword.
    vars:
      nox_keyword: linters
      test_setup_skip: true

- job:
    name: nox-docs
    # This is not parented to nox since we do not need
    # the roles from its parent unittests.
    description: |
      Run documentation unit tests.

      Uses nox with the ``docs`` keyword.
    vars:
      nox_keyword: docs
      bindep_profile: compile doc
    run: playbooks/nox/run.yaml
    pre-run:
      - playbooks/nox/docs-pre.yaml
      - playbooks/nox/pre.yaml
    post-run:
      - playbooks/nox/docs-post.yaml

- job:
    name: build-python-release
    description: |
      Build a source tarball and a bdist wheel for uploading.
    pre-run: playbooks/python/pre.yaml
    run: playbooks/python/release.yaml
    post-run: playbooks/python/tarball-post.yaml

- job:
    name: python-upload-pypi
    parent: build-python-release
    description: |
      Generate and upload a python source tarball and binary wheel

      Requires a variable ``pypi_info`` be set which is a dict
      containing authentication values.  See
      `<https://zuul-ci.org/docs/zuul-jobs/python-roles.html#role-upload-pypi>`__
    post-run: playbooks/python/upload-pypi.yaml

- job:
    name: build-sphinx-docs
    description: |
      Build documentation using Sphinx

      Additional requirements can be provided in a project in either the
      file ``doc/requirements.txt`` or ``test-requirements.txt``. (The first
      file found in that order will be the one used) Non-python distro
      requirements can be specified in ``bindep.txt`` using the ``doc`` tag.

      Runs `whereto https://docs.openstack.org/whereto/latest/` after the build
      if it is installed.

      Responds to these variables:

      .. zuul:jobvar:: constraints_file

         Optional path to a pip constraints file for installing python
         libraries.

      .. zuul:jobvar:: sphinx_python
         :default: python2

         Version of python to use, either ``python2`` or ``python3``.

      .. zuul:jobvar:: zuul_work_dir
         :default: {{ zuul.project.src_dir }}

         Directory to operate in.
    pre-run: playbooks/sphinx/pre.yaml
    run: playbooks/sphinx/run.yaml
    post-run: playbooks/sphinx/post.yaml

- job:
    name: build-reno-releasenotes
    description: |
      Build releasenotes using reno

      Additional requirements can be provided in a project in either the
      file ``doc/requirements.txt`` or ``test-requirements.txt``. (The first
      file found in that order will be the one used) Non-python distro
      requirements can be specified in ``bindep.txt`` using the ``doc`` tag.

      Responds to these variables:

      .. zuul:jobvar:: constraints_file

         Optional path to a pip constraints file for installing python
         libraries.

      .. zuul:jobvar:: sphinx_python
         :default: python2

         Version of python to use, either ``python2`` or ``python3``.

      .. zuul:jobvar:: zuul_work_dir
         :default: {{ zuul.project.src_dir }}

         Directory to operate in.
    # Release notes always build on master.
    override-checkout: master
    pre-run: playbooks/releasenotes/pre.yaml
    run: playbooks/releasenotes/run.yaml
    post-run: playbooks/releasenotes/post.yaml
    files:
      - ^releasenotes/.*
      - bindep.txt
      - doc/requirements.txt
      - test-requirements.txt
      - tox.ini

- job:
    name: markdownlint
    files: '^.*\.md$'
    pre-run: playbooks/markdownlint/pre.yaml
    run: playbooks/markdownlint/run.yaml
    post-run: playbooks/markdownlint/post.yaml
    description: |
      Check any markdown for basic lint problems. Include a file named
      `.markdownlint.json` that is configured according to
      https://github.com/DavidAnson/markdownlint#optionsconfig
      to control rule specifics.
    vars:
      node_version: 18