<commit_before># Copyright (c) 2020 Linaro Limited.
# SPDX-License-Identifier: Apache-2.0

name: Documentation GitHub Workflow

on:
  pull_request:
    paths:
    - 'Makefile'
    - 'doc/**'
    - '**.rst'
    - 'include/**'
    - 'kernel/include/kernel_arch_interface.h'
    - 'lib/libc/**'
    - 'subsys/testsuite/ztest/include/**'
    - 'tests/**'
    - '.known-issues/doc/**'
    - '**/Kconfig*'
    - 'west.yml'
    - '.github/workflows/doc-build.yml'
    - 'scripts/dts/**'

jobs:
  doc-build:
    name: "Documentation Build"
    runs-on: ubuntu-latest

    steps:
    - name: Update PATH for west
      run: |
        echo "$HOME/.local/bin" >> $GITHUB_PATH

    - name: checkout
      uses: actions/checkout@v2

    - name: install-pkgs
      run: |
        sudo apt-get install -y ninja-build doxygen

    - name: cache-pip
      uses: actions/cache@v1
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-doc-pip

    - name: install-pip
      run: |
        pip3 install setuptools wheel
        pip3 install -r scripts/requirements-base.txt
        pip3 install -r scripts/requirements-doc.txt
        pip3 install west==0.10.1

    - name: west setup
      run: |
        west init -l . || true

    - name: build-docs
      run: |
        source zephyr-env.sh
        make -C doc htmldocs
        tar cvf htmldocs.tar --directory=./doc/_build html

    - name: upload-build
      uses: actions/upload-artifact@master
      continue-on-error: True
      with:
        name: htmldocs.tar
        path: htmldocs.tar

    - name: check-warns
      run: |
        if [ -s doc/_build/doc.warnings ]; then
           docwarn=$(cat doc/_build/doc.warnings)
           docwarn="${docwarn//'%'/'%25'}"
           docwarn="${docwarn//$'\n'/'%0A'}"
           docwarn="${docwarn//$'\r'/'%0D'}"
           # We treat doc warnings as errors
           echo "::error file=doc.warnings::$docwarn"
           exit 1
        fi
<commit_msg>ci: trigger doc build if requirements change<commit_after># Copyright (c) 2020 Linaro Limited.
# SPDX-License-Identifier: Apache-2.0

name: Documentation GitHub Workflow

on:
  pull_request:
    paths:
    - 'Makefile'
    - 'doc/**'
    - '**.rst'
    - 'include/**'
    - 'kernel/include/kernel_arch_interface.h'
    - 'lib/libc/**'
    - 'subsys/testsuite/ztest/include/**'
    - 'tests/**'
    - '.known-issues/doc/**'
    - '**/Kconfig*'
    - 'west.yml'
    - '.github/workflows/doc-build.yml'
    - 'scripts/dts/**'
    - 'scripts/requirements-doc.txt'

jobs:
  doc-build:
    name: "Documentation Build"
    runs-on: ubuntu-latest

    steps:
    - name: Update PATH for west
      run: |
        echo "$HOME/.local/bin" >> $GITHUB_PATH

    - name: checkout
      uses: actions/checkout@v2

    - name: install-pkgs
      run: |
        sudo apt-get install -y ninja-build doxygen

    - name: cache-pip
      uses: actions/cache@v1
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-doc-pip

    - name: install-pip
      run: |
        pip3 install setuptools wheel
        pip3 install -r scripts/requirements-base.txt
        pip3 install -r scripts/requirements-doc.txt
        pip3 install west==0.10.1

    - name: west setup
      run: |
        west init -l . || true

    - name: build-docs
      run: |
        source zephyr-env.sh
        make -C doc htmldocs
        tar cvf htmldocs.tar --directory=./doc/_build html

    - name: upload-build
      uses: actions/upload-artifact@master
      continue-on-error: True
      with:
        name: htmldocs.tar
        path: htmldocs.tar

    - name: check-warns
      run: |
        if [ -s doc/_build/doc.warnings ]; then
           docwarn=$(cat doc/_build/doc.warnings)
           docwarn="${docwarn//'%'/'%25'}"
           docwarn="${docwarn//$'\n'/'%0A'}"
           docwarn="${docwarn//$'\r'/'%0D'}"
           # We treat doc warnings as errors
           echo "::error file=doc.warnings::$docwarn"
           exit 1
        fi

{'fraction_non_alphanumeric': 0.1472809667673716, 'fraction_numerical': 0.010574018126888218, 'mean_word_length': 1.8117480537862702, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2951651', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1340, 'n_words': 293}