diff options
author | Joel Challis <git@zvecr.com> | 2020-11-10 15:00:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 07:00:40 -0800 |
commit | aae3b35c0fc363e4a9246e774b714a7a1ef7b6c0 (patch) | |
tree | 3d9adfd3eea4a72779b82787ed8210a1971832c5 /lib/python | |
parent | abf1902ff597e77e910c0fb9a8d132b46f78317b (diff) | |
download | qmk_firmware-aae3b35c0fc363e4a9246e774b714a7a1ef7b6c0.tar.gz qmk_firmware-aae3b35c0fc363e4a9246e774b714a7a1ef7b6c0.zip |
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')
-rw-r--r-- | lib/python/qmk/cli/generate/__init__.py | 1 | ||||
-rw-r--r-- | lib/python/qmk/cli/generate/docs.py | 37 |
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 4dc7607ef..13bd1f091 100644 --- a/lib/python/qmk/cli/generate/__init__.py +++ b/lib/python/qmk/cli/generate/__init__.py | |||
@@ -1 +1,2 @@ | |||
1 | from . import api | 1 | from . import api |
2 | 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 000000000..a59a24db5 --- /dev/null +++ b/lib/python/qmk/cli/generate/docs.py | |||
@@ -0,0 +1,37 @@ | |||
1 | """Build QMK documentation locally | ||
2 | """ | ||
3 | import shutil | ||
4 | import subprocess | ||
5 | from pathlib import Path | ||
6 | |||
7 | from milc import cli | ||
8 | |||
9 | DOCS_PATH = Path('docs/') | ||
10 | BUILD_PATH = Path('.build/docs/') | ||
11 | |||
12 | |||
13 | @cli.subcommand('Build QMK documentation.', hidden=False if cli.config.user.developer else True) | ||
14 | def generate_docs(cli): | ||
15 | """Invoke the docs generation process | ||
16 | |||
17 | TODO(unclaimed): | ||
18 | * [ ] Add a real build step... something static docs | ||
19 | """ | ||
20 | |||
21 | if BUILD_PATH.exists(): | ||
22 | shutil.rmtree(BUILD_PATH) | ||
23 | |||
24 | shutil.copytree(DOCS_PATH, BUILD_PATH) | ||
25 | |||
26 | # When not verbose we want to hide all output | ||
27 | args = {'check': True} | ||
28 | if not cli.args.verbose: | ||
29 | args.update({'stdout': subprocess.DEVNULL, 'stderr': subprocess.STDOUT}) | ||
30 | |||
31 | cli.log.info('Generating internal docs...') | ||
32 | |||
33 | # Generate internal docs | ||
34 | subprocess.run(['doxygen', 'Doxyfile'], **args) | ||
35 | subprocess.run(['moxygen', '-q', '-a', '-g', '-o', BUILD_PATH / 'internals_%s.md', 'doxygen/xml'], **args) | ||
36 | |||
37 | cli.log.info('Successfully generated internal docs to %s.', BUILD_PATH) | ||