Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

Recently, support for building the LLVM documentation within Github actions landed, allowing for easy testing of the docs both pre and post landing. This patch extends that functionality to clang and adds in additional support to the docs Github workflow to only build the docs for the subproject whose documentation has been touched.

Recently, support for building the LLVM documentation within Github
actions landed, allowing for easy testing of the docs both pre and post
landing. This patch extends that functionality to clang and adds in
additional support to the docs Github workflow to only build the docs
for the subproject whose documentation has been touched.
@llvmbot
Copy link
Member

llvmbot commented Oct 19, 2023

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

Changes

Recently, support for building the LLVM documentation within Github actions landed, allowing for easy testing of the docs both pre and post landing. This patch extends that functionality to clang and adds in additional support to the docs Github workflow to only build the docs for the subproject whose documentation has been touched.


Full diff: https://github.com/llvm/llvm-project/pull/69550.diff

1 Files Affected:

  • (modified) .github/workflows/docs.yml (+22-3)
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 5133309eb8cf948..315f8d59037ef1d 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -14,9 +14,11 @@ on:
       - 'main'
     paths:
       - 'llvm/docs/**'
+      - 'clang/docs/**'
   pull_request:
     paths:
       - 'llvm/docs/**'
+      - 'clang/docs/**'
 
 jobs:
   check-docs-build:
@@ -39,10 +41,27 @@ jobs:
         run: |
           sudo apt-get update
           sudo apt-get install -y cmake ninja-build
-      - name: Build docs
+      - name: Get subprojects that have doc changes
+        id: docs-changed-subprojects
+        uses: tj-actions/changed-files@v39
+        with:
+          files_yaml: |
+            llvm:
+              - 'llvm/docs/**'
+            clang:
+              - 'clang/docs/**'
+      - name: Build LLVM docs
+        if: steps.docs-changed-subprojects.outputs.llvm_any_changed == 'true'
         run: |
-          mkdir build
-          cd build
+          mkdir llvm-build
+          cd llvm-build
           cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_SPHINX=ON -DSPHINX_OUTPUT_HTML=ON -DSPHINX_OUTPUT_MAN=ON ../llvm
           TZ=UTC ninja docs-llvm-html docs-llvm-man
+      - name: Build Clang docs
+        if: steps.docs-changed-subprojects.outputs.clang_any_changed == 'true'
+        run: |
+          mkdir clang-build
+          cd clang-build
+          cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_SPHINX=ON -DSPHINX_OUTPUT_HTML=ON -DSPHINX_OUTPUT_MAN=ON ../llvm
+          TZ=UTC ninja docs-clang-html docs-clang-man
 

@boomanaiden154
Copy link
Contributor Author

I've set everything up in the same job for now mostly because it was simple. We can split it into multiple jobs if necessary, but I don't think many patches touch the docs of multiple subprojects, and those that do still won't run into any problems with the job taking too long. From my testing on my fork, building both the LLVM and clang docs takes under 10 minutes, even with clang having to build clang-tblgen.

@boomanaiden154
Copy link
Contributor Author

This will fix #65725.

Copy link
Collaborator

@tstellar tstellar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you this looks great. LGTM.

@boomanaiden154
Copy link
Contributor Author

Thank you for the review! I'll probably post something on discourse soon too to get attention for other subprojects that might want this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants