Skip to content

[Github] Upload built docs as artifact from test build docs job #118159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

boomanaiden154
Copy link
Contributor

This patch makes the test documentation build job upload the docs that have been built as artifacts. This makes it much easier to take a peek at the resulting documentation rather than just being able to see that it builds.

This patch makes the test documentation build job upload the docs that
have been built as artifacts. This makes it much easier to take a peek
at the resulting documentation rather than just being able to see that
it builds.
@llvmbot
Copy link
Member

llvmbot commented Nov 30, 2024

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

Changes

This patch makes the test documentation build job upload the docs that have been built as artifacts. This makes it much easier to take a peek at the resulting documentation rather than just being able to see that it builds.


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

1 Files Affected:

  • (modified) .github/workflows/docs.yml (+29)
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 800e9291573533..2e4009994a2b0d 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -112,58 +112,87 @@ jobs:
           sudo apt-get update
           # swig and graphviz are lldb specific dependencies
           sudo apt-get install -y cmake ninja-build swig graphviz
+      - name: Setup output folder
+        run: mkdir built-docs
       - name: Build LLVM docs
         if: steps.docs-changed-subprojects.outputs.llvm_any_changed == 'true'
         run: |
           cmake -B llvm-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_SPHINX=ON ./llvm
           TZ=UTC ninja -C llvm-build docs-llvm-html docs-llvm-man
+          mkdir built-docs/llvm
+          cp -r llvm-build/docs/* built-docs/llvm/
       - name: Build Clang docs
         if: steps.docs-changed-subprojects.outputs.clang_any_changed == 'true'
         run: |
           cmake -B clang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_SPHINX=ON ./llvm
           TZ=UTC ninja -C clang-build docs-clang-html docs-clang-man
+          mkdir built-docs/clang
+          cp -r clang-build/docs/* built-docs/clang/
       - name: Build clang-tools-extra docs
         if: steps.docs-changed-subprojects.outputs.clang-tools-extra_any_changed == 'true'
         run: |
           cmake -B clang-tools-extra-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_ENABLE_SPHINX=ON ./llvm
           TZ=UTC ninja -C clang-tools-extra-build docs-clang-tools-html docs-clang-tools-man
+          mkdir built-docs/clang-tools-extra
+          cp -r clang-tools-extra-build/docs/* built-docs/clang-tools-extra/
       - name: Build LLDB docs
         if: steps.docs-changed-subprojects.outputs.lldb_any_changed == 'true'
         run: |
           cmake -B lldb-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_ENABLE_SPHINX=ON ./llvm
           TZ=UTC ninja -C lldb-build docs-lldb-html docs-lldb-man
+          mkdir built-docs/lldb
+          cp -r lldb-build/docs/* built-docs/lldb/
       - name: Build libunwind docs
         if: steps.docs-changed-subprojects.outputs.libunwind_any_changed == 'true'
         run: |
           cmake -B libunwind-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes
           TZ=UTC ninja -C libunwind-build docs-libunwind-html
+          mkdir built-docs/libunwind
+          cp -r libunwind-build/docs/* built-docs/libunwind
       - name: Build libcxx docs
         if: steps.docs-changed-subprojects.outputs.libcxx_any_changed == 'true'
         run: |
           cmake -B libcxx-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx;libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes
           TZ=UTC ninja -C libcxx-build docs-libcxx-html
+          mkdir built-docs/libcxx
+          cp -r libcxx-build/docs/* built-docs/libcxx/
       - name: Build libc docs
         if: steps.docs-changed-subprojects.outputs.libc_any_changed == 'true'
         run: |
           cmake -B libc-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc" -DLLVM_ENABLE_SPHINX=ON ./runtimes
           TZ=UTC ninja -C libc-build docs-libc-html
+          mkdir built-docs/libc
+          cp -r libc-build/docs/* built-docs/libc/
       - name: Build LLD docs
         if: steps.docs-changed-subprojects.outputs.lld_any_changed == 'true'
         run: |
           cmake -B lld-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="lld" -DLLVM_ENABLE_SPHINX=ON ./llvm
           TZ=UTC ninja -C lld-build docs-lld-html
+          mkdir built-docs/lld
+          cp -r lld-build/docs/* built-docs/lld/
       - name: Build OpenMP docs
         if: steps.docs-changed-subprojects.outputs.openmp_any_changed == 'true'
         run: |
           cmake -B openmp-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;openmp" -DLLVM_ENABLE_SPHINX=ON ./llvm
           TZ=UTC ninja -C openmp-build docs-openmp-html
+          mkdir built-docs/openmp
+          cp -r openmp-build/docs/* built-docs/openmp/
       - name: Build Polly docs
         if: steps.docs-changed-subprojects.outputs.polly_any_changed == 'true'
         run: |
           cmake -B polly-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="polly" -DLLVM_ENABLE_SPHINX=ON ./llvm
           TZ=UTC ninja -C polly-build docs-polly-html docs-polly-man
+          mkdir built-docs/polly
+          cp -r polly-build/docs/* built-docs/polly/
       - name: Build Flang docs
         if: steps.docs-changed-subprojects.outputs.flang_any_changed == 'true'
         run: |
           cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON ./llvm
           TZ=UTC ninja -C flang-build docs-flang-html
+          mkdir built-docs/flang
+          cp -r flang-build/docs/* built-docs/flang/
+      - name: Upload docs
+        uses: actions/upload-artifact@v4
+        with:
+          name: docs-output
+          path: built-docs/

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.

LGTM.

@boomanaiden154 boomanaiden154 merged commit 97f94af into llvm:main Dec 2, 2024
9 checks passed
@boomanaiden154 boomanaiden154 deleted the docs-upload-artifacts branch December 2, 2024 16:02
nickdesaulniers added a commit to nickdesaulniers/llvm-project that referenced this pull request Dec 3, 2024
Running `ninja docs-libc-html` produces content in {build_dir}/libc/docs, not
{build_dir}/docs. Presubmit jobs for "Test documentation build" were failing as
a result of commit 97f94af ("[Github] Upload built docs as artifact from
test build docs job (llvm#118159)")
nickdesaulniers added a commit that referenced this pull request Dec 3, 2024
Running `ninja docs-libc-html` produces content in
{build_dir}/libc/docs, not
{build_dir}/docs. Presubmit jobs for "Test documentation build" were
failing as
a result of commit 97f94af ("[Github] Upload built docs as artifact
from
test build docs job (#118159)")

Link: #118159
Link: #117220
@ldionne
Copy link
Member

ldionne commented Dec 3, 2024

This broke the documentation build for libc and for libc++. To test this, dummy documentation jobs should have been triggered by touching stuff in e.g. libcxx/docs. Just a heads up: I'll try fixing this for libc++, but it's possible that other people end up here after some head scratching!

ldionne added a commit to ldionne/llvm-project that referenced this pull request Dec 3, 2024
@boomanaiden154
Copy link
Contributor Author

This broke the documentation build for libc and for libc++. To test this, dummy documentation jobs should have been triggered by touching stuff in e.g. libcxx/docs. Just a heads up: I'll try fixing this for libc++, but it's possible that other people end up here after some head scratching!

Yeah, this definitely should have been tested better. I assumed the directory structure would be symmetric, but it seems like the runtimes have a different docs directory structure. Once I have some time I'll go through and check the rest of the projects and also make some modifications to the workflow so we test building all of the projects' docs if we modify the workflow definition.

Thanks for submitting the forward fixes!

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.

4 participants