chore: Prepare merge of postgrest-docs into postgrest main repo

This avoids some merge conflicts to allow git blame to detect renames properly.
This commit is contained in:
Wolfgang Walther
2024-02-17 13:43:21 +01:00
parent 6af706facd
commit c1c45060ba
20 changed files with 22 additions and 17 deletions
@@ -1,14 +1,14 @@
name: CI name: Docs
on: on:
push: push:
branches: branches:
- main - main
- v* - rel-*
pull_request: pull_request:
branches: branches:
- main - main
- v* - rel-*
jobs: jobs:
build: build:
@@ -17,7 +17,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22 - uses: cachix/install-nix-action@v22
- run: nix-env -f default.nix -iA build - run: nix-env -f docs/default.nix -iA build
- run: postgrest-docs-build - run: postgrest-docs-build
spellcheck: spellcheck:
@@ -26,7 +26,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22 - uses: cachix/install-nix-action@v22
- run: nix-env -f default.nix -iA spellcheck - run: nix-env -f docs/default.nix -iA spellcheck
- run: postgrest-docs-spellcheck - run: postgrest-docs-spellcheck
dictcheck: dictcheck:
@@ -35,7 +35,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22 - uses: cachix/install-nix-action@v22
- run: nix-env -f default.nix -iA dictcheck - run: nix-env -f docs/default.nix -iA dictcheck
- run: postgrest-docs-dictcheck - run: postgrest-docs-dictcheck
linkcheck: linkcheck:
@@ -45,6 +45,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22 - uses: cachix/install-nix-action@v22
- run: nix-env -f default.nix -iA linkcheck - run: nix-env -f docs/default.nix -iA linkcheck
- run: postgrest-docs-linkcheck - run: postgrest-docs-linkcheck
+1 -1
View File
@@ -3,7 +3,7 @@ sphinx:
configuration: docs/conf.py configuration: docs/conf.py
python: python:
install: install:
- requirements: requirements.txt - requirements: docs/requirements.txt
build: build:
os: ubuntu-22.04 os: ubuntu-22.04
tools: tools:
+1 -1
View File
@@ -2,7 +2,7 @@ _build
Pipfile.lock Pipfile.lock
*.aux *.aux
*.log *.log
diagrams/db.pdf _diagrams/db.pdf
misspellings misspellings
unuseddict unuseddict
.history .history
View File
@@ -5,7 +5,7 @@ The ER diagrams were created with https://github.com/BurntSushi/erd/.
You can go download erd from https://github.com/BurntSushi/erd/releases and then do: You can go download erd from https://github.com/BurntSushi/erd/releases and then do:
```bash ```bash
./erd_static-x86-64 -i diagrams/film.er -o docs/_static/film.png ./erd_static-x86-64 -i film.er -o ../_static/film.png
``` ```
The fonts used belong to the GNU FreeFont family. You can download them here: http://ftp.gnu.org/gnu/freefont/ The fonts used belong to the GNU FreeFont family. You can download them here: http://ftp.gnu.org/gnu/freefont/
@@ -20,7 +20,7 @@ Then use this command to generate the png file.
pdflatex --shell-escape -halt-on-error db.tex pdflatex --shell-escape -halt-on-error db.tex
## and move it to the static folder(it's not easy to do it in one go with the pdflatex) ## and move it to the static folder(it's not easy to do it in one go with the pdflatex)
mv db.png ../docs/_static/ mv db.png ../_static/
``` ```
LaTeX is used because it's a tweakable plain text format. LaTeX is used because it's a tweakable plain text format.
+9 -4
View File
@@ -27,17 +27,19 @@ in
pkgs.writeShellScriptBin "postgrest-docs-build" pkgs.writeShellScriptBin "postgrest-docs-build"
'' ''
set -euo pipefail set -euo pipefail
cd "$(${pkgs.git}/bin/git rev-parse --show-toplevel)/docs"
# clean previous build, otherwise some errors might be supressed # clean previous build, otherwise some errors might be supressed
rm -rf _build rm -rf _build
${python}/bin/sphinx-build --color -W -b html -a -n docs _build ${python}/bin/sphinx-build --color -W -b html -a -n . _build
''; '';
serve = serve =
pkgs.writeShellScriptBin "postgrest-docs-serve" pkgs.writeShellScriptBin "postgrest-docs-serve"
'' ''
set -euo pipefail set -euo pipefail
cd "$(${pkgs.git}/bin/git rev-parse --show-toplevel)/docs"
# livereload_docs.py needs to find "sphinx-build" # livereload_docs.py needs to find "sphinx-build"
PATH=${python}/bin:$PATH PATH=${python}/bin:$PATH
@@ -49,8 +51,9 @@ in
pkgs.writeShellScriptBin "postgrest-docs-spellcheck" pkgs.writeShellScriptBin "postgrest-docs-spellcheck"
'' ''
set -euo pipefail set -euo pipefail
cd "$(${pkgs.git}/bin/git rev-parse --show-toplevel)/docs"
FILES=$(find docs -type f -iname '*.rst' | tr '\n' ' ') FILES=$(find . -type f -iname '*.rst' | tr '\n' ' ')
cat $FILES \ cat $FILES \
| grep -v '^\(\.\.\| \)' \ | grep -v '^\(\.\.\| \)' \
@@ -66,8 +69,9 @@ in
pkgs.writeShellScriptBin "postgrest-docs-dictcheck" pkgs.writeShellScriptBin "postgrest-docs-dictcheck"
'' ''
set -euo pipefail set -euo pipefail
cd "$(${pkgs.git}/bin/git rev-parse --show-toplevel)/docs"
FILES=$(find docs -type f -iname '*.rst' | tr '\n' ' ') FILES=$(find . -type f -iname '*.rst' | tr '\n' ' ')
cat postgrest.dict \ cat postgrest.dict \
| tail -n+2 \ | tail -n+2 \
@@ -82,7 +86,8 @@ in
pkgs.writeShellScriptBin "postgrest-docs-linkcheck" pkgs.writeShellScriptBin "postgrest-docs-linkcheck"
'' ''
set -euo pipefail set -euo pipefail
cd "$(${pkgs.git}/bin/git rev-parse --show-toplevel)/docs"
${python}/bin/sphinx-build --color -b linkcheck docs _build ${python}/bin/sphinx-build --color -b linkcheck . _build
''; '';
} }
@@ -2,9 +2,9 @@
from livereload import Server, shell from livereload import Server, shell
from subprocess import call from subprocess import call
## Build docs at startup ## Build docs at startup
call(['sphinx-build', '-b', 'html', '-a', '-n', 'docs', '_build']) call(['sphinx-build', '-b', 'html', '-a', '-n', '.', '_build'])
server = Server() server = Server()
server.watch('docs/**/*.rst', shell('sphinx-build -b html -a -n docs _build')) server.watch('**/*.rst', shell('sphinx-build -b html -a -n . _build'))
# For custom port and host # For custom port and host
# server.serve(root='_build/', host='192.168.1.2') # server.serve(root='_build/', host='192.168.1.2')
server.serve(root='_build/') server.serve(root='_build/')
View File