forked from OpenMDAO/OpenMDAO
-
Notifications
You must be signed in to change notification settings - Fork 0
361 lines (308 loc) · 15.2 KB
/
openmdao_latest_workflow.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# Run OpenMDAO tests on latest/pre-release versions
name: OpenMDAO Latest
on:
# Run the workflow Monday, Wednesday and Friday at 0400 UTC
schedule:
- cron: '0 4 * * 1,3,5'
# Allow running the workflow manually from the Actions tab
workflow_dispatch:
permissions: {}
jobs:
tests:
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
# test latest versions on ubuntu
- NAME: Ubuntu Latest
OS: ubuntu-latest
PY: 3
PETSc: 3
SNOPT: 7.7
runs-on: ${{ matrix.OS }}
name: ${{ matrix.NAME }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Display run details
run: |
echo "============================================================="
echo "Run #${GITHUB_RUN_NUMBER}"
echo "Run ID: ${GITHUB_RUN_ID}"
echo "Testing: ${GITHUB_REPOSITORY}"
echo "Branch: ${GITHUB_BASE_REF}"
echo "Triggered by: ${GITHUB_EVENT_NAME}"
echo "Initiated by: ${GITHUB_ACTOR}"
echo "============================================================="
- name: Create SSH key
if: (matrix.SNOPT || matrix.BUILD_DOCS)
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- name: Checkout code
uses: actions/checkout@v3
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.PY }}
conda-version: "*"
channels: conda-forge
- name: Install OpenMDAO
run: |
echo "============================================================="
echo "Upgrade conda environment to latest"
echo "============================================================="
conda upgrade -c conda-forge --all
echo "============================================================="
echo "Define useful functions"
echo "============================================================="
function latest_version() {
local REPO_URL=$1/releases/latest
local LATEST_URL=`curl -fsSLI -o /dev/null -w %{url_effective} $REPO_URL`
local LATEST_VER=`echo $LATEST_URL | awk '{split($0,a,"/tag/"); print a[2]}'`
echo $LATEST_VER
}
function latest_branch() {
local LATEST_VER=$(latest_version $1)
echo git+$1@$LATEST_VER
}
echo "============================================================="
echo "Upgrade to latest pip"
echo "============================================================="
python -m pip install --upgrade pip
echo "============================================================="
echo "Install latest setuptools"
echo "============================================================="
python -m pip install --upgrade --pre setuptools
echo "============================================================="
echo "Install latest versions of NumPy/SciPy"
echo "============================================================="
python -m pip install --upgrade --pre numpy
python -m pip install --upgrade --pre scipy
# remember versions so we can check them later
NUMPY_VER=`python -c "import numpy; print(numpy.__version__)"`
SCIPY_VER=`python -c "import scipy; print(scipy.__version__)"`
echo "NUMPY_VER=$NUMPY_VER" >> $GITHUB_ENV
echo "SCIPY_VER=$SCIPY_VER" >> $GITHUB_ENV
echo "============================================================="
echo "Install latest versions of 'docs' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre matplotlib
python -m pip install --upgrade --pre numpydoc
python -m pip install --upgrade --pre jupyter-book
python -m pip install --upgrade --pre sphinx-sitemap
python -m pip install --upgrade --pre ipyparallel
echo "============================================================="
echo "Install latest versions of 'doe' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre pyDOE3
echo "============================================================="
echo "Install latest versions of 'notebooks' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre notebook
python -m pip install --upgrade --pre ipympl
echo "============================================================="
echo "Install latest versions of 'visualization' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre bokeh
python -m pip install --upgrade --pre colorama
echo "============================================================="
echo "Install latest versions of 'test' dependencies"
echo "============================================================="
python -m pip install --upgrade --pre parameterized
python -m pip install --upgrade --pre numpydoc
python -m pip install --upgrade --pre pycodestyle
python -m pip install --upgrade --pre pydocstyle
python -m pip install --upgrade --pre testflo
python -m pip install --upgrade --pre websockets
python -m pip install --upgrade --pre aiounittest
echo "the latest version of playwright (1.38.0) is pinned to"
echo "greenlet 2.0.2 which does not build properly for python 3.12"
echo "https://github.com/microsoft/playwright-python/issues/2096"
python -m pip install --upgrade --pre playwright || echo "Skipping playwright, no GUI testing!"
python -m pip install --upgrade --pre num2words
echo "============================================================="
echo "Install latest versions of other optional packages"
echo "============================================================="
python -m pip install --upgrade --pre pyparsing psutil objgraph pyxdsm
python -m pip install --upgrade --pre jax jaxlib
echo "============================================================="
echo "Install latest pyoptsparse"
echo "============================================================="
python -m pip install git+https://github.com/OpenMDAO/build_pyoptsparse
BRANCH="-b $(latest_version https://github.com/mdolab/pyoptsparse)"
if [[ "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then
echo " > Secure copying SNOPT 7.7 over SSH"
mkdir SNOPT
scp -qr ${{ secrets.SNOPT_LOCATION_77 }} SNOPT
SNOPT="-s SNOPT/src"
else
echo "SNOPT source is not available"
fi
build_pyoptsparse $BRANCH $SNOPT
echo "============================================================="
echo "Install OpenMDAO"
echo "============================================================="
python -m pip install .
- name: Install PETSc
if: matrix.PETSc
run: |
echo "============================================================="
echo "Install latest PETSc"
echo "============================================================="
conda install mpi4py petsc petsc4py -q -y --freeze-installed
echo "============================================================="
echo "Check MPI and PETSc installation"
echo "============================================================="
export OMPI_MCA_rmaps_base_oversubscribe=1
echo "-----------------------"
echo "Quick test of mpi4py:"
mpirun -n 3 python -c "from mpi4py import MPI; print(f'Rank: {MPI.COMM_WORLD.rank}')"
echo "-----------------------"
echo "Quick test of petsc4py:"
mpirun -n 3 python -c "import numpy; from mpi4py import MPI; comm = MPI.COMM_WORLD; \
import petsc4py; petsc4py.init(); \
x = petsc4py.PETSc.Vec().createWithArray(numpy.ones(5)*comm.rank, comm=comm); \
print(x.getArray())"
echo "-----------------------"
echo "============================================================="
echo "Export MPI-related environment variables"
echo "============================================================="
echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV
echo "Workaround for intermittent failures with OMPI https://github.com/open-mpi/ompi/issues/7393"
echo "TMPDIR=/tmp" >> $GITHUB_ENV
- name: Display environment info
id: env_info
continue-on-error: true
run: |
conda info
conda list
echo "============================================================="
echo "Check installed versions of Python, Numpy and Scipy"
echo "============================================================="
echo 'errors<<EOF' >> $GITHUB_OUTPUT
FINAL_VER=`python -c "import platform; print(platform.python_version())"`
if [[ ! "$FINAL_VER" == "${{ matrix.PY }}"* ]]; then
echo "Python version was changed from ${{ matrix.PY }} to $FINAL_VER" >> $GITHUB_OUTPUT
fi
FINAL_VER=`python -c "import numpy; print(numpy.__version__)"`
if [[ ! "$FINAL_VER" == "$NUMPY_VER"* ]]; then
echo "NumPy version was changed from $NUMPY_VER to $FINAL_VER" >> $GITHUB_OUTPUT
fi
FINAL_VER=`python -c "import scipy; print(scipy.__version__)"`
if [[ ! "$FINAL_VER" == "$SCIPY_VER"* ]]; then
echo "SciPy version was changed from $SCIPY_VER to $FINAL_VER" >> $GITHUB_OUTPUT
fi
echo 'EOF' >> $GITHUB_OUTPUT
grep changed $GITHUB_OUTPUT || echo ""
if: always()
- name: Run tests
id: run_tests
continue-on-error: true
run: |
echo "============================================================="
echo "Run tests (from directory other than repo root)"
echo "============================================================="
cd $HOME
RPT_FILE=`pwd`/deprecations.txt
echo "RPT_FILE=$RPT_FILE" >> $GITHUB_ENV
testflo -n 1 openmdao --timeout=240 --deprecations_report=$RPT_FILE --exclude=test_warnings_filters
- name: Build docs
id: build_docs
continue-on-error: true
run: |
export OPENMDAO_REPORTS=0
export PYDEVD_DISABLE_FILE_VALIDATION=1
cd openmdao/docs
if [[ "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then
echo "============================================================="
echo "Building docs with SNOPT examples."
echo "============================================================="
else
echo "============================================================="
echo "Disabling SNOPT cells in notebooks."
echo "============================================================="
python openmdao_book/other/disable_snopt_cells.py
fi
echo "============================================================="
echo "Starting ipcluster to run MPI under notebooks"
echo "============================================================="
./ipcluster_start.sh
sleep 12
echo "============================================================="
echo "Building the docs"
echo "============================================================="
echo "building source docs..."
python build_source_docs.py
echo "building book..."
jupyter-book build -W --keep-going openmdao_book
echo "copying build artifacts..."
python copy_build_artifacts.py
- name: Display doc build reports
if: steps.build_docs.outcome == 'failure'
continue-on-error: true
run: |
for f in $(find /home/runner/work/OpenMDAO/OpenMDAO/openmdao/docs/openmdao_book/_build/html/reports -name '*.log'); do
echo "============================================================="
echo $f
echo "============================================================="
cat $f
done
- name: Deprecations Report
id: deprecations_report
continue-on-error: true
run: |
echo "============================================================="
echo "Display deprecations report"
echo "============================================================="
cat $RPT_FILE
echo 'summary<<EOF' >> $GITHUB_OUTPUT
head -n 6 $RPT_FILE | cut -d':' -f 1 >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
grep '^0 unique deprecation warnings' $RPT_FILE
- name: Slack env change
if: steps.env_info.outputs.errors != ''
uses: act10ns/[email protected]
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: 'warning'
message: |
Environment change detected on `Latest` build.
Python, NumPy or SciPy was not the requested version:
```${{steps.env_info.outputs.errors}}```
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Slack unit test failure
if: steps.run_tests.outcome == 'failure'
uses: act10ns/[email protected]
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: ${{ steps.run_tests.outcome }}
message:
Unit testing failed on `Latest` build.
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Slack doc build failure
if: steps.build_docs.outcome == 'failure'
uses: act10ns/[email protected]
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: ${{ steps.build_docs.outcome }}
message: |
Doc build failed on `Latest` build.
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Slack deprecation warnings
if: steps.deprecations_report.outcome == 'failure'
uses: act10ns/[email protected]
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: 'warning'
message: |
Deprecations were detected on `Latest` build.
```${{ steps.deprecations_report.outputs.summary }}```
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}