Skip to content

Commit

Permalink
Add api references (frontend+backend)+ change github actions+
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Oct 25, 2023
1 parent 6d1c819 commit 7ba7626
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 29 deletions.
61 changes: 41 additions & 20 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: "Build Sphinx Documentation"

on:
release:
types: [published]
on:
push:
branches:
- update-doc
pull_request:
branches:
- update-doc
# release:
# types: [published]

jobs:
docs:
Expand All @@ -24,20 +30,35 @@ jobs:
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: Build and Commit
uses: sphinx-notes/pages@v2
with:
requirements_path: docs/requirements.txt
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@master
with:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: lts/gallium

- name: Install JS librairies
working-directory: ./frontend
run: npm install --only=dev

- name: Build JS documentation
working-directory: ./frontend
run: npm run buildDoc

- name: Build and Commit
uses: sphinx-notes/pages@v2
with:
requirements_path: docs/requirements.txt
env:
GEONATURE_CONFIG_FILE: config/test_config.toml

# - name: Push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: gh-pages
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/external_doc/documentation_js

# PyBuilder
target/
Expand Down
4 changes: 1 addition & 3 deletions backend/requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
-r requirements-common.in
-r requirements-submodules.in
sphinx-rtd-theme
myst-parser
-r requirements-submodules.in
6 changes: 6 additions & 0 deletions docs/api-references.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
API REFERENCES
==============

.. toctree::
../../autoapi/geonature/index
frontend
16 changes: 12 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
# 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.
#
import sys, os

sys.path.insert(0, os.path.abspath("../backend"))

# -- General configuration ------------------------------------------------

Expand All @@ -38,6 +41,13 @@
"myst_parser",
]

## AUTOAPI
extensions.append("autoapi.extension")
autoapi_dirs = ["../backend/geonature"]
autoapi_ignore = ["*migrations*", "*tests*"]
autoapi_add_toctree_entry = False


# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down Expand Up @@ -126,9 +136,7 @@
# ]
# }

html_extra_path = [
"CNAME",
]
html_extra_path = ["CNAME", "sources/"]


# -- Options for HTMLHelp output ------------------------------------------
Expand Down Expand Up @@ -186,4 +194,4 @@


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/": None}
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
Empty file added docs/external_doc/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions docs/frontend.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Frontend
--------
La documentation pour le frontend de Geonature se trouve ici_.

.. _ici: documentation_js/index.html
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Bienvenue dans la documentation de GeoNature
FAQ
authors
CHANGELOG
api-references

1 change: 1 addition & 0 deletions docs/requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sphinx
sphinx_rtd_theme
myst-parser
sphinx-autoapi
6 changes: 4 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"format": "prettier --config .prettierrc --ignore-path .prettierignore --write '**/*.ts' '../contrib/*/frontend/**/*.ts'",
"format:check": "prettier --config .prettierrc --ignore-path .prettierignore --check '**/*.ts' '../contrib/*/frontend/**/*.ts'",
"cypress:open": "cypress open",
"cypress:run": "cypress run"
"cypress:run": "cypress run",
"docBuild" : "npx compodoc -p tsconfig.doc.json -d ../docs/external_doc/documentation_js"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -66,6 +67,7 @@
"cypress": "^9.2.1",
"cypress-promise": "^1.1.0",
"prettier": "^2.5.0",
"typescript": "4.9.4"
"typescript": "4.9.4",
"@compodoc/compodoc":"^1.1.22"
}
}
4 changes: 4 additions & 0 deletions frontend/tsconfig.doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"include": ["src/**/*.ts"],
"exclude": ["src/test.ts", "src/**/*.spec.ts", "src/app/file-to-exclude.ts"]
}

0 comments on commit 7ba7626

Please sign in to comment.