[v2,1/2] Split documentation build into separate build step
diff mbox series

Message ID 20260511134817.2841886-2-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • Deploy documentation to docs.libcamera.org
Related show

Commit Message

Stefan Klug May 11, 2026, 1:48 p.m. UTC
Create a separate build step that builds the docs and merges the html
docs and the api docs into a single docs directory.

Drop the documentation build from the build-full step as it is no longer
needed there.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

---

Changes in v2:
- Fixed copyright
- Fixed comments and build message
- Build debug for now, as the upstream release build is broken
- Collect docs from a temporary install dir
---
 .gitlab-ci/build-libcamera-docs.sh | 35 ++++++++++++++++++++++++++++++
 gitlab-ci.yml                      | 30 +++++++++++++++++++++----
 2 files changed, 61 insertions(+), 4 deletions(-)
 create mode 100755 .gitlab-ci/build-libcamera-docs.sh

Patch
diff mbox series

diff --git a/.gitlab-ci/build-libcamera-docs.sh b/.gitlab-ci/build-libcamera-docs.sh
new file mode 100755
index 000000000000..cccb5bad9cb5
--- /dev/null
+++ b/.gitlab-ci/build-libcamera-docs.sh
@@ -0,0 +1,35 @@ 
+#!/bin/bash
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+# SPDX-FileCopyrightText: © 2026 Ideas on Board
+#
+# Build libcamera docs and collect them in ./docs
+
+set -e
+
+source "$(dirname "$0")/lib.sh"
+source "$(dirname "$0")/build-libcamera-common.sh"
+
+libcamera_build_docs() {
+	echo "Building libcamera docs"
+
+	# Fixme: This should only build the documentation, but as we can't use
+	# the doc tag for installation we need to build everything.
+	meson compile -C build -j$BUILD_CONCURRENT_JOBS
+
+	echo "Installing docs"
+	rm -rf install
+	mkdir install
+
+	# Fixme: This should use --tags doc,doc-internal, but the installation
+	# mechanics are broken and need to be fixed in libcamera. Install the
+	# whole project for now.
+	meson install -C build --destdir $(pwd)/install
+
+	rm -rf docs
+	mv install/usr/local/share/doc/libcamera-*/html docs
+}
+
+run libcamera_install_pkgs
+run libcamera_setup
+run libcamera_build_docs collapsed
diff --git a/gitlab-ci.yml b/gitlab-ci.yml
index f887e3b6c221..7c5e59de30a1 100644
--- a/gitlab-ci.yml
+++ b/gitlab-ci.yml
@@ -229,10 +229,6 @@  build-full:debian:13:
       - ARCH: amd64
         CC: gcc-14
         CXX: g++-14
-        MESON_OPTIONS: >-
-          ${MESON_ALL_OPTIONS}
-          -D documentation=enabled
-          -D doc_werror=true
       - ARCH: amd64
         CC: clang
         CXX: clang++
@@ -302,6 +298,32 @@  build-package:debug:
       - ARCH: amd64
       - ARCH: arm64
 
+# Build documentation.
+build-docs:
+  extends:
+    - .fdo.distribution-image@debian
+    - .libcamera-ci.debian:13
+    - .libcamera-ci.scripts
+  stage: build
+  needs:
+    - job: container-debian:13
+      artifacts: false
+  script:
+    - $CI_PROJECT_DIR/.gitlab-ci/build-libcamera-docs.sh
+  artifacts:
+    name: libcamera-docs-${CI_COMMIT_SHA}
+    when: always
+    expire_in: 1 week
+    paths:
+      - docs
+  variables:
+    # Fixme: Switch to release build as soon as the build issues are fixed.
+    BUILD_TYPE: debug
+    MESON_OPTIONS: >-
+      ${MESON_ALL_OPTIONS}
+      -D documentation=enabled
+      -D doc_werror=true
+
 # ------------------------------------------------------------------------------
 # Lint stage - Run checkstyle.py and check merge suitability
 # ------------------------------------------------------------------------------