Skip to content

Commit

Permalink
ci: handle Doxygen bundles for Zoomin
Browse files Browse the repository at this point in the history
Doxygen content needs to be served now that breathe has gone from
Zephyr.

Signed-off-by: Gerard Marull-Paretas <[email protected]>
  • Loading branch information
gmarull authored and carlescufi committed Sep 9, 2024
1 parent 37ae534 commit 9d2c0f9
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 15 deletions.
67 changes: 54 additions & 13 deletions .github/workflows/docbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,43 +68,84 @@ jobs:
cmake -GNinja -Bdoc/_build -Sdoc
ninja -C doc/_build
- name: Prepare archive
- name: Check version
run: |
VERSION_REGEX="^v([0-9a-z\.\-]+)$"
if [[ ${GITHUB_REF#refs/tags/} =~ $VERSION_REGEX ]]; then
VERSION=${BASH_REMATCH[1]}
elif [[ ${GITHUB_REF#refs/heads/} == "main" ]]; then
VERSION="latest"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
VERSION="pr-${{ github.event.number }}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Prepare legacy upload
if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }}
working-directory: ncs/nrf
run: |
MONITOR="monitor_${{ github.run_id }}.txt"
# Create documentation upload files
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
ARCHIVE="doc_build_pr_${{ github.event.number }}.zip"
ARCHIVE="doc_build_pr_${{ github.event.number }}_legacy.zip"
echo "publish2 dev PR-${{ github.event.number }} ${ARCHIVE}" > "${MONITOR}"
echo "${{ github.event.number }}" > pr.txt
else
VERSION_REGEX="^v([0-9a-z\.\-]+)$"
if [[ ${GITHUB_REF#refs/tags/} =~ $VERSION_REGEX ]]; then
VERSION=${BASH_REMATCH[1]}
elif [[ ${GITHUB_REF#refs/heads/} == "main" ]]; then
VERSION="latest"
else
if [ -z "${VERSION}" ]; then
echo "Not a release or latest, skipping publish"
exit 0
fi
ARCHIVE="doc_build_${VERSION}.zip"
ARCHIVE="doc_build_${VERSION}_legacy.zip"
echo "publish2 main ${VERSION} ${ARCHIVE}" > "${MONITOR}"
fi
# add zoomin metadata
cd doc/_build/html
zip -rq "${ARCHIVE}" .
mv "${ARCHIVE}" ../../../
- name: Prepare Zoomin upload
if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }}
working-directory: ncs/nrf
run: |
mkdir doc/_build/html-doxygen
# Zephyr APIs (Doxygen)
mv doc/_build/html/zephyr/doxygen/html doc/_build/html-doxygen/zephyr-apis
cp doc/_zoomin/zephyr.apis.custom.properties doc/_build/html-doxygen/zephyr-apis/custom.properties
sed -i 's/__VERSION__/'"${VERSION}"'/g' doc/_build/html-doxygen/zephyr-apis/custom.properties
cp doc/_zoomin/zephyr.apis.tags.yml doc/_build/html-doxygen/zephyr-apis/tags.yml
sed -i 's/__VERSION__/'"${VERSION}"'/g' doc/_build/html-doxygen/zephyr-apis/tags.yml
# NCS (Sphinx)
cp doc/_zoomin/ncs.custom.properties doc/_build/html/custom.properties
sed -i 's/__VERSION__/'"${VERSION}"'/g' doc/_build/html/custom.properties
# add zoomin tags file
cp doc/_zoomin/ncs.tags.yml doc/_build/html/tags.yml
sed -i 's/__VERSION__/'"${VERSION}"'/g' doc/_build/html/tags.yml
# compress
cd doc/_build/html
# Patch links from Zephyr (Sphinx) to Zephyr APIs (Doxygen)
find doc/_build/html/zephyr -type f -name "*.html" -exec \
sed -ri "/href=\"(.*)\/doxygen\/html\/(.*)\"/{s//href=\"\1\/..\/..\/..\/zephyr-apis-$VERSION\/page\/\2\"/; :a s/__/_/;ta; }" {} \;
# Prepare archives
cd doc/_build/
cd html-doxygen/zephyr-apis
ARCHIVE="doc_build_${VERSION}_zoomin_doxygen_zephyr_apis.zip"
zip -rq "${ARCHIVE}" .
mv "${ARCHIVE}" ../../../../
cd ../../
ARCHIVE="doc_build_${VERSION}_zoomin_sphinx_ncs.zip"
cd html
zip -rq "${ARCHIVE}" .
mv "${ARCHIVE}" ../../../
cd ..
- name: Store
if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }}
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/docpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
mkdir -p ~/.ssh && \
ssh-keyscan -p 2222 transfer.nordicsemi.no >> ~/.ssh/known_hosts
# upload files
for file in docs/*.zip docs/monitor*.txt; do
for file in docs/*legacy.zip docs/monitor*.txt; do
echo "put ${file}" | \
sshpass -e sftp -P 2222 -o BatchMode=no -b - [email protected]
done
Expand All @@ -53,7 +53,17 @@ jobs:
chmod 600 zoomin_key
# upload files
for file in docs/*.zip; do
for file in docs/*zoomin_doxygen*.zip; do
sftp -v -i zoomin_key [email protected] <<EOF
cd docs-be.nordicsemi.com/doxygen/incoming
put ${file}
cd ../../../nordic-be-dev.zoominsoftware.io/doxygen/incoming
put ${file}
quit
EOF
done
for file in docs/*zoomin_sphinx*.zip; do
sftp -v -i zoomin_key [email protected] <<EOF
cd docs-be.nordicsemi.com/sphinx-html/incoming
put ${file}
Expand Down
2 changes: 2 additions & 0 deletions doc/_zoomin/zephyr.apis.custom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
manual.name=zephyr-apis-__VERSION__
booktitle=Zephyr APIs - __VERSION__
9 changes: 9 additions & 0 deletions doc/_zoomin/zephyr.apis.tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Document tags for Zoomin.

# Tags for all topics:
mapping_global:
- zephyr-apis
- zephyr-apis-__VERSION__

# Tags for individual topics:
mapping_topics: []

0 comments on commit 9d2c0f9

Please sign in to comment.