From 75a4bddc255c2a630a60f81b46a70f2d64defefd Mon Sep 17 00:00:00 2001
From: Tin Lam <tin@irrational.io>
Date: Fri, 11 Dec 2020 12:19:19 -0600
Subject: [PATCH] feat(docs): adds documentation job

This adds a document zuul job and a base docs folder for technical
docs, user guides, etc. to the repository. This also publish the
documentation as part of promote-airship-project-docs.

Signed-off-by: Tin Lam <tin@irrational.io>
Change-Id: I6dd049bdc7454355440fcb28ade7a36f0810857a
---
 .gitignore                         |  4 ++
 doc/requirements.txt               |  7 ++++
 doc/source/_static/.placeholder    |  0
 doc/source/_templates/.placeholder |  0
 doc/source/conf.py                 | 65 ++++++++++++++++++++++++++++++
 doc/source/index.rst               | 20 +++++++++
 tox.ini                            | 18 +++++++++
 zuul.d/project.yaml                |  7 ++++
 8 files changed, 121 insertions(+)
 create mode 100644 doc/requirements.txt
 create mode 100644 doc/source/_static/.placeholder
 create mode 100644 doc/source/_templates/.placeholder
 create mode 100644 doc/source/conf.py
 create mode 100644 doc/source/index.rst
 create mode 100644 tox.ini

diff --git a/.gitignore b/.gitignore
index 9f26ce61..e7948523 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
 **.tgz
+
+# doc build environment and artifacts
+doc/build
+.tox/
diff --git a/doc/requirements.txt b/doc/requirements.txt
new file mode 100644
index 00000000..fde74626
--- /dev/null
+++ b/doc/requirements.txt
@@ -0,0 +1,7 @@
+# Documentation
+sphinx>3.2.0
+oslosphinx>=4.7.0  # Apache-2.0
+sphinx_rtd_theme
+
+# Sphinx markdown extension
+recommonmark
diff --git a/doc/source/_static/.placeholder b/doc/source/_static/.placeholder
new file mode 100644
index 00000000..e69de29b
diff --git a/doc/source/_templates/.placeholder b/doc/source/_templates/.placeholder
new file mode 100644
index 00000000..e69de29b
diff --git a/doc/source/conf.py b/doc/source/conf.py
new file mode 100644
index 00000000..9d0af1bd
--- /dev/null
+++ b/doc/source/conf.py
@@ -0,0 +1,65 @@
+# Configuration file for the Sphinx documentation builder.
+#
+# This file only contains a selection of the most common options. For a full
+# list see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
+
+# -- Path setup --------------------------------------------------------------
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#
+# import os
+# import sys
+# sys.path.insert(0, os.path.abspath('.'))
+import sphinx_rtd_theme
+
+# -- Project information -----------------------------------------------------
+
+project = 'airship-charts'
+copyright = '2020, Airship Charts Authors'
+author = 'Airship Charts Authors'
+
+
+# -- General configuration ---------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+    'recommonmark'
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path.
+exclude_patterns = []
+
+
+# -- Options for HTML output -------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+#
+html_theme = "sphinx_rtd_theme"
+html_theme_options = {
+    'display_version': False,
+}
+html_show_sourcelink = False
+html_show_sphinx = False
+html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Source files
+source_suffix = {
+    '.rst': 'restructuredtext',
+    '.md': 'markdown',
+}
diff --git a/doc/source/index.rst b/doc/source/index.rst
new file mode 100644
index 00000000..f7c6ccac
--- /dev/null
+++ b/doc/source/index.rst
@@ -0,0 +1,20 @@
+.. airship-charts documentation master file, created by
+   sphinx-quickstart on Fri Dec 11 11:59:00 2020.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to airship-charts's documentation!
+==========================================
+
+.. toctree::
+   :maxdepth: 2
+   :caption: Contents:
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 00000000..4618a237
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,18 @@
+[tox]
+minversion = 3.2.0
+skipsdist = True
+envlist = docs
+
+[testenv]
+basepython = python3
+setenv = VIRTUAL_ENV={envdir}
+passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
+
+[testenv:docs]
+basepython = python3
+whitelist_externals = rm
+deps =
+  -r{toxinidir}/doc/requirements.txt
+commands =
+  rm -rf doc/build
+  sphinx-build -W -b html doc/source doc/build/html
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index e9a152b4..2e7c9ba1 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -13,12 +13,19 @@
 - project:
     check:
       jobs:
+        - openstack-tox-docs: &docs
+            files:
+              - ^doc/.*$
         - airship-charts-lint-and-build
         - airship-harbor-tekton
     gate:
       jobs:
+        - openstack-tox-docs: *docs
         - airship-charts-lint-and-build
         - airship-harbor-tekton
     post:
       jobs:
         - airship-charts-upload-git-mirror
+    promote:
+      jobs:
+        - promote-airship-project-docs: *docs