-
Notifications
You must be signed in to change notification settings - Fork 133
187 lines (159 loc) · 6.9 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
# This is a basic workflow to help you get started with Actions
name: FullDocumentation
env:
python.version: '3.10'
python.venv: 'testvenv'
DOCUMENTATION_CNAME: 'aedt.docs.pyansys.com'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_HOST_URL: https://backend.search.pyansys.com
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}
# Controls when the workflow will run
on: [pull_request, workflow_dispatch]
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:
full_documentation:
# The type of runner that the job will run on
name: full_documentation
runs-on: [windows-latest, pyaedt]
timeout-minutes: 480
strategy:
matrix:
python-version: ['3.10']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# TODO: install pandoc on self hosted runners to remove this step
- name: Install Chocolatey and Pandoc if necessary
run: |
# Check if Chocolatey is installed
if ((Get-Command choco -ErrorAction SilentlyContinue) -eq $null) {
# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
# Check if Pandoc is installed
# if (!(C:\ProgramData\chocolatey\bin\choco list --local-only -r pandoc)) {
# # Install Pandoc
# C:\ProgramData\chocolatey\bin\choco install pandoc -y
# }
C:\ProgramData\chocolatey\bin\choco install pandoc -y
# Add the pandoc path to PATH.
$pandocPath = (Get-Command pandoc).Path | Split-Path
#if ($env:PATH -notlike "*$pandocPath*") {
[Environment]::SetEnvironmentVariable('PATH', "$($env:PATH) $pandocPath", [System.EnvironmentVariableTarget]::Machine)
# echo "Pandoc path added."
#} else {
# echo "Pandoc path is already in the PATH variable."
#}
- 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 .[doc]
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__)")"
- name: Create HTML Documentations
run: |
testenv\Scripts\Activate.ps1
cd doc
.\make.bat html
# sphinx-build -j auto --color -b html -a doc/source doc/_build/html
# - name: Create PDF Documentations
# run: |
# testenv\Scripts\Activate.ps1
# .\doc\make.bat pdf
- name: Upload HTML documentation artifact
uses: actions/upload-artifact@v3
with:
name: documentation-html
path: doc/_build/html
retention-days: 7
# - name: Upload HTML documentation artifact
# uses: actions/upload-artifact@v3
# with:
# name: documentation-html-edb
# path: doc/_build/html/EDBAPI
# retention-days: 7
# - name: Upload PDF documentation artifact
# uses: actions/upload-artifact@v3
# with:
# name: documentation-pdf
# path: doc/_build/pdf
# retention-days: 7
# - name: Release
# uses: softprops/action-gh-release@v1
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
# with:
# generate_release_notes: true
# files: |
# doc/_build/pdf
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: ansys/actions/doc-deploy-stable@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
python-version: ${{ matrix.python-version }}
doc-index-stable:
name: "Deploy stable docs index"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: doc-deploy-stable
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: Install the package requirements
run: pip install -e .
- name: Get the version to PyMeilisearch
run: |
VERSION=$(python -c "from pyaedt import __version__; print('.'.join(__version__.split('.')[:2]))")
VERSION_MEILI=$(python -c "from pyaedt import __version__; print('-'.join(__version__.split('.')[:2]))")
echo "Calculated VERSION: $VERSION"
echo "Calculated VERSION_MEILI: $VERSION_MEILI"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV
- name: "Deploy the stable documentation index for PyAEDT API"
uses: ansys/actions/doc-deploy-index@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }}
index-name: pyaedt-v${{ env.VERSION_MEILI }}
host-url: ${{ vars.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}
pymeilisearchopts: --stop_urls \"EDBAPI\" # Add EDB API as another index.
- name: "Deploy the stable documentation index for EDB API"
uses: ansys/actions/doc-deploy-index@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }}/EDBAPI/
index-name: pyedb-v${{ env.VERSION_MEILI }}
host-url: ${{ vars.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}
doc-artifact-name: documentation-html-edb # Add only EDB API as page in this index.
pymeilisearchopts: --port 8001 #serve in another port