|
| 1 | +# Copyright (c) 2020 Linaro Limited. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: Documentation |
| 5 | + |
| 6 | +on: [pull_request, push] |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Update PATH for west |
| 14 | + run: | |
| 15 | + echo "::add-path::$HOME/.local/bin" |
| 16 | +
|
| 17 | + - name: checkout |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: install-pkgs |
| 21 | + run: | |
| 22 | + sudo apt-get install -y ninja-build doxygen |
| 23 | +
|
| 24 | + - name: cache-pip |
| 25 | + uses: actions/cache@v1 |
| 26 | + with: |
| 27 | + path: ~/.cache/pip |
| 28 | + key: ${{ runner.os }}-doc-pip |
| 29 | + |
| 30 | + - name: install-pip |
| 31 | + run: | |
| 32 | + pip3 install setuptools |
| 33 | + pip3 install 'breathe>=4.9.1' 'docutils>=0.14' \ |
| 34 | + 'sphinx>=1.7.5' sphinx_rtd_theme sphinx-tabs \ |
| 35 | + sphinxcontrib-svg2pdfconverter 'west>=0.6.2' |
| 36 | +
|
| 37 | + - name: cache-zephyr-modules |
| 38 | + uses: actions/cache@v1 |
| 39 | + with: |
| 40 | + path: ../modules |
| 41 | + key: ${{ runner.os }}-zephyr-modules-${{ hashFiles('west.yml') }} |
| 42 | + |
| 43 | + - name: cache-zephyr-tools |
| 44 | + uses: actions/cache@v1 |
| 45 | + with: |
| 46 | + path: ../tools |
| 47 | + key: ${{ runner.os }}-zephyr-tools-${{ hashFiles('west.yml') }} |
| 48 | + restore-keys: | |
| 49 | + ${{ runner.os }}-doc-zephyr-tools |
| 50 | +
|
| 51 | + - name: west setup |
| 52 | + run: | |
| 53 | + west init -l . || true |
| 54 | + west update |
| 55 | +
|
| 56 | + - name: build-docs |
| 57 | + run: | |
| 58 | + source zephyr-env.sh |
| 59 | + make htmldocs |
| 60 | + tar cvf htmldocs.tar --directory=./doc/_build html |
| 61 | +
|
| 62 | + - name: upload-build |
| 63 | + uses: actions/upload-artifact@master |
| 64 | + continue-on-error: True |
| 65 | + with: |
| 66 | + name: htmldocs.tar |
| 67 | + path: htmldocs.tar |
| 68 | + |
| 69 | + - name: check-warns |
| 70 | + run: | |
| 71 | + if [ -s doc/_build/doc.warnings ]; then |
| 72 | + docwarn=$(cat doc/_build/doc.warnings) |
| 73 | + docwarn="${docwarn//'%'/'%25'}" |
| 74 | + docwarn="${docwarn//$'\n'/'%0A'}" |
| 75 | + docwarn="${docwarn//$'\r'/'%0D'}" |
| 76 | + # We treat doc warnings as errors |
| 77 | + echo "::error file=doc.warnings::$docwarn" |
| 78 | + exit 1 |
| 79 | + fi |
0 commit comments