File: generate-docs.yml

package info (click to toggle)
amdsmi 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,316 kB
  • sloc: cpp: 41,766; python: 22,219; ansic: 12,789; sh: 754; makefile: 20
file content (83 lines) | stat: -rw-r--r-- 2,538 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Generate Documentation

on:
  pull_request:
    branches: [amd-staging, amd-mainline, release/rocm-rel-*]
  push:
    branches: [amd-staging, amd-mainline, release/rocm-rel-*]
  workflow_dispatch:

permissions:
  contents: read

env:
  DEBIAN_FRONTEND: noninteractive
  DEBCONF_NONINTERACTIVE_SEEN: true
  BUILD_TYPE: Release

jobs:
  generate-docs:
    name: Generate Documentation
    runs-on: AMD-ROCm-Internal-dev1
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Get branch name for artifact naming
        id: get_branch_info
        run: |
          BRANCH_NAME=""
          if [[ "${{ github.event_name }}" == "pull_request" ]]; then
            BRANCH_NAME="${{ github.head_ref }}"
          else
            BRANCH_NAME="${{ github.ref_name }}"
          fi
          SANITIZED_NAME=$(echo "$BRANCH_NAME" | sed -e 's|/|-|g' -e 's|[^a-zA-Z0-9._-]||g' -e 's|^-*||' -e 's|-*$||')
          if [[ -z "$SANITIZED_NAME" ]]; then
            SANITIZED_NAME="docs-$(date +%s)"
          fi
          echo "sanitized_name=${SANITIZED_NAME}" >> $GITHUB_OUTPUT

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.12'

      - name: Install System Dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y doxygen graphviz

      - name: Set Up Python Environment
        run: |
          python3 -m pip install --upgrade pip
          python3 -m pip install -r docs/sphinx/requirements.txt

      - name: Build Documentation
        run: |
          if [ ! -e "docs/.git" ]; then
            if [ -d ".git" ]; then
              ln -s ../.git docs/.git
            fi
          fi
          cd docs
          python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html

      - name: Upload Documentation
        uses: actions/upload-artifact@v4
        with:
          name: documentation-${{ steps.get_branch_info.outputs.sanitized_name }}
          path: docs/_build/html/

      - name: Generate Job Summary
        run: |
          cat >> $GITHUB_STEP_SUMMARY << 'EOF'
          # 📚 Documentation Generated Successfully!

          ## 🚀 Quick Start
          
          1. **📥 Download** the artifact `documentation-${{ steps.get_branch_info.outputs.sanitized_name }}`
          2. **📂 Extract** the ZIP file 
          3. **🖱️ Double-click** `index.html`
          4. **✅ Done!** Documentation opens with full formatting in your browser
          EOF