Skip to content

Commit 292575e

Browse files
authored
[DLStreamer] New CI workflow for building DL Streamer documentation (#176)
Signed-off-by: dmichalo <dawid.michalowski@intel.com>
1 parent bec2516 commit 292575e

File tree

3 files changed

+152
-1
lines changed

3 files changed

+152
-1
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: "[DLS] Documentation PR workflow"
2+
run-name: "[DLS] Documentation PR workflow (by @${{ github.actor }} via ${{ github.event_name }})"
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
paths:
8+
- 'libraries/dl-streamer/docs/**'
9+
pull_request:
10+
paths:
11+
- 'libraries/dl-streamer/docs/**'
12+
permissions: read-all
13+
14+
jobs:
15+
build-docs:
16+
name: Build DL Streamer documentation
17+
runs-on: ubuntu-latest # Change to self-hosted when ready to unblock linkcheck: [self-hosted, linux]
18+
steps:
19+
- name: Check out edge-ai-libraries repository/libraries/dl-streamer
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2
21+
with:
22+
sparse-checkout: |
23+
libraries/dl-streamer
24+
25+
- name: Run build script
26+
run: |
27+
./libraries/dl-streamer/docs/build_html.sh "actions-gh-pages:latest" gh-pages
28+
29+
- name: Documentation build summary
30+
if: always()
31+
run: |
32+
summary_content=""
33+
34+
# Check if index.html for documentation exists
35+
index_file_path='./libraries/dl-streamer/docs/build-html/index.html'
36+
if [ -f "$index_file_path" ]; then
37+
result="Documentation built: YES :white_check_mark:"
38+
else
39+
result="Documentation built: NO :x:"
40+
fi
41+
echo "$result"
42+
summary_content+="$result\n"
43+
44+
# Check broken links in linkcheck
45+
linkcheck_file_path='./libraries/dl-streamer/docs/build-linkcheck/output.txt'
46+
broken_count=$(grep -o '\[broken\]' "$linkcheck_file_path" | wc -l)
47+
if [ "$broken_count" -eq 0 ]; then
48+
result="Broken links: $broken_count :white_check_mark:"
49+
else
50+
result="Broken links: $broken_count :x:"
51+
fi
52+
echo "$result"
53+
summary_content+="$result\n"
54+
55+
# Spelling
56+
result="Spelling: check report from artifacts"
57+
echo "$result"
58+
summary_content+="$result\n"
59+
60+
echo -e "$summary_content" >> $GITHUB_STEP_SUMMARY
61+
62+
- name: Upload linkcheck report
63+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #4.6.2
64+
if: always()
65+
with:
66+
name: docs_linkcheck_report
67+
path: ./libraries/dl-streamer/docs/build-linkcheck/
68+
69+
- name: Upload spelling report
70+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #4.6.2
71+
if: always()
72+
with:
73+
name: docs_spelling_report
74+
path: ./libraries/dl-streamer/docs/build-spelling/
75+
76+
- name: Upload pages
77+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #4.6.2
78+
if: always()
79+
with:
80+
name: docs_site
81+
path: ./libraries/dl-streamer/docs/build-html
82+
83+
- name: Clean up
84+
if: always()
85+
run: |
86+
rm -rf edge-ai-libraries-repo

libraries/dl-streamer/docs/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
build**
1+
build**/
22

33
source/_doxygen/src/
44
source/_doxygen/src-api2.0/
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
# ==============================================================================
3+
# Copyright (C) 2022-2025 Intel Corporation
4+
#
5+
# SPDX-License-Identifier: MIT
6+
# ==============================================================================
7+
8+
IMAGE_NAME=${1:-"sphinx-docs:latest"}
9+
CONTAINER_NAME=${2:-docs_pages}
10+
DOCKER_PRIVATE_REGISTRY=${3:-""}
11+
12+
ROOT="$(realpath "$(dirname "${0}")"/..)"
13+
DOCS_DIR=$ROOT/docs
14+
DOXYGEN_DIR=$ROOT/docs/source/_doxygen
15+
IMAGE_DOCS_DIR=/root/docs
16+
17+
# Copy necessary files located outside of this folder
18+
echo "::group::Prepare for docker build"
19+
cp -r "$ROOT"/samples/model_index.yaml "$DOCS_DIR"
20+
cp -r "$ROOT"/samples/verified_models.json "$DOCS_DIR"
21+
mkdir -p "$DOXYGEN_DIR"/src
22+
cp -r "$ROOT"/gst-libs/gst/videoanalytics "$ROOT"/python/gstgva "$ROOT"/include/dlstreamer/gst/metadata "$DOXYGEN_DIR"/src
23+
mkdir -p "$DOXYGEN_DIR"/src-api2.0
24+
cp -r "$ROOT"/include/dlstreamer "$DOXYGEN_DIR"/src-api2.0
25+
echo "::endgroup::"
26+
27+
# Build docker image
28+
echo "::group::Building docker image"
29+
docker_build="docker build \
30+
-f $DOCS_DIR/_docker/Dockerfile \
31+
-t $IMAGE_NAME \
32+
--build-arg DOCKER_PRIVATE_REGISTRY=$DOCKER_PRIVATE_REGISTRY \
33+
--build-arg DOCS_DIR=$IMAGE_DOCS_DIR \
34+
$DOCS_DIR"
35+
echo "$docker_build"
36+
if ! $docker_build ; then
37+
echo "::error::docker build failed"
38+
exit 1
39+
fi
40+
echo "::endgroup::"
41+
42+
echo "::group::Removing container"
43+
docker container rm "$CONTAINER_NAME"
44+
echo "::endgroup::"
45+
46+
# Building
47+
echo "Building..."
48+
BUILD_TYPES="html,spelling,linkcheck"
49+
docker run --name "$CONTAINER_NAME" "$IMAGE_NAME" ./scripts/sphinx_build.sh "$BUILD_TYPES"
50+
RUN_RESULT=$?
51+
52+
echo "::group::Gathering build result"
53+
IFS=',' read -ra BUILDS <<< "$BUILD_TYPES"
54+
for btype in "${BUILDS[@]}"; do
55+
build_dir="build-$btype"
56+
rm -rf "$build_dir"
57+
# Copy
58+
docker cp "$CONTAINER_NAME":$IMAGE_DOCS_DIR/"$build_dir" "$DOCS_DIR"
59+
# Remove non-relevant things
60+
rm -rf "$DOCS_DIR"/"$build_dir"/.buildinfo "$DOCS_DIR"/"$build_dir"/.doctrees/
61+
done
62+
echo "::endgroup::"
63+
64+
echo "Done, exit code $RUN_RESULT"
65+
exit $RUN_RESULT

0 commit comments

Comments
 (0)