-
Notifications
You must be signed in to change notification settings - Fork 68
277 lines (245 loc) · 8.95 KB
/
test_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
# Run Tests
name: Aviary Tests
on:
# Trigger on push or pull request events for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:
branches: [ main ]
# Allow running the workflow manually from the Actions tab
workflow_dispatch:
jobs:
pre_commit:
# run pre-commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.11'
- uses: pre-commit/action@v3.0.0
test_ubuntu:
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
# oldest versions of openmdao/dymos
- NAME: oldest
PY: '3.9'
NUMPY: '1.20'
SCIPY: '1.6'
PYOPTSPARSE: 'v2.9.1'
SNOPT: '7.7'
OPENMDAO: 'dev'
DYMOS: '1.8.0'
MAKE_DOCS: 0
RUN_BENCHES: 0
# development versions of openmdao/dymos
- NAME: dev
PY: 3
NUMPY: 1
SCIPY: 1
PYOPTSPARSE: 'v2.9.1'
SNOPT: '7.7'
OPENMDAO: 'dev'
DYMOS: 'dev'
MAKE_DOCS: 0
RUN_BENCHES: 0
# latest versions of openmdao/dymos
- NAME: latest
PY: '3.10'
NUMPY: 1
SCIPY: 1
PYOPTSPARSE: 'v2.9.1'
SNOPT: '7.7'
OPENMDAO: 'dev'
DYMOS: 'latest'
MAKE_DOCS: 0
RUN_BENCHES: 0
# latest versions of openmdao/dymos for docs only
- NAME: latest_docs
PY: 3
NUMPY: 1
SCIPY: 1
PYOPTSPARSE: 'v2.9.1'
SNOPT: '7.7'
OPENMDAO: 'dev'
DYMOS: 'latest'
MAKE_DOCS: 1
RUN_BENCHES: 0
# latest versions of openmdao/dymos for benches only
- NAME: latest_benches
PY: 3
NUMPY: 1
SCIPY: 1
PYOPTSPARSE: 'v2.9.1'
SNOPT: '7.7'
OPENMDAO: 'latest'
DYMOS: 'latest'
MAKE_DOCS: 0
RUN_BENCHES: 1
steps:
- name: Display run details
run: |
echo "============================================================="
echo "Run #${GITHUB_RUN_NUMBER}"
echo "Run ID: ${GITHUB_RUN_ID}"
echo "Testing: ${GITHUB_REPOSITORY}"
echo "Triggered by: ${GITHUB_EVENT_NAME}"
echo "Initiated by: ${GITHUB_ACTOR}"
echo "============================================================="
- name: Create SSH key
shell: bash
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: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.PY }}
channels: conda-forge
- name: Install dependencies
shell: bash -l {0}
run: |
echo "============================================================="
echo "Install dependencies"
echo "============================================================="
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y
conda install matplotlib pandas panel hvplot -q -y
pip install testflo -q
- name: Install pyOptSparse
if: matrix.PYOPTSPARSE
shell: bash -l {0}
run: |
echo "============================================================="
echo "Install pyoptsparse"
echo "============================================================="
if [[ "${{ matrix.SNOPT }}" == "7.7" && "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then
mkdir SNOPT
echo " > Secure copying SNOPT 7.7 over SSH"
scp -qr ${{ secrets.SNOPT_LOCATION_77 }} SNOPT
SNOPT="-s SNOPT/src"
elif [[ "${{ matrix.SNOPT }}" ]]; then
echo "SNOPT version ${{ matrix.SNOPT }} was requested but source is not available"
fi
conda config --add channels conda-forge
pip install git+https://github.com/OpenMDAO/build_pyoptsparse
build_pyoptsparse -v -b ${{ matrix.PYOPTSPARSE }} $SNOPT
- name: Install OpenMDAO
if: matrix.OPENMDAO
shell: bash -l {0}
run: |
echo "============================================================="
echo "Install OpenMDAO"
echo "============================================================="
if [[ "${{ matrix.OPENMDAO }}" == "dev" ]]; then
pip install git+https://github.com/OpenMDAO/OpenMDAO
elif [[ "${{ matrix.OPENMDAO }}" == "latest" ]]; then
pip install openmdao
else
pip install openmdao==${{ matrix.OPENMDAO }}
fi
- name: Install Dymos
if: matrix.DYMOS
shell: bash -l {0}
run: |
echo "============================================================="
echo "Install Dymos"
echo "============================================================="
if [[ "${{ matrix.DYMOS }}" == "dev" ]]; then
pip install git+https://github.com/OpenMDAO/Dymos
elif [[ "${{ matrix.DYMOS }}" == "latest" ]]; then
pip install dymos
else
pip install dymos==${{ matrix.DYMOS }}
fi
- name: Checkout Aviary
uses: actions/checkout@v2
- name: Install Aviary
shell: bash -l {0}
run: |
echo "============================================================="
echo "Install Aviary"
echo "============================================================="
pip install -e .[all]
- name: Display conda environment info
shell: bash -l {0}
run: |
conda info
conda list
conda env export --name ${{ matrix.NAME }}_env --file ${{ matrix.NAME }}_environment.yml
- name: 'Upload environment artifact'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.NAME }}_environment
path: ${{ matrix.NAME }}_environment.yml
retention-days: 5
- name: Run tests
if: matrix.MAKE_DOCS == 0 && matrix.RUN_BENCHES == 0
shell: bash -l {0}
run: |
echo "============================================================="
echo "Run Tests"
echo "============================================================="
testflo . -n 1 --show_skipped --coverage --coverpkg aviary
- name: Run benchmarks
if: matrix.RUN_BENCHES
shell: bash -l {0}
run: |
echo "============================================================="
echo "Run Benchmarks"
echo "============================================================="
testflo . --testmatch=bench_test*
- name: Build docs
if: matrix.MAKE_DOCS
shell: bash -l {0}
run: |
pip install -U jupyter-book
cd aviary/docs
echo "============================================================="
echo "Build the docs"
echo "============================================================="
bash build_book.sh
- name: Display doc build reports
continue-on-error: True
if: matrix.MAKE_DOCS
shell: bash -l {0}
run: |
cd $HOME/work/Aviary/Aviary/aviary/docs
find _build/html/reports/ -type f -name '*.log' \
-exec echo "#################################################################" \; \
-exec echo {} \; \
-exec echo "#################################################################" \; \
-exec cat {} \;
- name: Publish docs to github.io
if: |
github.event_name == 'push' && github.ref == 'refs/heads/main' &&
matrix.MAKE_DOCS
shell: bash -l {0}
run: |
echo "============================================================="
echo "Publishing Docs to github.io"
echo "============================================================="
pip install ghp-import
cd $HOME/work/Aviary/Aviary/aviary
ghp-import -n -p -f docs/_build/html
- name: Scan for security issues
if: matrix.MAKE_DOCS
shell: bash -l {0}
run: |
python -m pip install bandit
echo "============================================================="
echo "Run bandit scan for medium/high severity issues"
echo "============================================================="
cd $GITHUB_WORKSPACE
python -m bandit -r -ll aviary