For a number of years I have been concerned about the duplication of work having to maintain continuous integration environments both on Travis-CI to run the unit tests and on Readthedocs to build and host the documentation.
The solution I am proposing is to use Github actions to replace both systems. I chose Github actions instead of Travis-CI because they are easier to configure, have better log-viewing interface and surprisingly enough they are better integrated with Github!
The biggest hurdle was to find a way to reproduce the capability of readthedocs
to host multiple versions of the documentation together, fortunately the sphinx-multiversion
gives a very similar functionality.
Next I’ll be sharing an example configuration for Github
actions that integrates:
- Installs requirements both via the package manager and
pip
- Build and run unit tests for Python 3.6 and 3.7
- Just with Python 3.6, installs
sphinx-multiversion
, builds the docs for all tagged releases, pushes that to the documentation repository
Requirements
Create a
docs/requirements.txt
file which includessphinx-multiversion
, I directly usehttps://github.com/Holzhaus/sphinx-multiversion/archive/master.zip
Follow the
sphinx-multiversion
documentation to configuredocs/conf.py
, for example my configuration is:```
Sphinx multiversion configuration
extensions += [“sphinx_multiversion”]
templates_path = [ “_templates”, ] #html_sidebars = {’**’: [ # “versioning.html”, # ]}