|
| 1 | +name: Documentation Build |
| 2 | +description: Composite action to build and upload documentation (HTML and PDF) |
| 3 | + |
| 4 | +inputs: |
| 5 | + |
| 6 | + build-autokeywords-api: |
| 7 | + description: Enable building the autokeywords API |
| 8 | + required: false |
| 9 | + default: "False" |
| 10 | + pdf-pool-size: |
| 11 | + required: false |
| 12 | + pdf-string-vacancies: |
| 13 | + required: false |
| 14 | + pdf-max-strings: |
| 15 | + required: false |
| 16 | + PyDynaRunContainer: |
| 17 | + description: Run container name |
| 18 | + required: true |
| 19 | + python-version: |
| 20 | + description: Python version to use |
| 21 | + required: true |
| 22 | + default: "3.13" |
| 23 | + type: string |
| 24 | + github-token: |
| 25 | + description: GitHub token for authentication |
| 26 | + required: true |
| 27 | + |
| 28 | + license-server: |
| 29 | + description: License server address |
| 30 | + required: true |
| 31 | + |
| 32 | + bot-token: |
| 33 | + description: Bot token for authentication |
| 34 | + required: true |
| 35 | + |
| 36 | + github-actor: |
| 37 | + description: GitHub actor for authentication |
| 38 | + required: true |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +runs: |
| 43 | + using: "composite" |
| 44 | + steps: |
| 45 | + - name: Checkout project |
| 46 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 47 | + |
| 48 | + - name: Set up Python |
| 49 | + uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 |
| 50 | + with: |
| 51 | + python-version: ${{ inputs.python-version }} |
| 52 | + cache: 'pip' |
| 53 | + cache-dependency-path: 'pyproject.toml' |
| 54 | + |
| 55 | + - name: Install system dependencies |
| 56 | + run: | |
| 57 | + sudo apt-get update |
| 58 | + sudo apt-get install xvfb pandoc texlive-latex-extra latexmk |
| 59 | + shell: bash |
| 60 | + |
| 61 | + - name: Install python dependencies |
| 62 | + run: | |
| 63 | + python -m pip install .[doc] |
| 64 | + python -m pip install docker |
| 65 | + shell: bash |
| 66 | + |
| 67 | + - name: Login to GitHub container registry |
| 68 | + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 |
| 69 | + with: |
| 70 | + registry: ghcr.io |
| 71 | + username: ${{ inputs.github-actor }} |
| 72 | + password: ${{ inputs.github-token }} |
| 73 | + |
| 74 | + - name: Set Licensing |
| 75 | + run: | |
| 76 | + echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV |
| 77 | + shell: bash |
| 78 | + |
| 79 | + - name: Install DPF |
| 80 | + uses: ansys/pydpf-actions/[email protected] |
| 81 | + with: |
| 82 | + dpf-standalone-TOKEN: ${{ inputs.bot-token }} |
| 83 | + ANSYS_VERSION: "242" |
| 84 | + |
| 85 | + - name: LS-DYNA Keyword server activation |
| 86 | + run: | |
| 87 | + docker pull ghcr.io/ansys/ls-pre:latest |
| 88 | + docker run -d --name kw_server -p 50051:50051 ghcr.io/ansys/ls-pre:latest && echo "Keyword server active on port 50051." |
| 89 | + shell: bash |
| 90 | + |
| 91 | + - name: Pull PyDyna-run image |
| 92 | + run: | |
| 93 | + docker pull ghcr.io/ansys/pydyna-run:latest |
| 94 | + shell: bash |
| 95 | + |
| 96 | + - name: Build the html documentation |
| 97 | + env: |
| 98 | + ANSYSLI_SERVERS: 2325@${{ inputs.license-server }} |
| 99 | + ANSYSLMD_LICENSE_FILE: 1055@${{ inputs.license-server }} |
| 100 | + PYDYNA_RUN_CONTAINER: ${{ inputs.PyDynaRunContainer }} |
| 101 | + BUILD_AUTOKEYWORS_API: ${{ inputs.build-autokeywords-api }} |
| 102 | + LSTC_LICENSE: ansys |
| 103 | + run: | |
| 104 | + timeout 7200 xvfb-run make -C doc html |
| 105 | + shell: bash |
| 106 | + |
| 107 | + - name: Upload html documentation |
| 108 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 |
| 109 | + with: |
| 110 | + name: documentation-html |
| 111 | + path: doc/_build/html |
| 112 | + retention-days: 7 |
| 113 | + |
| 114 | + - name: "Build the pdf documentation" |
| 115 | + shell: bash |
| 116 | + run: | |
| 117 | + xvfb-run make -C doc pdf |
| 118 | + env: |
| 119 | + ANSYSLI_SERVERS: 2325@${{ inputs.license-server }} |
| 120 | + ANSYSLMD_LICENSE_FILE: 1055@${{ inputs.license-server }} |
| 121 | + LSTC_LICENSE: ansys |
| 122 | + PYDYNA_RUN_CONTAINER: ${{ inputs.PyDynaRunContainer }} |
| 123 | + PYDYNA_RUN_STREAM: "0" |
| 124 | + extra_mem_bot: 20000000 |
| 125 | + extra_mem_top: 30000000 |
| 126 | + pool_size: ${{ inputs.pdf-pool-size }} |
| 127 | + string_vacancies: ${{ inputs.pdf-string-vacancies }} |
| 128 | + max_strings: ${{ inputs.pdf-max-strings }} |
| 129 | + |
| 130 | + - name: Upload pdf documentation |
| 131 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 |
| 132 | + with: |
| 133 | + name: documentation-pdf |
| 134 | + path: doc/_build/latex/*.pdf |
| 135 | + retention-days: 7 |
| 136 | + |
| 137 | + - name: Extract the server logs |
| 138 | + if: always() |
| 139 | + run: | |
| 140 | + docker logs kw_server > server_output.txt |
| 141 | + shell: bash |
| 142 | + |
| 143 | + - name: Upload the server logs |
| 144 | + if: always() |
| 145 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 |
| 146 | + with: |
| 147 | + name: server_output_docs.txt |
| 148 | + path: server_output.txt |
0 commit comments