Bsamples mre low size doc #3888
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Documentation Build | |
| on: [push, pull_request] | |
| env: | |
| DOXYGEN_VERSION: 1.12.0 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| fetch-depth: 0 | |
| path: sdk-nrf-bm/nrf-bm | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get install -y cmake ninja-build | |
| wget --no-verbose "https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz" | |
| sudo tar xf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz -C /opt | |
| echo "/opt/doxygen-${DOXYGEN_VERSION}/bin" >> $GITHUB_PATH | |
| - name: Set up Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: 3.12 | |
| cache: pip | |
| cache-dependency-path: sdk-nrf-bm/nrf-bm/doc/requirements.txt | |
| - name: Install Python dependencies | |
| working-directory: sdk-nrf-bm/nrf-bm | |
| run: | | |
| pip install west | |
| pip install -r doc/requirements.txt | |
| - name: West update | |
| working-directory: sdk-nrf-bm/nrf-bm | |
| run: | | |
| west init -l . | |
| west update -o=--depth=1 -n | |
| west zephyr-export | |
| - name: Build | |
| working-directory: sdk-nrf-bm/nrf-bm | |
| run: | | |
| cmake -G Ninja -S doc -B doc/_build | |
| cmake --build doc/_build | |
| - name: Check version | |
| run: | | |
| VERSION_REGEX="^v([0-9a-zA-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}" | |
| echo "VERSION=${VERSION}" >> "$GITHUB_ENV" | |
| - name: Prepare Azure upload | |
| working-directory: sdk-nrf-bm/nrf-bm/doc/_build/html | |
| run: | | |
| MONITOR="monitor_${{ github.run_id }}.txt" | |
| # Create documentation upload files | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| ARCHIVE="legacy-ncs-pr-${{ github.event.number }}.zip" | |
| echo "publish2 dev PR-${{ github.event.number }} ${ARCHIVE}" > "${MONITOR}" | |
| echo "${{ github.event.number }}" > pr.txt | |
| else | |
| ARCHIVE="legacy-ncs-${VERSION}.zip" | |
| echo "publish2 main ${VERSION} ${ARCHIVE}" > "${MONITOR}" | |
| fi | |
| zip -rq "${ARCHIVE}" . | |
| - name: Prepare Zoomin upload | |
| if: ${{ github.event_name == 'push' }} | |
| working-directory: sdk-nrf-bm/nrf-bm | |
| run: | | |
| PUBLISH="$PWD/publish" | |
| mkdir -p "$PUBLISH" | |
| # Doxygen APIs combined with Sphinx | |
| declare -a SPHINX_DOXYGEN=("nrf-bm") | |
| # Doxygen APIs standalone | |
| declare -a DOXYGEN=("s115" "s145") | |
| mkdir doc/_build/html-doxygen | |
| for docset in "${SPHINX_DOXYGEN[@]}"; do | |
| OUTDIR=doc/_build/html-doxygen/$docset-apis | |
| mv doc/_build/html/$docset/doxygen/html "$OUTDIR" | |
| # Populate custom.properties, tags.yml | |
| cp doc/_zoomin/$docset.apis.custom.properties "$OUTDIR/custom.properties" | |
| sed -i 's/__VERSION__/'"$VERSION"'/g' "$OUTDIR/custom.properties" | |
| cp doc/_zoomin/$docset.apis.tags.yml "$OUTDIR/tags.yml" | |
| sed -i 's/__VERSION__/'"$VERSION"'/g' "$OUTDIR/tags.yml" | |
| # Patch links from Sphinx to other Doxygen APIs (combined) | |
| find doc/_build/html/$docset -type f -name "*.html" -exec sed -ri "/href=\"([^\"]+)\/([a-z]+)\/doxygen\/html\/([^\"]+)\"/{s//href=\"\/bundle\/\1\/\2-apis-$VERSION\/page\/\3\"/g; :a s/__/_/g;ta; }" {} \; | |
| for doxset in "${DOXYGEN[@]}"; do | |
| # Patch links from Sphinx to other Doxygen APIs (standalone) | |
| find doc/_build/html/$docset -type f -name "*.html" -exec sed -ri "/href=\"([^\"]+)\/$doxset\/html\/([^\"]+)\"/{s//href=\"\/bundle\/\1\/$doxset-apis-$VERSION\/page\/\2\"/g; :a s/__/_/g;ta; }" {} \; | |
| done | |
| # Patch links from Sphinx to same docset Doxygen APIs | |
| find doc/_build/html/$docset -type f -name "*.html" -exec sed -ri "/href=\"([^\"]+)\/doxygen\/html\/([^\"]+)\"/{s//href=\"\/bundle\/$docset-apis-$VERSION\/page\/\2\"/g; :a s/__/_/g;ta; }" {} \; | |
| pushd "$OUTDIR" | |
| ARCHIVE="$docset-apis-$VERSION.zip" | |
| zip -rq "$ARCHIVE" . | |
| mv "$ARCHIVE" "$PUBLISH" | |
| popd | |
| done | |
| for docset in "${DOXYGEN[@]}"; do | |
| OUTDIR=doc/_build/html-doxygen/$docset-apis | |
| mv doc/_build/html/$docset/html "$OUTDIR" | |
| # Populate custom.properties, tags.yml | |
| cp doc/_zoomin/$docset.apis.custom.properties "$OUTDIR/custom.properties" | |
| sed -i 's/__VERSION__/'"$VERSION"'/g' "$OUTDIR/custom.properties" | |
| cp doc/_zoomin/$docset.apis.tags.yml "$OUTDIR/tags.yml" | |
| sed -i 's/__VERSION__/'"$VERSION"'/g' "$OUTDIR/tags.yml" | |
| pushd "$OUTDIR" | |
| ARCHIVE="$docset-apis-$VERSION.zip" | |
| zip -rq "$ARCHIVE" . | |
| mv "$ARCHIVE" "$PUBLISH" | |
| popd | |
| done | |
| # nRF Bare Metal | |
| OUTDIR=doc/_build/html | |
| # Populate custom.properties, tags.yml | |
| cp doc/_zoomin/nrf-bm.custom.properties "$OUTDIR/custom.properties" | |
| sed -i 's/__VERSION__/'"$VERSION"'/g' "$OUTDIR/custom.properties" | |
| cp doc/_zoomin/nrf-bm.tags.yml "$OUTDIR/tags.yml" | |
| sed -i 's/__VERSION__/'"$VERSION"'/g' "$OUTDIR/tags.yml" | |
| ARCHIVE="nrf-bm-$VERSION.zip" | |
| pushd "$OUTDIR" | |
| zip -rq "$ARCHIVE" . | |
| mv "$ARCHIVE" "$PUBLISH" | |
| popd | |
| - name: Find nRF Connect SDK Bare Metal Edited Documents | |
| working-directory: sdk-nrf-bm/nrf-bm | |
| run: | | |
| COMMENT="comment.txt" | |
| PREFIX="https://ncsbmdoc.z6.web.core.windows.net/PR-${{ github.event.pull_request.number }}/" | |
| echo "You can find the documentation preview for this PR [here](${PREFIX})." >> $COMMENT | |
| - name: Stage files for publish | |
| working-directory: sdk-nrf-bm/nrf-bm | |
| run: | | |
| mkdir -p publish | |
| cp doc/_build/html/monitor_*.txt publish/ | |
| cp doc/_build/html/*.zip publish/ | |
| if [[ -f doc/_build/html/pr.txt ]]; then cp doc/_build/html/pr.txt publish/; fi | |
| cp comment.txt publish/ | |
| - name: Store | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') || contains(github.event.pull_request.labels.*.name, 'CI-trusted-author') }} | |
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4 | |
| with: | |
| name: docs | |
| retention-days: 5 | |
| path: | | |
| sdk-nrf-bm/nrf-bm/publish/* |