diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7538259d5b5..e2f3ec17c16 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,14 +6,15 @@ on: - main - rel-* tags: - - v* + # Must not take the form vX.Y which is reserved for docs + - v*.*.* pull_request: branches: - main - rel-* concurrency: group: ${{ github.workflow }}-${{ github.ref }} - + # Terminate all previous runs of the same workflow and branch/tag, except for main and release branches/tags cancel-in-progress: "${{ !(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/rel-')) }}" @@ -32,7 +33,7 @@ jobs: # shellcheck disable=SC2046 nix-store -v --realize $( nix-instantiate default.nix ) shell: bash - + Lint-Style: name: Lint & check code style runs-on: ubuntu-latest @@ -102,9 +103,9 @@ jobs: uses: ./.github/actions/setup-nix with: tools: tests withTools - # It seems like they are installing the same set of derivations, so we can assign them the same cache id. + # It seems like they are installing the same set of derivations, so we can assign them the same cache id. # This would decrease the amount of caches dowloaded on merge cache step and will prevent disk space issues. - cache-id: common + cache-id: common - name: Run spec tests if: always() diff --git a/docs/.github/workflows/ci.yaml b/.github/workflows/docs.yaml similarity index 51% rename from docs/.github/workflows/ci.yaml rename to .github/workflows/docs.yaml index 37e47940ab1..50e39705cbc 100644 --- a/docs/.github/workflows/ci.yaml +++ b/.github/workflows/docs.yaml @@ -1,14 +1,16 @@ -name: CI +name: Documentation on: push: branches: - - main - - v* + - main + - rel-* + tags: + - v[0-9]+.[0-9]+ pull_request: branches: - - main - - v* + - main + - rel-* jobs: build: @@ -16,8 +18,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v24 - - run: nix-env -f default.nix -iA build + - name: Setup Nix Environment + uses: ./.github/actions/setup-nix + with: + tools: docs + cache-id: common - run: postgrest-docs-build spellcheck: @@ -25,8 +30,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v24 - - run: nix-env -f default.nix -iA spellcheck + - name: Setup Nix Environment + uses: ./.github/actions/setup-nix + with: + tools: docs + cache-id: common - run: postgrest-docs-spellcheck dictcheck: @@ -34,8 +42,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v24 - - run: nix-env -f default.nix -iA dictcheck + - name: Setup Nix Environment + uses: ./.github/actions/setup-nix + with: + tools: docs + cache-id: common - run: postgrest-docs-dictcheck linkcheck: @@ -44,7 +55,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v24 - - run: nix-env -f default.nix -iA linkcheck + - name: Setup Nix Environment + uses: ./.github/actions/setup-nix + with: + tools: docs + cache-id: common - run: postgrest-docs-linkcheck - diff --git a/docs/.readthedocs.yaml b/.readthedocs.yaml similarity index 55% rename from docs/.readthedocs.yaml rename to .readthedocs.yaml index 4690fde9d52..d0cdce6a9d8 100644 --- a/docs/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,9 +1,9 @@ version: 2 sphinx: - configuration: docs/conf.py + configuration: docs/docs/conf.py python: install: - - requirements: requirements.txt + - requirements: docs/requirements.txt build: os: ubuntu-22.04 tools: diff --git a/docs/.github/PULL_REQUEST_TEMPLATE.md b/docs/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 1bd9f912abc..00000000000 --- a/docs/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/docs/.github/dependabot.yml b/docs/.github/dependabot.yml deleted file mode 100644 index e2347a8c766..00000000000 --- a/docs/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: -- package-ecosystem: github-actions - directory: / - schedule: - interval: weekly diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md deleted file mode 100644 index be92f4d7a99..00000000000 --- a/docs/CONTRIBUTING.md +++ /dev/null @@ -1,3 +0,0 @@ -This repository follows the same contribution guidelines as the main PostgREST repository contribution guidelines: - -https://github.com/PostgREST/postgrest/blob/main/.github/CONTRIBUTING.md diff --git a/docs/docs/conf.py b/docs/docs/conf.py index 844603f91b3..4f3c6016a98 100644 --- a/docs/docs/conf.py +++ b/docs/docs/conf.py @@ -18,91 +18,91 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx_tabs.tabs', - 'sphinx_copybutton', - 'sphinxext.opengraph', + "sphinx_tabs.tabs", + "sphinx_copybutton", + "sphinxext.opengraph", ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'PostgREST' -author = u'Joe Nelson, Steve Chavez' -copyright = u'2017, ' + author +project = "PostgREST" +author = "Joe Nelson, Steve Chavez" +copyright = "2017, " + author # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'11.2' +version = "11.2" # The full version, including alpha/beta/rc tags. -release = u'11.2.0' +release = "11.2.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = 'en' +language = "en" # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'shared/*.rst'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "shared/*.rst"] # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -112,158 +112,151 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. # " v documentation" by default. -#html_title = u'PostgREST v0.4.0.0' +# html_title = u'PostgREST v0.4.0.0' # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (relative to this directory) to use as a favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -html_favicon = '_static/favicon.ico' +html_favicon = "_static/favicon.ico" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. -#html_last_updated_fmt = None +# html_last_updated_fmt = None # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' -#html_search_language = 'en' +# html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # 'ja' uses this config value. # 'zh' user can custom change `jieba` dictionary path. -#html_search_options = {'type': 'default'} +# html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' +# html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'PostgRESTdoc' +htmlhelp_basename = "PostgRESTdoc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', - -# Latex figure (float) alignment -#'figure_align': 'htbp', + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + #'preamble': '', + # Latex figure (float) alignment + #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'PostgREST.tex', u'PostgREST Documentation', - author, 'manual'), + (master_doc, "PostgREST.tex", "PostgREST Documentation", author, "manual"), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'postgrest', u'PostgREST Documentation', - [author], 1) -] +man_pages = [(master_doc, "postgrest", "PostgREST Documentation", [author], 1)] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------- @@ -272,37 +265,45 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'PostgREST', u'PostgREST Documentation', - author, 'PostgREST', 'REST API for any PostgreSQL database', - 'Web'), + ( + master_doc, + "PostgREST", + "PostgREST Documentation", + author, + "PostgREST", + "REST API for any PostgreSQL database", + "Web", + ), ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False +# texinfo_no_detailmenu = False # -- Custom setup --------------------------------------------------------- + def setup(app): - app.add_css_file('css/custom.css') + app.add_css_file("css/custom.css") + # taken from https://github.com/sphinx-doc/sphinx/blob/82dad44e5bd3776ecb6fd8ded656bc8151d0e63d/sphinx/util/requests.py#L42 -user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0' +user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0" # sphinx-tabs configuration sphinx_tabs_disable_tab_closing = True # sphinxext-opengraph configuration -ogp_image = '_images/logo.png' +ogp_image = "_images/logo.png" ogp_use_first_image = True ogp_enable_meta_description = True ogp_description_length = 300 diff --git a/docs/livereload_docs.py b/docs/livereload_docs.py index 8dae1657746..391e0d0ef2f 100755 --- a/docs/livereload_docs.py +++ b/docs/livereload_docs.py @@ -1,10 +1,11 @@ #!/usr/bin/env python 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", "docs", "_build"]) server = Server() -server.watch('docs/**/*.rst', shell('sphinx-build -b html -a -n docs _build')) +server.watch("docs/**/*.rst", shell("sphinx-build -b html -a -n docs _build")) # For custom port and host # server.serve(root='_build/', host='192.168.1.2') -server.serve(root='_build/') +server.serve(root="_build/")