-
Notifications
You must be signed in to change notification settings - Fork 10
227 lines (193 loc) · 7.04 KB
/
ci.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
name: CI
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches-ignore:
- "*no-ci"
push:
branches:
- master
workflow_dispatch:
inputs:
standalone_branch_suffix:
description: 'Suffix of the branch on standalone'
required: false
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
env:
PACKAGE_NAME: 'ansys-dpf-post'
MODULE: 'post'
DOCUMENTATION_CNAME: 'post.docs.pyansys.com'
MAIN_PYTHON_VERSION: '3.10'
ANSYS_VERSION: '241'
jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Show the Github context for the triggered event
run: echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
style:
name: "Style Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Setup Python"
uses: actions/[email protected]
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Install pre-commit"
run: pip install pre-commit
- name: "Run pre-commit"
run: pre-commit run --all-files --show-diff-on-failure
tests:
name: tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: ["windows-latest", "ubuntu-latest"]
steps:
- uses: actions/checkout@v3
- name: "Set licensing if necessary"
if: env.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: "Build Package"
uses: ansys/pydpf-actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
ANSYS_VERSION: ${{env.ANSYS_VERSION}}
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
MODULE: ${{env.MODULE}}
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
install_extras: plotting
wheel: true
wheelhouse: true
standalone_suffix: ${{ inputs.standalone_suffix || ''}}
extra-pip-args: ${{ './dpf-standalone/v241/dist' && format('--find-links {0}', './dpf-standalone/v241/dist')}}
custom-requirements: requirements/requirements_dev.txt
- name: "Prepare Testing Environment"
uses: ansys/pydpf-actions/[email protected]
with:
DEBUG: true
- name: "List installed packages"
shell: bash
run: pip list
- name: "Test Docstrings"
uses: ansys/pydpf-actions/[email protected]
with:
MODULE: ${{env.MODULE}}
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
working-directory: src
- name: "Test API"
shell: bash
working-directory: tests
run: |
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .
- name: "Kill all servers"
uses: ansys/pydpf-actions/[email protected]
if: always()
- name: "Upload Test Results"
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_pytest_${{ env.ANSYS_VERSION }}
path: tests/junit/test-results.xml
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
retro:
name: "Retro-compatibility"
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
os: ["windows-latest", "ubuntu-latest"]
ANSYS_VERSION: ["232", "231", "222", "221"]
steps:
- uses: actions/checkout@v3
- name: "Set licensing if necessary"
if: matrix.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: "Build Package"
uses: ansys/pydpf-actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
ANSYS_VERSION: ${{matrix.ANSYS_VERSION}}
PACKAGE_NAME: ${{env.PACKAGE_NAME}}
MODULE: ${{env.MODULE}}
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}}
install_extras: plotting
wheel: false
- name: "Install ansys-grpc-dpf==0.4.0"
shell: bash
run: |
pip install ansys-grpc-dpf==0.4.0
pip uninstall -y protobuf
pip install "protobuf<4.0"
if: matrix.ANSYS_VERSION == '221'
- name: "Prepare Testing Environment"
uses: ansys/pydpf-actions/[email protected]
with:
DEBUG: true
- name: "List installed packages"
shell: bash
run: pip list
- name: "Test API"
shell: bash
working-directory: tests
run: |
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 .
- name: "Kill all servers"
uses: ansys/pydpf-actions/[email protected]
if: always()
- name: "Upload Test Results"
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_pytest_${{ matrix.ANSYS_VERSION }}
path: tests/junit/test-results.xml
if: always()
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
examples:
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/examples.yml
with:
ANSYS_VERSION: "241"
python_versions: '["3.10"]'
standalone_suffix: ${{ inputs.standalone_suffix || ''}}
custom-wheels: ${{ format('--find-links {0}', './dpf-standalone/v241/dist')}}
custom-requirements: requirements/requirements_dev.txt
secrets: inherit
docs:
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/docs.yml
with:
ANSYS_VERSION: "241"
standalone_suffix: ${{ inputs.standalone_suffix || ''}}
event_name: ${{ github.event_name }}
custom-wheels: ./dpf-standalone/v241/dist
custom-requirements: requirements/requirements_dev.txt
secrets: inherit
upload-development-docs:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' }}
needs: [docs]
steps:
- name: "Upload development documentation"
uses: ansys/actions/doc-deploy-dev@v4
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
doc-artifact-name: HTML-doc-ansys-dpf-post.zip
decompress-artifact: true