-
Notifications
You must be signed in to change notification settings - Fork 10
208 lines (186 loc) · 5.83 KB
/
docs.yml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: docs
on:
# Can be called by the CI
workflow_call:
inputs:
python_version:
required: false
type: string
default: "3.10"
ANSYS_VERSION:
required: false
type: string
default: "251"
standalone_suffix:
description: "Suffix of the branch on standalone"
required: false
type: string
default: ''
event_name:
description: "Name of event calling"
required: true
type: string
default: ''
generate_pdf:
description: "Whether to build the PDF doc"
type: string
default: 'True'
debug:
description: "Debug verbose mode"
type: string
default: 'True'
# Can be called manually
workflow_dispatch:
inputs:
python_version:
description: "Python interpreter"
required: true
type: string
default: "3.10"
ANSYS_VERSION:
description: "ANSYS version"
required: true
type: string
default: "251"
standalone_suffix:
description: "Suffix of the branch on standalone"
required: false
type: string
default: ''
generate_pdf:
description: "Whether to build the PDF doc"
type: string
default: 'True'
env:
PACKAGE_NAME: ansys-dpf-post
MODULE: post
jobs:
doc-style:
name: "Check doc style"
runs-on: ubuntu-latest
steps:
- name: "Running documentation style checks"
uses: ansys/actions/doc-style@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
docs:
name: "Documentation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Set licensing if necessary"
if: inputs.ANSYS_VERSION > 231
shell: bash
run: |
echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV
echo "ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}" >> $GITHUB_ENV
- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ inputs.python_version }}
- name: "Install OS packages"
shell: bash
run: |
sudo apt update
sudo apt install pandoc texlive-latex-extra latexmk
- name: "Build Package"
id: build-package
uses: ansys/pydpf-actions/[email protected]
with:
python-version: ${{ inputs.python_version }}
ANSYS_VERSION: ${{inputs.ANSYS_VERSION}}
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
MODULE: ${{env.MODULE}}
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
install_extras: plotting
wheel: false
wheelhouse: false
standalone_suffix: ${{ inputs.standalone_suffix }}
- name: "Setup headless display"
uses: pyvista/setup-headless-display-action@v2
- name: "Install documentation requirements"
shell: bash
run: |
pip install -r requirements/requirements_docs.txt
- name: "List installed packages"
shell: bash
run: pip list
- name: "Build sphinx doc"
shell: bash
run: |
export SPHINX_APIDOC_OPTIONS=inherited-members
sphinx-apidoc -o doc/source/api src/ansys ${{inputs.build_extras}} -f --implicit-namespaces --separate --no-headings $DEBUG_SPHINX
- name: "Build HTML Documentation"
shell: bash
working-directory: doc
run: |
export TEMP=${{ runner.temp }}
make clean
echo "Making html doc..."
make html $DEBUG_HTML >> log.txt 2>&1
- name: "Check for success"
shell: bash
working-directory: doc
run: |
case `tail -n 5 log.txt | grep -F "build succeeded" >/dev/null; echo $?` in
0)
echo "Build succeeded!"
exit 0;;
1)
echo "Documentation generation failed, please check previous step!"
exit 1;;
*)
echo "An error occurred while checking success of the previous step!"
exit 1;;
esac
- name: "Build PDF Documentation"
shell: bash
working-directory: doc
if: ${{ inputs.generate_pdf == 'true' }}
run: |
export TEMP=${{ runner.temp }}
echo "Making pdf doc..."
make pdf $DEBUG_PDF
- name: "Upload Documentation Build log"
uses: actions/upload-artifact@v4
with:
name: doc-${{env.PACKAGE_NAME}}-log
path: doc/*.txt
if: always()
- name: "Zip HTML Documentation"
uses: vimtor/[email protected]
with:
files: doc/build/html/
dest: HTML-doc-${{env.PACKAGE_NAME}}.zip
if: always()
- name: "Upload HTML Documentation"
uses: actions/upload-artifact@v4
with:
name: HTML-doc-${{env.PACKAGE_NAME}}.zip
path: HTML-doc-${{env.PACKAGE_NAME}}.zip
if: always()
- name: "Find PDF Documentation"
shell: bash
if: ${{ inputs.generate_pdf == 'true' }}
id: pdf
working-directory: doc/build/latex
run: |
pattern="PyDPF-*.pdf"
files=( $pattern )
echo "PDF_file=${files[0]}" >> $GITHUB_OUTPUT
echo "Found PDF doc: ${files[0]}"
- name: "Zip PDF Documentation"
uses: vimtor/[email protected]
if: ${{ inputs.generate_pdf == 'true' }}
with:
files: doc/build/latex/${{ steps.pdf.outputs.PDF_file }}
dest: PDF-doc-${{env.PACKAGE_NAME}}.zip
- name: "Upload PDF Documentation"
uses: actions/upload-artifact@v4
if: inputs.generate_pdf == 'true'
with:
name: PDF-doc-${{env.PACKAGE_NAME}}
path: PDF-doc-${{env.PACKAGE_NAME}}.zip
- name: "Kill all servers"
uses: ansys/pydpf-actions/[email protected]
if: always()