diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index c3bc41829..000000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: CI - -on: - push: - branches: - - main - - v* - pull_request: - branches: - - main - - v* - -jobs: - build: - name: Build docs - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - run: nix-env -f default.nix -iA build - - run: postgrest-docs-build - - spellcheck: - name: Run spellcheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - run: nix-env -f default.nix -iA spellcheck - - run: postgrest-docs-spellcheck - - linkcheck: - name: Run linkcheck - if: github.base_ref == 'main' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - run: nix-env -f default.nix -iA linkcheck - - run: postgrest-docs-linkcheck - diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 000000000..f9bf2fd3a --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,50 @@ +name: Docs + +on: + push: + branches: + - main + - rel-* + pull_request: + branches: + - main + - rel-* + +jobs: + build: + name: Build docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + - run: nix-env -f docs/default.nix -iA build + - run: postgrest-docs-build + + spellcheck: + name: Run spellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + - run: nix-env -f docs/default.nix -iA spellcheck + - run: postgrest-docs-spellcheck + + dictcheck: + name: Run dictcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + - run: nix-env -f docs/default.nix -iA dictcheck + - run: postgrest-docs-dictcheck + + linkcheck: + name: Run linkcheck + if: github.base_ref == 'main' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + - run: nix-env -f docs/default.nix -iA linkcheck + - run: postgrest-docs-linkcheck + diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 3bce02afa..e7e973dce 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -3,4 +3,4 @@ sphinx: configuration: docs/conf.py python: install: - - requirements: requirements.txt + - requirements: docs/requirements.txt diff --git a/.gitignore b/docs/.gitignore similarity index 72% rename from .gitignore rename to docs/.gitignore index 4c1f95600..24f3c2799 100644 --- a/.gitignore +++ b/docs/.gitignore @@ -2,5 +2,5 @@ _build Pipfile.lock *.aux *.log -diagrams/db.pdf +_diagrams/db.pdf misspellings diff --git a/README.md b/docs/README.md similarity index 100% rename from README.md rename to docs/README.md diff --git a/diagrams/README.md b/docs/_diagrams/README.md similarity index 90% rename from diagrams/README.md rename to docs/_diagrams/README.md index 67009dc31..408e767f2 100644 --- a/diagrams/README.md +++ b/docs/_diagrams/README.md @@ -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: ```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 ``` ## LaTeX @@ -18,7 +18,7 @@ Then use this command to generate the png file. 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) -mv db.png ../docs/_static/ +mv db.png ../_static/ ``` LaTeX is used because it's a tweakable plain text format. diff --git a/diagrams/db.tex b/docs/_diagrams/db.tex similarity index 100% rename from diagrams/db.tex rename to docs/_diagrams/db.tex diff --git a/diagrams/film.er b/docs/_diagrams/film.er similarity index 100% rename from diagrams/film.er rename to docs/_diagrams/film.er diff --git a/diagrams/orders.er b/docs/_diagrams/orders.er similarity index 100% rename from diagrams/orders.er rename to docs/_diagrams/orders.er diff --git a/default.nix b/docs/default.nix similarity index 78% rename from default.nix rename to docs/default.nix index 5dffe887a..363f53d4c 100644 --- a/default.nix +++ b/docs/default.nix @@ -27,17 +27,19 @@ in pkgs.writeShellScriptBin "postgrest-docs-build" '' set -euo pipefail + cd "$(${pkgs.git}/bin/git rev-parse --show-toplevel)/docs" # clean previous build, otherwise some errors might be supressed 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 = pkgs.writeShellScriptBin "postgrest-docs-serve" '' set -euo pipefail + cd "$(${pkgs.git}/bin/git rev-parse --show-toplevel)/docs" # livereload_docs.py needs to find "sphinx-build" PATH=${python}/bin:$PATH @@ -49,8 +51,9 @@ in pkgs.writeShellScriptBin "postgrest-docs-spellcheck" '' 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 \ | grep -v '^\(\.\.\| \)' \ @@ -66,8 +69,9 @@ in pkgs.writeShellScriptBin "postgrest-docs-dictcheck" '' 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 \ | tail -n+2 \ @@ -80,7 +84,8 @@ in pkgs.writeShellScriptBin "postgrest-docs-linkcheck" '' 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 ''; } diff --git a/extensions/sphinx-copybutton.nix b/docs/extensions/sphinx-copybutton.nix similarity index 100% rename from extensions/sphinx-copybutton.nix rename to docs/extensions/sphinx-copybutton.nix diff --git a/extensions/sphinx-tabs.nix b/docs/extensions/sphinx-tabs.nix similarity index 100% rename from extensions/sphinx-tabs.nix rename to docs/extensions/sphinx-tabs.nix diff --git a/livereload_docs.py b/docs/livereload_docs.py similarity index 61% rename from livereload_docs.py rename to docs/livereload_docs.py index 8dae16577..741633d43 100755 --- a/livereload_docs.py +++ b/docs/livereload_docs.py @@ -2,9 +2,9 @@ from livereload import Server, shell from subprocess import call ## Build docs at startup -call(['sphinx-build', '-b', 'html', '-a', '-n', 'docs', '_build']) +call(['sphinx-build', '-b', 'html', '-a', '-n', '.', '_build']) 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 # server.serve(root='_build/', host='192.168.1.2') server.serve(root='_build/') diff --git a/postgrest.dict b/docs/postgrest.dict similarity index 100% rename from postgrest.dict rename to docs/postgrest.dict diff --git a/requirements.txt b/docs/requirements.txt similarity index 100% rename from requirements.txt rename to docs/requirements.txt diff --git a/shell.nix b/docs/shell.nix similarity index 100% rename from shell.nix rename to docs/shell.nix