.. _VIS/PipelineGraph: Pipeline Graph ############## The jobs of a workflow and their ``needs`` form a graph. The ``gha`` domain draws it in a Sphinx documentation, so the domain has to be enabled - see :ref:`GHA`. .. grid:: 2 .. grid-item:: :columns: 6 The ``gha:pipeline-graph`` directive draws the pipeline of a GitHub Actions workflow - its jobs and their ``needs`` - from the workflow file itself: * a job is a node labelled with its name and the file of the reusable workflow it calls; * a job running steps is a grey box with square corners; * a job with an ``if`` condition is dashed, and in HTML its tooltip is the condition; * a job with a ``strategy.matrix`` is a cluster of its instances, labelled with the matrix' dimensions; an instance calling a reusable workflow is drawn as the job calling it. A dynamic matrix - its combinations known at run time only - is one node with a double border; * a reusable workflow of another repository is a white leaf naming that repository and ref; * a reusable workflow of the documented repository is expanded into a cluster of its jobs, as many levels deep as ``:depth:`` says - the one an instance of a matrix calls as well; * the ``needs`` are the edges, without those a longer path implies. The workflow is read with :mod:`pyTooling.GitHub.WorkflowFile`, converted into a :mod:`pyTooling.CI` model and its :class:`~pyTooling.Graph.Graph` (:ref:`DATA/Workflow/Pipeline`), and drawn by :mod:`sphinx.ext.graphviz`. Every workflow file drawn becomes a dependency of the page. .. grid-item:: :columns: 6 .. code-block:: ReST .. gha:pipeline-graph:: Workflows/Pipeline.yml :depth: 1 :caption: The pipeline of Pipeline.yml. This is how the example renders, drawn from :download:`Workflows/Pipeline.yml` and :download:`Workflows/Test.yml`: .. gha:pipeline-graph:: Workflows/Pipeline.yml :depth: 1 :caption: The pipeline of Pipeline.yml. .. rst:directive:: .. gha:pipeline-graph:: Draws the workflow the argument names, relative to the document. .. rst:directive:option:: depth: Levels of reusable workflows of the documented repository to expand into clusters. Default: 0. .. rst:directive:option:: direction: LR | TB Whether the pipeline flows from left to right or from top to bottom. Default: ``LR``. .. rst:directive:option:: reduce: yes | no Whether an edge a longer path implies is dropped. Default: ``yes``. .. rst:directive:option:: link: yes | no Whether a job links to the page documenting its reusable workflow, in HTML. Default: ``yes``. .. rst:directive:option:: caption: A caption under the graph. .. rst:directive:option:: name: