-
Notifications
You must be signed in to change notification settings - Fork 25
275 lines (228 loc) · 7.64 KB
/
testing-and-deployment.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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: Actions
# repo specific gh actions
env:
SHELLOPTS: 'errexit:pipefail'
PACKAGE_NAME: ansys-mapdl-reader
PYVISTA_OFF_SCREEN: true
PYMAPDL_PORT: 21000 # default won't work on GitHub runners
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners
PYMAPDL_START_INSTANCE: FALSE
DOCKER_PACKAGE: ghcr.io/pyansys/pymapdl/mapdl
DOCUMENTATION_CNAME: reader.docs.pyansys.com
on:
pull_request:
push:
tags:
- "*"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
doc_build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Build project documentation
uses: ansys/actions/doc-build@v6
with:
dependencies: 'pandoc'
skip-dependencies-cache: true
use-python-cache: false
python-version: "3.10"
sphinxopts: "-j auto"
doc-deploy-dev:
name: Upload development documentation
runs-on: ubuntu-latest
needs: [doc_build]
if: github.ref == 'refs/heads/main'
steps:
- uses: ansys/actions/doc-deploy-dev@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Build ManyLinux wheel
if: ${{ runner.os == 'Linux' }}
run: |
docker run \
--rm -v `pwd`:/io \
quay.io/pypa/manylinux2014_x86_64 \
/io/.ci/build_wheels.sh ${{ matrix.python-version }}
- name: Build wheel on Windows
if: ${{ runner.os == 'Windows' }}
run: |
pip install build
python -m build
- name: Validate wheel
run: |
pip install twine
twine check dist/*
- name: Install on Linux
if: ${{ runner.os == 'Linux' }}
run: |
pip install wheel
pip install dist/*.whl
pip list
- name: Install on Windows Powershell
if: ${{ runner.os == 'Windows' }}
run: |
pip install wheel
pip install (get-item .\dist\*.whl)
pip list
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Install test requirements
run: pip install -r requirements/requirements_test.txt
- name: Test
run: pytest -v tests/ --durations=0
- uses: codecov/codecov-action@v4
if: ${{ runner.os == 'Linux' && matrix.python-version == '3.9' }}
name: 'Upload coverage to Codecov'
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ runner.os }}-${{ matrix.python-version }}
path: dist/
retention-days: 7
mac_build:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
name: Build wheels on MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
- name: List generated wheels
run: |
ls ./wheelhouse/*
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
# pymapdl_tests:
# name: PyMAPDL Unit Testing
# runs-on: ubuntu-latest
# needs: build
# strategy:
# matrix:
# mapdl-version: ['v21.1.1', 'v21.2.1', 'v22.1.0']
# steps:
# - name: Checkout PyMAPDL
# uses: actions/checkout@v4
# with:
# repository: 'pyansys/pymapdl' #checking out main. Not release
# - name: Display structure of downloaded PyMAPDL files
# run: ls -R
# - name: Downloading artifacts
# uses: actions/download-artifact@v4
# - name: Display structure of downloaded artifact files
# run: ls -R
# - name: Setup Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.8
# - name: Install OS packages
# run: |
# sudo apt update
# sudo apt install libgl1-mesa-glx xvfb
# - name: Linux pip cache
# uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: Python-${{ runner.os }}-3.8-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_*.txt') }}
# restore-keys: |
# Python-${{ runner.os }}-3.8
# - name: Test virtual framebuffer
# run: |
# pip install -r .ci/requirements_test_xvfb.txt
# xvfb-run python .ci/display_test.py
# - name: Install ansys-mapdl-core
# run: |
# python -m pip install --upgrade pip
# pip install .
# xvfb-run python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())"
# - name: Install ansys-mapdl-reader
# run: |
# pip install ansys-mapdl-reader-${{ runner.os }}-3.8/*.whl
# xvfb-run python -c "from ansys.mapdl import reader as pymapdl_reader; print(pymapdl_reader); print('Installation and smoke test correct')"
# - name: Login in Github Container registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ secrets.GH_USERNAME }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Pull, launch, and validate MAPDL service
# run: .ci/start_mapdl.sh
# env:
# LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
# MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }}
# - name: Unit Testing
# run: |
# pip install -r requirements/requirements_tests.txt
# xvfb-run pytest -v
# - name: Display MAPDL Logs
# if: always()
# run: cat log.txt
Release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [doc_build, build, mac_build]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# this downloads all artifacts
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Compressing HTML documentation
uses: vimtor/[email protected]
with:
files: documentation-html
dest: documentation-html.zip
- name: Upload to Public PyPi
run: |
pip install twine
twine upload --skip-existing ./**/*.whl
twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
./**/*.whl
./**/*.zip
./**/*.pdf
doc-deploy-release:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [Release]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v6
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}