From 85a38d98eaf12a22c0d429e8be1796dde1bb1d15 Mon Sep 17 00:00:00 2001 From: Scott Hussey Date: Mon, 30 Jul 2018 14:09:11 -0500 Subject: [PATCH] (zuul) Add doc build and publish jobs Add jobs to check that documents build on check and gate and add a webhook for publishing to readthedocs.io on post. Change-Id: Ie6221222ca7be56598c7c7189c9a32817e2c0f85 --- .gitignore | 1 + .zuul.yaml | 62 +++++++++++++++++++++++++++++++++ Makefile | 13 +++---- doc/requirements.txt | 2 ++ doc/source/conf.py | 6 ++-- gate/playbooks/doc-build.yaml | 23 ++++++++++++ gate/playbooks/doc-publish.yaml | 23 ++++++++++++ tox.ini | 15 ++++++++ 8 files changed, 134 insertions(+), 11 deletions(-) create mode 100644 .zuul.yaml create mode 100644 doc/requirements.txt create mode 100644 gate/playbooks/doc-build.yaml create mode 100644 gate/playbooks/doc-publish.yaml create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 218ae64..dbd8953 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ !/doc/source/_static/ /AUTHORS /ChangeLog +.tox diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..0c69786 --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,62 @@ +- project: + check: + jobs: + - airship-specs-doc-build + + gate: + jobs: + - airship-specs-doc-build + + post: + jobs: + - airship-specs-doc-publish + +- nodeset: + name: airship-specs-single-node + nodes: + - name: primary + label: ubuntu-xenial + +- job: + name: airship-specs-doc-build + description: | + Build documents locally to validate functionality + run: gate/playbooks/doc-build.yaml + timeout: 900 + nodeset: airship-specs-single-node + +- job: + name: airship-specs-doc-publish + description: | + Publish documentation on airship-specs.readthedocs.io + run: gate/playbooks/doc-publish.yaml + secrets: + - airship_specs_readthedocs + timeout: 300 + nodeset: airship-specs-single-node + +- secret: + name: airship_specs_readthedocs + data: + url: !encrypted/pkcs1-oaep + - w+FhusV0G8CTwapZN61r2y/X2hqy94gW8DocxV2voO/g0oNm+esDhDUxUR4Xa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sn2CM2II6BecLtVi3VQTBCVEGqo9JVqD8NU1dDz5arz56+p+QBLv4YpjhHLe4A3Z5FmOo + qYrJiRZpx0gVgxJiWx58XJJ3UvlN9LpjCxRoySlL9KPYJFzRmbDUSuduf9scJ5EbzsaQ/ + fIxmjGBs9LKjo+2wppRtabVQK+YyQ5KZW+fMzheAqwJt7uB1aJ5XMS8UZWDxH6/bgW8RH + MQK7Hi+9HD8GWsTm5YcdXuIZmhw27/iFoY0dcgBYiIrhMHwDXi9MzaZSfBeuzY= diff --git a/Makefile b/Makefile index 50bd7da..1e77038 100644 --- a/Makefile +++ b/Makefile @@ -2,19 +2,14 @@ # # You can set these variables from the command line. +# TODO: Incorporate these vars into tox file SPHINXOPTS = -a -E -W SPHINXBUILD = sphinx-build SPHINXPROJ = airship-specs SOURCEDIR = doc/source BUILDDIR = doc/build -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +docs: + tox -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file +%: docs diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..f6e8d8b --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,2 @@ +sphinx==1.7.6 +sphinx_rtd_theme==0.4.1 diff --git a/doc/source/conf.py b/doc/source/conf.py index 6bfbdef..119288f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -5,6 +5,7 @@ # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config +import sphinx_rtd_theme # -- Path setup -------------------------------------------------------------- @@ -74,7 +75,8 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = "sphinx_rtd_theme" +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -152,4 +154,4 @@ texinfo_documents = [ (master_doc, 'airship-specs', 'airship-specs Documentation', author, 'airship-specs', 'One line description of project.', 'Miscellaneous'), -] \ No newline at end of file +] diff --git a/gate/playbooks/doc-build.yaml b/gate/playbooks/doc-build.yaml new file mode 100644 index 0000000..b7e4459 --- /dev/null +++ b/gate/playbooks/doc-build.yaml @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Combine several test tasks into a single playbook +# to minimize Zuul node consumption + +- hosts: primary + tasks: + - name: Build documents locally + make: + chdir: "{{ zuul.project.src_dir }}" + target: docs + register: result + diff --git a/gate/playbooks/doc-publish.yaml b/gate/playbooks/doc-publish.yaml new file mode 100644 index 0000000..ee6dac7 --- /dev/null +++ b/gate/playbooks/doc-publish.yaml @@ -0,0 +1,23 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- hosts: primary + tasks: + - name: Publish current merged documents on readthedocs + no_log: true + uri: + method: 'POST' + body_format: 'json' + url: '{{ airship_specs_readthedocs.url | trim}}' + body: + token: '{{ airship_specs_readthedocs.token | trim }}' + register: result diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..2af17a6 --- /dev/null +++ b/tox.ini @@ -0,0 +1,15 @@ +[tox] +envlist = docs +skipsdist = True + +[testenv] +basepython=python3 +deps= + -rdoc/requirements.txt + +[testenv:docs] +whitelist_externals= + rm +commnds= + rm -rf doc/build + sphinx-build -b html doc/source doc/build -a -E -W