[DLS] Documentation PR workflow (by @hteeyeoh via push) #39
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: "[DLS] Documentation PR workflow" | |
| run-name: "[DLS] Documentation PR workflow (by @${{ github.actor }} via ${{ github.event_name }})" | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'libraries/dl-streamer/docs/**' | |
| pull_request: | |
| paths: | |
| - 'libraries/dl-streamer/docs/**' | |
| permissions: {} | |
| jobs: | |
| build-docs: | |
| name: Build DL Streamer documentation | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check out edge-ai-libraries repository/libraries/dl-streamer | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #5.0.0 | |
| with: | |
| persist-credentials: false | |
| sparse-checkout: | | |
| libraries/dl-streamer | |
| - name: Run build script | |
| run: | | |
| ./libraries/dl-streamer/docs/build_html.sh "actions-gh-pages:latest" gh-pages | |
| - name: Documentation build summary | |
| if: always() | |
| run: | | |
| summary_content="" | |
| # Check if index.html for documentation exists | |
| index_file_path='./libraries/dl-streamer/docs/build-html/index.html' | |
| if [ -f "$index_file_path" ]; then | |
| result="Documentation built: YES :white_check_mark:" | |
| else | |
| result="Documentation built: NO :x:" | |
| fi | |
| echo "$result" | |
| summary_content+="$result\n" | |
| # Check broken links in linkcheck | |
| linkcheck_file_path='./libraries/dl-streamer/docs/build-linkcheck/output.txt' | |
| broken_count=$(grep -o '\[broken\]' "$linkcheck_file_path" | wc -l) | |
| if [ "$broken_count" -eq 0 ]; then | |
| result="Broken links: $broken_count :white_check_mark:" | |
| else | |
| result="Broken links: $broken_count :x:" | |
| fi | |
| echo "$result" | |
| summary_content+="$result\n" | |
| # Spelling | |
| result="Spelling: check report from artifacts" | |
| echo "$result" | |
| summary_content+="$result\n" | |
| echo "### Building with Sphinx results" >> $GITHUB_STEP_SUMMARY | |
| echo -e "$summary_content" >> $GITHUB_STEP_SUMMARY | |
| - name: Check specific links | |
| if: always() | |
| run: | | |
| cd ./libraries/dl-streamer/docs | |
| python3 ./scripts/specific_links_checker.py 2>&1 | tee specific_links_checker_report.txt | |
| summary=$(grep -E '✅ All links are working\.|❌ [0-9]+ broken link\(s\)' specific_links_checker_report.txt | tail -n 1) | |
| echo "### Extra links checker" >> $GITHUB_STEP_SUMMARY | |
| echo "$summary" >> $GITHUB_STEP_SUMMARY | |
| - name: Upload linkcheck report | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #4.6.2 | |
| if: always() | |
| with: | |
| name: docs_linkcheck_report | |
| path: ./libraries/dl-streamer/docs/build-linkcheck/ | |
| - name: Upload specific links checker report | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #4.6.2 | |
| if: always() | |
| with: | |
| name: docs_specific_links_checker_report | |
| path: ./libraries/dl-streamer/docs/specific_links_checker_report.txt | |
| - name: Upload spelling report | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #4.6.2 | |
| if: always() | |
| with: | |
| name: docs_spelling_report | |
| path: ./libraries/dl-streamer/docs/build-spelling/ | |
| - name: Upload pages | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #4.6.2 | |
| if: always() | |
| with: | |
| name: docs_site | |
| path: ./libraries/dl-streamer/docs/build-html | |
| - name: Clean up | |
| if: always() | |
| run: | | |
| rm -rf edge-ai-libraries-repo |