This repository has been archived by the owner on May 8, 2023. It is now read-only.
forked from ansys/pyaedt
-
Notifications
You must be signed in to change notification settings - Fork 0
226 lines (196 loc) · 7.89 KB
/
full_documentation.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# This is a basic workflow to help you get started with Actions
name: FullDocumentation
env:
python.version: 3.8
python.venv: 'testvenv'
DOCUMENTATION_CNAME: 'aedt.docs.pyansys.com'
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
tags:
- v*
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
full_documentation:
# The type of runner that the job will run on
name: full_documentation
runs-on: [Windows, pyaedt]
strategy:
matrix:
python-version: [3.8]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: 'Create virtual env'
run: |
python -m venv testenv
testenv\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: 'Install pyaedt'
run: |
testenv\Scripts\Activate.ps1
pip install -r requirements/requirements.txt
pip install -r requirements/requirements_docs.txt
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "testenv\Lib\site-packages\vtkmodules" -Force
- name: Retrieve PyAEDT version
id: version
run: |
testenv\Scripts\Activate.ps1
echo "::set-output name=PYAEDT_VERSION::$(python -c "from pyaedt import __version__; print(__version__)")"
echo "PyAEDT version is: $(python -c "from pyaedt import __version__; print(__version__)")"
#if: startsWith(github.event.ref, 'refs/heads/main') != true
- name: 'Create Documentations'
run: |
testenv\Scripts\Activate.ps1
sphinx-build -j auto -b html -a doc/source doc/_build/html
- name: "Upload HTML documentation artifact"
uses: actions/upload-artifact@v3
with:
name: documentation-html
path: doc/_build/html
retention-days: 7
doc-deploy-stable:
name: "Deploy stable documentation"
runs-on: ubuntu-latest
needs: full_documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Deploy the stable documentation"
uses: pyansys/actions/doc-deploy-stable@v2
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ matrix.python-version }}
full_documentation_json:
# The type of runner that the job will run on
name: full_documentation_json
# needs: [full_documentation]
runs-on: [Windows, pyaedt]
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v3
# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: 'Install requirements'
run: |
python -m venv jsondoc
jsondoc\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
pip install .
pip install -r requirements/requirements.txt
pip install -r requirements/requirements_docs.txt
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "jsondoc\Lib\site-packages\vtkmodules" -Force
- name: Build json documentation
run: |
# Export the documentation files to JSON files.
jsondoc\Scripts\Activate.ps1
echo "PYAEDT_VERSION=$(python -c "from pyaedt import __version__; print(__version__)")" >> $env:GITHUB_ENV
echo PYAEDT_VERSION=$(python -c "from pyaedt import __version__; print(__version__)")
- name: Build json files
run: |
jsondoc\Scripts\Activate.ps1
sphinx-build -M json doc/source doc-json -j auto -D release=${{ env.PYAEDT_VERSION }} -D version=${{ env.PYAEDT_VERSION }} -w build_errors.txt -N;
- name: Flatten the generated nested files into a single directory
run: |
echo Flattening a nested directory
mkdir -p pyaedt-doc-flatten-json;
# Move all the JSON file to the flatten directory.
JSON_FILES=$(find doc-json/json -type f -name "*.fjson" -o -name "*.json*");
for filename in $JSON_FILES
do
x=${filename#./};
y=${x// /-};
mv -n ${x// /\ } "./pyaedt-doc-flatten-json/${y////-}";
done
# echo Make sure all the file has .json extensions instead of the .fjson
# for file in pyaedt-doc-flatten-json/*.fjson ; do mv -- "$file" "${file%.fjson}.json" ; done;
# Move all static image files to the JSON flatten folder.
mv -n doc-json/json/_images pyaedt-doc-flatten-json/_images;
shell: bash
- name: zip the flattened JSON directory
run: |
Compress-Archive -Path pyaedt-doc-flatten-json\* -DestinationPath pyaedt-doc-flatten-json.zip
- name: move the generated documentation.
run: |
mkdir doc-flatten-json
mv pyaedt-doc-flatten-json.zip doc-flatten-json
# echo Clean up build directories after the process is completed.
rm -rf doc-json
shell: bash
- name: Upload json Documentation
uses: actions/upload-artifact@v3
with:
name: pyaedt-doc-flatten-json
path: pyaedt-doc-flatten-json
retention-days: 7
# Verify that sphinx generates no warnings
- name: Check for warnings
run: |
python doc/print_errors.py
# The "deploy" action is primarily developed using Ubuntu.
# As a workaround, we are using the artifacts generated from a Windows build agent.
deploy_json-documentation:
name: deploy_documentation_json
needs: [full_documentation_json]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: pyaedt-doc-flatten-json
# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}
- name: Deploy
uses: JamesIves/[email protected]
with:
repository-name: pyansys/devportal-doc-archive
branch: drupal
folder: pyaedt-doc-flatten-json
token: ${{ steps.get_workflow_token.outputs.token }}
clean: false