-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #387 from marcinwrobel1986/386-Build-TriBITS-Docum…
…entation-with-Sphinx-and-ReadTheDocs Build and deploy TriBITS documentation with Sphinx (#386) This seems a good time to deploy.
- Loading branch information
Showing
25 changed files
with
1,126 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Deploy docs | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build-and-deploy-docs: | ||
|
||
runs-on: ubuntu-latest | ||
env: | ||
working-directory: ./tribits/doc/sphinx | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
architecture: 'x64' | ||
- name: Display Python version | ||
run: | | ||
python -c "import sys; print(sys.version)" | ||
python3 -c "import sys; print(sys.version)" | ||
- name: Install Python dependencies | ||
run: | | ||
pip3 install sphinx sphinx-rtd-theme | ||
- name: Build documentation | ||
working-directory: ${{env.working-directory}} | ||
run: python3 sphinx_rst_generator.py | ||
- name: Generate nojekyll file | ||
working-directory: ${{env.working-directory}}/combined_docs | ||
run: touch .nojekyll | ||
- name: Deploy docs | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: deploy-doc-site | ||
folder: ${{env.working-directory}}/combined_docs | ||
clean: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# @HEADER | ||
# ************************************************************************ | ||
# | ||
# TriBITS: Tribal Build, Integrate, and Test System | ||
# Copyright 2013 Sandia Corporation | ||
# | ||
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | ||
# the U.S. Government retains certain rights in this software. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are | ||
# met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# 3. Neither the name of the Corporation nor the names of the | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY | ||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE | ||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
# ************************************************************************ | ||
# @HEADER | ||
|
||
import os | ||
import sys | ||
|
||
testDocDir = os.path.dirname(os.path.abspath(__file__)) | ||
tribitsDir = os.path.abspath(os.path.join(testDocDir,"../../tribits")) | ||
docSphinxDir = os.path.join(tribitsDir,"doc","sphinx") | ||
pythonUtilsDir = os.path.join(tribitsDir,"python_utils") | ||
|
||
sys.path = [docSphinxDir, pythonUtilsDir] + sys.path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
This is a stand-in for the TribitsGuidesBody.rst file with indented includes. | ||
|
||
Something something: | ||
|
||
.. include:: ../../examples/TribitsExampleProject/ProjectName.cmake | ||
:literal: | ||
|
||
4) Add custom CTest -S driver scripts. | ||
|
||
For driving different builds and tests, one needs to set up one or more | ||
CTest -S driver scripts. There are various ways to do this but a simple | ||
approach that avoids duplication is to first create a file like | ||
``TribitsExampleProject/cmake/ctest/TribitsExProjCTestDriver.cmake``: | ||
|
||
.. include:: ../../examples/TribitsExampleProject/cmake/ctest/TribitsExProjCTestDriver.cmake | ||
:literal: | ||
|
||
and then create a set of CTest -S driver scripts that uses that file. One | ||
example is the file | ||
``TribitsExampleProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake``: | ||
|
||
.. include:: ../../examples/TribitsExampleProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake | ||
:literal: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# @HEADER | ||
# ************************************************************************ | ||
# | ||
# TriBITS: Tribal Build, Integrate, and Test System | ||
# Copyright 2013 Sandia Corporation | ||
# | ||
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, | ||
# the U.S. Government retains certain rights in this software. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are | ||
# met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# 3. Neither the name of the Corporation nor the names of the | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY | ||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE | ||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
# ************************************************************************ | ||
# @HEADER | ||
|
||
################################################# | ||
# Unit testing code for sphinx_rst_generator.py # | ||
################################################# | ||
|
||
import unittest | ||
|
||
from FindTestDocDir import * | ||
import sphinx_rst_generator as SRG | ||
|
||
|
||
# | ||
# Unit tests for sphinx_rst_generator.change_paths_and_get_includes() | ||
# | ||
|
||
|
||
tribitsGuideBodyCopied_expected = \ | ||
r"""This is a stand-in for the TribitsGuidesBody.rst file with indented includes. | ||
Something something: | ||
.. include:: ../copied_files/ProjectName.cmake | ||
:literal: | ||
4) Add custom CTest -S driver scripts. | ||
For driving different builds and tests, one needs to set up one or more | ||
CTest -S driver scripts. There are various ways to do this but a simple | ||
approach that avoids duplication is to first create a file like | ||
``TribitsExampleProject/cmake/ctest/TribitsExProjCTestDriver.cmake``: | ||
.. include:: ../copied_files/TribitsExProjCTestDriver.cmake | ||
:literal: | ||
and then create a set of CTest -S driver scripts that uses that file. One | ||
example is the file | ||
``TribitsExampleProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake``: | ||
.. include:: ../copied_files/ctest_serial_debug.cmake | ||
:literal: | ||
""" | ||
|
||
|
||
class test_change_paths_and_get_includes(unittest.TestCase): | ||
|
||
|
||
def test_1(self): | ||
src_file_path = os.path.join(testDocDir,'data') | ||
source_file = os.path.join(src_file_path,'TribitsGuidesBody.rst') | ||
start_path = os.path.join(tribitsDir,'doc','sphinx','users_guide') | ||
rst_dir = os.path.join(tribitsDir,'doc','sphinx','copied_files') | ||
(abs_path_str, include_file_list) = SRG.change_paths_and_get_includes( | ||
source_file=source_file, src_file_path=src_file_path, | ||
start_path=start_path, rst_dir=rst_dir, copy_file=True) | ||
#print("abs_path_str = "+str(abs_path_str)) | ||
#print("include_file_list = "+str(include_file_list)) | ||
self.maxDiff = None | ||
self.assertEqual(abs_path_str, tribitsGuideBodyCopied_expected) | ||
include_file_list_expected = set() | ||
self.assertEqual(include_file_list, include_file_list_expected) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.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) |
Empty file.
Oops, something went wrong.