summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/generate
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2020-11-10 15:00:40 +0000
committerGitHub <noreply@github.com>2020-11-10 07:00:40 -0800
commitaae3b35c0fc363e4a9246e774b714a7a1ef7b6c0 (patch)
tree3d9adfd3eea4a72779b82787ed8210a1971832c5 /lib/python/qmk/cli/generate
parentabf1902ff597e77e910c0fb9a8d132b46f78317b (diff)
CI: Add docs build and deploy workflow (#7448)
* Add docs build and deploy workflow * Remove old travis docs workflow * update to cli command * Tidy up for review * formatting * Update to pass style checks * Update lib/python/qmk/cli/docs.py Co-Authored-By: skullydazed <skullydazed@users.noreply.github.com> * Review comments - build->generate, use of verbose * Add docs * Update to match recent actions * Run within base_container * Convert cli to generate-docs * Convert cli to generate-docs - restore old file * Convert cli to generate-docs * Update docs Co-authored-by: skullydazed <skullydazed@users.noreply.github.com>
Diffstat (limited to 'lib/python/qmk/cli/generate')
-rw-r--r--lib/python/qmk/cli/generate/__init__.py1
-rw-r--r--lib/python/qmk/cli/generate/docs.py37
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/generate/__init__.py b/lib/python/qmk/cli/generate/__init__.py
index 4dc7607ef2..13bd1f0914 100644
--- a/lib/python/qmk/cli/generate/__init__.py
+++ b/lib/python/qmk/cli/generate/__init__.py
@@ -1 +1,2 @@
from . import api
+from . import docs
diff --git a/lib/python/qmk/cli/generate/docs.py b/lib/python/qmk/cli/generate/docs.py
new file mode 100644
index 0000000000..a59a24db50
--- /dev/null
+++ b/lib/python/qmk/cli/generate/docs.py
@@ -0,0 +1,37 @@
+"""Build QMK documentation locally
+"""
+import shutil
+import subprocess
+from pathlib import Path
+
+from milc import cli
+
+DOCS_PATH = Path('docs/')
+BUILD_PATH = Path('.build/docs/')
+
+
+@cli.subcommand('Build QMK documentation.', hidden=False if cli.config.user.developer else True)
+def generate_docs(cli):
+ """Invoke the docs generation process
+
+ TODO(unclaimed):
+ * [ ] Add a real build step... something static docs
+ """
+
+ if BUILD_PATH.exists():
+ shutil.rmtree(BUILD_PATH)
+
+ shutil.copytree(DOCS_PATH, BUILD_PATH)
+
+ # When not verbose we want to hide all output
+ args = {'check': True}
+ if not cli.args.verbose:
+ args.update({'stdout': subprocess.DEVNULL, 'stderr': subprocess.STDOUT})
+
+ cli.log.info('Generating internal docs...')
+
+ # Generate internal docs
+ subprocess.run(['doxygen', 'Doxyfile'], **args)
+ subprocess.run(['moxygen', '-q', '-a', '-g', '-o', BUILD_PATH / 'internals_%s.md', 'doxygen/xml'], **args)
+
+ cli.log.info('Successfully generated internal docs to %s.', BUILD_PATH)