From 50f3768cb7684bebd49cdbedaebd32307a9e97c5 Mon Sep 17 00:00:00 2001 From: Philipp Arras <parras@mpa-garching.mpg.de> Date: Sat, 12 Jun 2021 12:58:52 +0200 Subject: [PATCH] Add documentation build --- .gitlab-ci.yml | 22 ++++++++++++++++------ Dockerfile | 3 ++- docs/generate.sh | 2 ++ docs/source/conf.py | 27 +++++++++++++++++++++++++++ docs/source/index.rst | 17 +++++++++++++++++ 5 files changed, 64 insertions(+), 7 deletions(-) create mode 100755 docs/generate.sh create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c3a1314..508ab4f6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,7 @@ variables: stages: - build_docker - testing + - release build_docker_from_scratch: only: @@ -31,10 +32,12 @@ build_docker_from_cache: - docker build -t $CONTAINER_TEST_IMAGE . - docker push $CONTAINER_TEST_IMAGE +before_script: + - pip3 install --user . + mytest: stage: testing script: - - pip3 install . - pytest-3 -q --cov=resolve test coverage: '/^TOTAL.+?(\d+\%)$/' @@ -43,10 +46,17 @@ test_mpi: variables: OMPI_MCA_btl_vader_single_copy_mechanism: none script: - - pip3 install . - mpiexec -n 2 --bind-to none pytest-3 -q test/test_mpi -# staticchecks: -# stage: testing -# script: -# - flake8 . +pages: + stage: release + script: + - rm -rf docs/build docs/source/mod + - sh docs/generate.sh + - mv docs/build public + artifacts: + paths: + - public +# only: +# - master + diff --git a/Dockerfile b/Dockerfile index 49c98916..fca71598 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,8 @@ RUN pip3 install astropy RUN apt-get install -qq python3-mpi4py # Testing dependencies RUN apt-get install -qq python3-pytest-cov -RUN pip3 install flake8 +# Documentation dependencies +RUN apt-get install -qq python3-sphinx-rtd-theme # Create user (openmpi does not like to be run as root) RUN useradd -ms /bin/bash testinguser diff --git a/docs/generate.sh b/docs/generate.sh new file mode 100755 index 00000000..12eb53a4 --- /dev/null +++ b/docs/generate.sh @@ -0,0 +1,2 @@ +sphinx-apidoc -e -o docs/source/mod resolve +sphinx-build -b html docs/source/ docs/build/ diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 00000000..e4563b2c --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,27 @@ +extensions = [ + 'sphinx.ext.napoleon', # Support for NumPy and Google style docstrings + 'sphinx.ext.imgmath', # Render math as images + 'sphinx.ext.viewcode' # Add links to highlighted source code +] +master_doc = 'index' + +napoleon_google_docstring = False +napoleon_numpy_docstring = True +napoleon_use_ivar = True +napoleon_use_admonition_for_notes = True +napoleon_use_admonition_for_examples = True +napoleon_use_admonition_for_references = True +napoleon_include_special_with_doc = True + +project = u'resolve' +copyright = u'2019-2021, Max-Planck-Society' +author = u'Philipp Arras' + +# FIXME release = resolve.version.__version__ +# FIXME version = release[:-2] + +language = None +exclude_patterns = [] +add_module_names = False + +html_theme = "sphinx_rtd_theme" diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 00000000..dcfbb0f9 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,17 @@ +Resolve +======= + +Resolve is a Bayesian radio imaging algorithm. + +References +---------- + +FIXME + +Contents +........ + +.. toctree:: + :maxdepth: 2 + + Package Documentation <mod/resolve> -- GitLab