Skip to content

Commit b41118b

Browse files
authored
Docs automation
1 parent 3aec70d commit b41118b

File tree

37 files changed

+2709
-1163
lines changed

37 files changed

+2709
-1163
lines changed

.github/workflows/pages.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "CI Docs"
2+
3+
on:
4+
push:
5+
branches:
6+
- latest
7+
tags:
8+
- '**'
9+
jobs:
10+
release:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
persist-credentials: false
18+
fetch-depth: 0
19+
- name: Set up Python
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: 3.7
23+
- name: Set up Doxygen
24+
run: sudo apt-get install doxygen
25+
- name: Build Sphinx docs
26+
run: |
27+
export PATH=$PATH:~/.local/bin
28+
cd docs
29+
make multiversion
30+
- name: Deploy
31+
run : ./docs/_utils/deploy.sh
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
LATEST_VERSION: latest

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ testing/
44
.settings
55
.classpath
66
.project
7-
doc
8-
docs
7+
docs/_build
8+
docs/_source
9+
html
10+
latex
911
notes
1012
.DS_Store
1113

README-dev.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Building the Docs
2+
=================
3+
4+
*Note*: The docs build instructions have been tested with Sphinx 2.4.4 and Fedora 32.
5+
6+
To build and preview the docs locally, you will need to install the following software:
7+
8+
- `Git <https://git-scm.com/book/en/v2/Getting-Started-Installing-Git>`_
9+
- `Python 3.7 <https://www.python.org/downloads/>`_
10+
- `pip <https://pip.pypa.io/en/stable/installing/>`_
11+
- `doxygen <https://www.tutorialspoint.com/how-to-install-doxygen-on-ubuntu/>`_
12+
13+
Run the following command to build the docs.
14+
15+
.. code:: console
16+
17+
cd docs
18+
make preview
19+
20+
Once the command completes processing, open http://127.0.0.1:5500/ with your preferred browser.
21+
22+
Building multiple documentation versions
23+
========================================
24+
25+
Build Sphinx docs for all the versions defined in ``docs/conf.py``.
26+
27+
The multiverson command does not build doxygen docs.
28+
29+
```
30+
cd docs
31+
make multiversion
32+
```
33+
34+
Then, open ``docs/_build/dirhtml/<version>/index.html`` with your preferred browser.
35+
36+
**NOTE:** If you only can see docs generated for the master branch, try to run ``git fetch --tags`` to download the latest tags from remote.

changelog/README.md

Lines changed: 1076 additions & 1077 deletions
Large diffs are not rendered by default.

docs.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.

docs/Makefile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# You can set these variables from the command line.
2+
SPHINXOPTS =
3+
SPHINXBUILD = poetry run sphinx-build
4+
PAPER =
5+
BUILDDIR = _build
6+
SOURCE_DIR = _source
7+
8+
# Internal variables.
9+
PAPEROPT_a4 = -D latex_paper_size=a4
10+
PAPEROPT_letter = -D latex_paper_size=letter
11+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCE_DIR)
12+
# the i18n builder cannot share the environment and doctrees with the others
13+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
14+
15+
.PHONY: all
16+
all: dirhtml
17+
18+
.PHONY: pristine
19+
pristine: clean
20+
git clean -dfX
21+
22+
.PHONY: setup
23+
setup:
24+
./_utils/setup.sh
25+
cp -Tr source $(SOURCE_DIR)
26+
cd $(SOURCE_DIR) && find -name README.md -execdir mv '{}' index.md ';'
27+
.PHONY: clean
28+
clean:
29+
rm -rf $(BUILDDIR)/*
30+
rm -rf $(SOURCE_DIR)/*
31+
32+
.PHONY: preview
33+
preview: setup
34+
cd .. && ./docs/_utils/doxygen.sh
35+
poetry run sphinx-autobuild -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml --port 5500
36+
37+
.PHONY: dirhtml
38+
dirhtml: setup
39+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
40+
@echo
41+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
42+
43+
.PHONY: singlehtml
44+
singlehtml: setup
45+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
46+
@echo
47+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
48+
49+
.PHONY: epub
50+
epub: setup
51+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
52+
@echo
53+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
54+
55+
.PHONY: epub3
56+
epub3: setup
57+
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
58+
@echo
59+
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
60+
61+
.PHONY: dummy
62+
dummy: setup
63+
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
64+
@echo
65+
@echo "Build finished. Dummy builder generates no files."
66+
67+
.PHONY: linkcheck
68+
linkcheck: setup
69+
$(SPHINXBUILD) -b linkcheck . $(BUILDDIR)/linkcheck
70+
71+
.PHONY: multiversion
72+
multiversion: setup
73+
poetry run ./_utils/multiversion.sh
74+
@echo
75+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
76+

docs/_utils/deploy.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# Clone repo
4+
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" --branch gh-pages --single-branch gh-pages
5+
cp -r docs/_build/dirhtml/* gh-pages
6+
# Redirections
7+
./docs/_utils/redirect.sh > gh-pages/index.html
8+
# Deploy
9+
cd gh-pages
10+
touch .nojekyll
11+
git config --local user.email "action@scylladb.com"
12+
git config --local user.name "GitHub Action"
13+
git add .
14+
git commit -m "Publish docs" || true
15+
git push origin gh-pages --force

docs/_utils/doxygen.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
OUTPUT_DIR="docs/_build/dirhtml/api"
4+
if [[ "$SPHINX_MULTIVERSION_OUTPUTDIR" != "" ]]; then
5+
OUTPUT_DIR="$SPHINX_MULTIVERSION_OUTPUTDIR/api"
6+
echo "HTML_OUTPUT = $OUTPUT_DIR" >> doxyfile
7+
fi
8+
mkdir -p "$OUTPUT_DIR"
9+
doxygen doxyfile

docs/_utils/multiversion.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/bash
2+
3+
cd .. && sphinx-multiversion docs/source docs/_build/dirhtml \
4+
--pre-build './docs/_utils/doxygen.sh' \
5+
--pre-build "find docs/source -name README.md -execdir mv '{}' index.md ';'"

docs/_utils/redirect.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
cat <<- _EOF_
4+
<!DOCTYPE html>
5+
<html>
6+
<head>
7+
<title>Redirecting to Driver</title>
8+
<meta charset="utf-8">
9+
<meta http-equiv="refresh" content="0; URL=./${LATEST_VERSION}/index.html">
10+
<link rel="canonical" href="./${LATEST_VERSION}/index.html">
11+
</head>
12+
</html>
13+
_EOF_

0 commit comments

Comments
 (0)