1*d6050574SRomain Jobredeaux# rules_testing docs generation 2*d6050574SRomain Jobredeaux 3*d6050574SRomain JobredeauxThe docs for rules_testing are generated using a combination of Sphinx, Bazel, 4*d6050574SRomain Jobredeauxand Readthedocs.org. The Markdown files in source control are unlikely to render 5*d6050574SRomain Jobredeauxproperly without the Sphinx processing step because they rely on Sphinx and 6*d6050574SRomain JobredeauxMyST-specific Markdown functionalit. 7*d6050574SRomain Jobredeaux 8*d6050574SRomain JobredeauxThe actual sources that Sphinx consumes are in the docs/source directory. 9*d6050574SRomain Jobredeaux 10*d6050574SRomain JobredeauxManually building the docs isn't necessary -- readthedocs.org will 11*d6050574SRomain Jobredeauxautomatically build and deploy them when commits are pushed to the repo. 12*d6050574SRomain Jobredeaux 13*d6050574SRomain Jobredeaux## Generating docs for development 14*d6050574SRomain Jobredeaux 15*d6050574SRomain JobredeauxTo generate docs for development/preview purposes, install 16*d6050574SRomain Jobredeaux[ibazel](https://github.com/bazelbuild/bazel-watcher)[^ibazel] and run: 17*d6050574SRomain Jobredeaux 18*d6050574SRomain Jobredeaux``` 19*d6050574SRomain Jobredeauxibazel run //docs:run_sphinx_build 20*d6050574SRomain Jobredeaux``` 21*d6050574SRomain Jobredeaux 22*d6050574SRomain JobredeauxThis will build the docs and start a local webserver at http://localhost:8000 23*d6050574SRomain Jobredeauxwhere you can view the output. As you edit files, ibazel will detect the file 24*d6050574SRomain Jobredeauxchanges and re-run the build process, and you can simply refresh your browser to 25*d6050574SRomain Jobredeauxsee the changes. 26*d6050574SRomain Jobredeaux 27*d6050574SRomain Jobredeaux## MyST Markdown flavor 28*d6050574SRomain Jobredeaux 29*d6050574SRomain JobredeauxSphinx is configured to parse Markdown files using MyST, which is a more 30*d6050574SRomain Jobredeauxadvanced flavor of Markdown that supports most features of restructured text and 31*d6050574SRomain Jobredeauxintegrates with Sphinx functionality such as automatic cross references, 32*d6050574SRomain Jobredeauxcreating indexes, and using concise markup to generate rich documentation. 33*d6050574SRomain Jobredeaux 34*d6050574SRomain JobredeauxMyST features and behaviors are controlled by the Sphinx configuration file, 35*d6050574SRomain Jobredeaux`docs/source/conf.py`. For more info, see https://myst-parser.readthedocs.io. 36*d6050574SRomain Jobredeaux 37*d6050574SRomain Jobredeaux## Sphinx configuration 38*d6050574SRomain Jobredeaux 39*d6050574SRomain JobredeauxThe Sphinx-specific configuration files and input doc files live in 40*d6050574SRomain Jobredeauxdocs/source -- anything under this directory will be treated by Sphinx as 41*d6050574SRomain Jobredeauxsomething it should create documentation for. 42*d6050574SRomain Jobredeaux 43*d6050574SRomain JobredeauxThe Sphinx configuration is `docs/source/conf.py`. See 44*d6050574SRomain Jobredeauxhttps://www.sphinx-doc.org/ for details about the configuration file. 45*d6050574SRomain Jobredeaux 46*d6050574SRomain Jobredeaux## Readthedocs configuration 47*d6050574SRomain Jobredeaux 48*d6050574SRomain JobredeauxThere's two basic parts to the readthedocs configuration: 49*d6050574SRomain Jobredeaux 50*d6050574SRomain Jobredeaux* `.readthedocs.yaml`: This configuration file controls most settings, such as 51*d6050574SRomain Jobredeaux the OS version used to build, Python version, dependencies, what Bazel 52*d6050574SRomain Jobredeaux commands to run, etc. 53*d6050574SRomain Jobredeaux* https://readthedocs.org/projects/rules-testing: This is the project 54*d6050574SRomain Jobredeaux administration page. While most settings come from the config file, this 55*d6050574SRomain Jobredeaux controls additional settings such as permissions, what versions are 56*d6050574SRomain Jobredeaux published, when to publish changes, etc. 57*d6050574SRomain Jobredeaux 58*d6050574SRomain JobredeauxFor more readthedocs configuration details, see docs.readthedocs.io. 59*d6050574SRomain Jobredeaux 60*d6050574SRomain JobredeauxOf particular note, `//docs:requirements.txt` is used by readthedocs for 61*d6050574SRomain Jobredeauxspecifying Python dependencies (including Sphinx version). 62*d6050574SRomain Jobredeaux 63*d6050574SRomain Jobredeaux[^ibazel]: Quick install: `npm install -g @bazel/ibazel` 64