From 0e9920b19029c5e73030ace21a7bb52ffbc389aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Fri, 6 Nov 2020 21:42:12 +0100 Subject: [PATCH] Build sphinx doc as part of ci --- .github/workflows/github-actions.yml | 34 ++++++++++++++++++++++------ docs/Makefile | 6 +++++ docs/conf.py | 2 +- docs/requirements.txt | 4 ++-- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 52a93f97..d56e4c3a 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -66,6 +66,22 @@ jobs: - name: Run test suite run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- -a "--cov=mongoengine" + build_doc_dryrun: + # ensures that readthedocs can be built continuously + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - run: | + pip install -e . + pip install -r docs/requirements.txt + - run: | + cd docs + make html-readthedocs + irc_notification: runs-on: ubuntu-latest needs: [linting, test] @@ -89,14 +105,18 @@ jobs: python-version: 3.7 # todo separate build from publish # https://stackoverflow.com/questions/59349905/which-properties-does-github-event-in-a-github-workflow-have - - run: | + - name: build dummy wheel for test-pypi + run: | pip install wheel - python setup.py sdist bdist_wheel - - uses: pypa/gh-action-pypi-publish@master + python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel +# python setup.py sdist bdist_wheel + - name: publish test-pypi + uses: pypa/gh-action-pypi-publish@master with: password: ${{ secrets.test_pypi_password }} repository_url: https://test.pypi.org/legacy/ - - uses: pypa/gh-action-pypi-publish@master - if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') - with: - password: ${{ secrets.pypi_password }} +# - name: publish pypi +# uses: pypa/gh-action-pypi-publish@master +# if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') +# with: +# password: ${{ secrets.pypi_password }} diff --git a/docs/Makefile b/docs/Makefile index cdc77c36..0bf35356 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -35,6 +35,12 @@ html: @echo @echo "Build finished. Check $(BUILDDIR)/html/index.html" +html-readthedocs: + $(SPHINXBUILD) -T -E -b readthedocs $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + + dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo diff --git a/docs/conf.py b/docs/conf.py index f8a4999a..808deaa8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ sys.path.insert(0, os.path.abspath("..")) # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ["sphinx.ext.autodoc", "sphinx.ext.todo"] +extensions = ["sphinx.ext.autodoc", "sphinx.ext.todo", "readthedocs_ext.readthedocs"] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/requirements.txt b/docs/requirements.txt index abd12629..dfda6a70 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ -pymongo>=3.11 -Sphinx==3.2.1 +Sphinx==3.3.0 sphinx-rtd-theme==0.5.0 +readthedocs-sphinx-ext==2.1.1