aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/docs.yml43
-rw-r--r--.travis.yml5
-rw-r--r--docs/cli_commands.md10
-rw-r--r--lib/python/qmk/cli/generate/__init__.py1
-rw-r--r--lib/python/qmk/cli/generate/docs.py37
-rwxr-xr-xutil/travis_docs.sh15
6 files changed, 91 insertions, 20 deletions
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 000000000..8855d1107
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,43 @@
1name: Generate Docs
2
3on:
4 push:
5 branches:
6 - master
7 paths:
8 - 'tmk_core/**'
9 - 'quantum/**'
10 - 'platforms/**'
11 - 'docs/**'
12 - '.github/workflows/docs.yml'
13
14jobs:
15 generate:
16 runs-on: ubuntu-latest
17 container: qmkfm/base_container
18
19 # protect against those who develop with their fork on master
20 if: github.repository == 'qmk/qmk_firmware'
21
22 steps:
23 - uses: actions/checkout@v2
24 with:
25 fetch-depth: 1
26
27 - name: Install dependencies
28 run: |
29 apt-get update && apt-get install -y rsync nodejs npm doxygen
30 npm install -g moxygen
31
32 - name: Build docs
33 run: |
34 qmk --verbose generate-docs
35
36 - name: Deploy
37 uses: JamesIves/github-pages-deploy-action@3.7.1
38 with:
39 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 BASE_BRANCH: master
41 BRANCH: gh-pages
42 FOLDER: .build/docs
43 GIT_CONFIG_EMAIL: hello@qmk.fm
diff --git a/.travis.yml b/.travis.yml
index f2e8a8411..a6533d613 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,21 +18,16 @@ addons:
18 - ubuntu-toolchain-r-test 18 - ubuntu-toolchain-r-test
19 - llvm-toolchain-trusty-7 19 - llvm-toolchain-trusty-7
20 packages: 20 packages:
21 - pandoc
22 - diffutils 21 - diffutils
23 - dos2unix 22 - dos2unix
24 - doxygen
25 - clang-format-7 23 - clang-format-7
26 - libstdc++-7-dev 24 - libstdc++-7-dev
27install:
28 - npm install -g moxygen
29script: 25script:
30 - git fetch --depth=50 origin $TRAVIS_BRANCH:$TRAVIS_BRANCH 26 - git fetch --depth=50 origin $TRAVIS_BRANCH:$TRAVIS_BRANCH
31 - git rev-parse --short HEAD 27 - git rev-parse --short HEAD
32 - git diff --name-only HEAD $TRAVIS_BRANCH 28 - git diff --name-only HEAD $TRAVIS_BRANCH
33 - bash util/travis_test.sh 29 - bash util/travis_test.sh
34 - bash util/travis_build.sh 30 - bash util/travis_build.sh
35 - bash util/travis_docs.sh
36after_script: 31after_script:
37 bash util/travis_compiled_push.sh 32 bash util/travis_compiled_push.sh
38notifications: 33notifications:
diff --git a/docs/cli_commands.md b/docs/cli_commands.md
index b10f5d499..69df82f95 100644
--- a/docs/cli_commands.md
+++ b/docs/cli_commands.md
@@ -286,6 +286,16 @@ This command starts a local HTTP server which you can use for browsing or improv
286qmk docs [-p PORT] 286qmk docs [-p PORT]
287``` 287```
288 288
289## `qmk generate-docs`
290
291This command allows you to generate QMK documentation locally. It can be uses for general browsing or improving the docs. External tools such as [serve](https://www.npmjs.com/package/serve) can be used to browse the generated files.
292
293**Usage**:
294
295```
296qmk generate-docs
297```
298
289## `qmk kle2json` 299## `qmk kle2json`
290 300
291This command allows you to convert from raw KLE data to QMK Configurator JSON. It accepts either an absolute file path, or a file name in the current directory. By default it will not overwrite `info.json` if it is already present. Use the `-f` or `--force` flag to overwrite. 301This command allows you to convert from raw KLE data to QMK Configurator JSON. It accepts either an absolute file path, or a file name in the current directory. By default it will not overwrite `info.json` if it is already present. Use the `-f` or `--force` flag to overwrite.
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 @@
1from . import api 1from . import api
2from . 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"""
3import shutil
4import subprocess
5from pathlib import Path
6
7from milc import cli
8
9DOCS_PATH = Path('docs/')
10BUILD_PATH = Path('.build/docs/')
11
12
13@cli.subcommand('Build QMK documentation.', hidden=False if cli.config.user.developer else True)
14def 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)
diff --git a/util/travis_docs.sh b/util/travis_docs.sh
deleted file mode 100755
index 93c2d7186..000000000
--- a/util/travis_docs.sh
+++ /dev/null
@@ -1,15 +0,0 @@
1#!/bin/bash
2
3source util/travis_utils.sh
4source util/travis_push.sh
5
6if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip docs]"* ]] ; then
7 if git diff --name-only ${TRAVIS_COMMIT_RANGE} | grep -e '^quantum/' -e '^tmk_core/' -e '^docs/internals_.*'; then
8 echo "Generating internal docs..."
9 rm -rf doxygen
10 doxygen Doxyfile
11 moxygen -q -a -g -o docs/internals_%s.md doxygen/xml
12 git add docs/internals_*
13 git commit -m'autogenerated internal docs for ${TRAVIS_COMMIT_RANGE}' || true
14 fi
15fi