1 # LLVM Documentation CI
2 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 # See https://llvm.org/LICENSE.txt for license information.
4 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 name: "Test documentation build"
18 - 'clang/include/clang/Basic/AttrDocs.td'
19 - 'clang/include/clang/Driver/ClangOptionDocs.td'
20 - 'clang/include/clang/Basic/DiagnosticDocs.td'
21 - 'clang-tools-extra/docs/**'
30 - 'flang/include/flang/Optimizer/Dialect/FIROps.td'
35 - 'clang/include/clang/Basic/AttrDocs.td'
36 - 'clang/include/clang/Driver/ClangOptionDocs.td'
37 - 'clang/include/clang/Basic/DiagnosticDocs.td'
38 - 'clang-tools-extra/docs/**'
47 - 'flang/include/flang/Optimizer/Dialect/FIROps.td'
51 name: "Test documentation build"
52 runs-on: ubuntu-latest
53 if: github.repository == 'llvm/llvm-project'
55 # Don't fetch before checking for file changes to force the file changes
56 # action to use the Github API in pull requests. If it's a push to a
57 # branch we can't use the Github API to get the diff, so we need to have
58 # a local checkout beforehand.
59 - name: Fetch LLVM sources (Push)
60 if: ${{ github.event_name == 'push' }}
61 uses: actions/checkout@v4
64 - name: Get subprojects that have doc changes
65 id: docs-changed-subprojects
66 uses: tj-actions/changed-files@v39
73 - 'clang/include/clang/Basic/AttrDocs.td'
74 - 'clang/include/clang/Driver/ClangOptionDocs.td'
75 - 'clang/include/clang/Basic/DiagnosticDocs.td'
77 - 'clang-tools-extra/docs/**'
94 - 'flang/include/flang/Optimizer/Dialect/FIROps.td'
95 - name: Fetch LLVM sources (PR)
96 if: ${{ github.event_name == 'pull_request' }}
97 uses: actions/checkout@v4
100 - name: Setup Python env
101 uses: actions/setup-python@v4
103 python-version: '3.11'
105 cache-dependency-path: 'llvm/docs/requirements.txt'
106 - name: Install python dependencies
107 run: pip install -r llvm/docs/requirements.txt
108 - name: Install system dependencies
111 # swig and graphviz are lldb specific dependencies
112 sudo apt-get install -y cmake ninja-build swig graphviz
113 - name: Build LLVM docs
114 if: steps.docs-changed-subprojects.outputs.llvm_any_changed == 'true'
116 cmake -B llvm-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_SPHINX=ON ./llvm
117 TZ=UTC ninja -C llvm-build docs-llvm-html docs-llvm-man
118 - name: Build Clang docs
119 if: steps.docs-changed-subprojects.outputs.clang_any_changed == 'true'
121 cmake -B clang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_SPHINX=ON ./llvm
122 TZ=UTC ninja -C clang-build docs-clang-html docs-clang-man
123 - name: Build clang-tools-extra docs
124 if: steps.docs-changed-subprojects.outputs.clang-tools-extra_any_changed == 'true'
126 cmake -B clang-tools-extra-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_ENABLE_SPHINX=ON ./llvm
127 TZ=UTC ninja -C clang-tools-extra-build docs-clang-tools-html docs-clang-tools-man
128 - name: Build LLDB docs
129 if: steps.docs-changed-subprojects.outputs.lldb_any_changed == 'true'
131 cmake -B lldb-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_ENABLE_SPHINX=ON ./llvm
132 TZ=UTC ninja -C lldb-build docs-lldb-html docs-lldb-man
133 - name: Build libunwind docs
134 if: steps.docs-changed-subprojects.outputs.libunwind_any_changed == 'true'
136 cmake -B libunwind-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes
137 TZ=UTC ninja -C libunwind-build docs-libunwind-html
138 - name: Build libcxx docs
139 if: steps.docs-changed-subprojects.outputs.libcxx_any_changed == 'true'
141 cmake -B libcxx-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx" -DLLVM_ENABLE_SPHINX=ON ./runtimes
142 TZ=UTC ninja -C libcxx-build docs-libcxx-html
143 - name: Build libc docs
144 if: steps.docs-changed-subprojects.outputs.libc_any_changed == 'true'
146 cmake -B libc-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc" -DLLVM_ENABLE_SPHINX=ON ./runtimes
147 TZ=UTC ninja -C libc-build docs-libc-html
148 - name: Build LLD docs
149 if: steps.docs-changed-subprojects.outputs.lld_any_changed == 'true'
151 cmake -B lld-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="lld" -DLLVM_ENABLE_SPHINX=ON ./llvm
152 TZ=UTC ninja -C lld-build docs-lld-html
153 - name: Build OpenMP docs
154 if: steps.docs-changed-subprojects.outputs.openmp_any_changed == 'true'
156 cmake -B openmp-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;openmp" -DLLVM_ENABLE_SPHINX=ON ./llvm
157 TZ=UTC ninja -C openmp-build docs-openmp-html
158 - name: Build Polly docs
159 if: steps.docs-changed-subprojects.outputs.polly_any_changed == 'true'
161 cmake -B polly-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="polly" -DLLVM_ENABLE_SPHINX=ON ./llvm
162 TZ=UTC ninja -C polly-build docs-polly-html docs-polly-man
163 - name: Build Flang docs
164 if: steps.docs-changed-subprojects.outputs.flang_any_changed == 'true'
165 # TODO(boomanaiden154): Remove the SPHINX_WARNINGS_AS_ERRORS from the
166 # CMake invocation once the warnings in the flang docs build are fixed.
168 cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF ./llvm
169 TZ=UTC ninja -C flang-build docs-flang-html docs-flang-man