-
Notifications
You must be signed in to change notification settings - Fork 57
290 lines (243 loc) · 9.5 KB
/
pycycle_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
278
279
280
281
282
283
284
285
286
287
288
289
290
# Run pyCycle Tests
name: pyCycle Tests
on:
# Trigger on push or pull request events for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allow running the workflow manually from the Actions tab
workflow_dispatch:
inputs:
run_name:
type: string
description: 'Name of workflow run as it will appear under Actions tab:'
required: false
default: ""
Ubuntu_Baseline:
type: boolean
description: 'Include Ubuntu Baseline test in the test matrix'
required: false
default: true
MacOS_Baseline:
type: boolean
description: 'Include MacOS Baseline test in the test matrix'
required: false
default: true
Windows_Baseline:
type: boolean
description: 'Include Windows Baseline test in the test matrix'
required: false
default: true
OpenMDAO_Dev:
type: boolean
description: 'Include latest/development test in the test matrix'
required: false
default: true
run-name: ${{ inputs.run_name }}
jobs:
tests:
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
# test baseline versions on Ubuntu
- NAME: Ubuntu Baseline
OS: ubuntu-latest
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.14'
OPENMDAO: 'latest'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.Ubuntu_Baseline }}
# test baseline versions on MacOS
- NAME: MacOS Baseline
OS: macos-latest
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.14'
OPENMDAO: 'latest'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.MacOS_Baseline }}
# test with latest/development versions
# only run when selected via workflow_dispatch
- NAME: OpenMDAO Dev
OS: ubuntu-latest
PY: 3
NUMPY: 2
SCIPY: 1
OPENMDAO: 'dev'
EXCLUDE: ${{ github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && ! inputs.OpenMDAO_Dev) }}
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 "Triggered by: ${GITHUB_EVENT_NAME}"
echo "Initiated by: ${GITHUB_ACTOR}"
echo "Excluded: ${{ matrix.EXCLUDE }}"
echo "============================================================="
- name: Checkout code
if: ${{ ! matrix.EXCLUDE }}
uses: actions/checkout@v3
- name: Setup conda
if: ${{ ! matrix.EXCLUDE }}
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.PY }}
miniforge-version: "latest"
- name: Install OpenMDAO
if: ${{ ! matrix.EXCLUDE }}
shell: bash -l {0}
run: |
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y
python -m pip install --upgrade pip
echo "============================================================="
echo "Install OpenMDAO"
echo "============================================================="
if [[ "${{ matrix.OPENMDAO }}" == "dev" ]]; then
pip install git+https://github.com/OpenMDAO/OpenMDAO
elif [[ "${{ matrix.OPENMDAO }}" == "latest" ]]; then
echo "The latest release of OpenMDAO will be installed from pypi per the pyCycle dependency"
else
pip install openmdao==${{ matrix.OPENMDAO }}
fi
- name: Install pyCycle
if: ${{ ! matrix.EXCLUDE }}
run: |
echo "============================================================="
echo "Install pyCycle"
echo "============================================================="
python -m pip install -e .[all]
- name: Display environment info
if: ${{ ! matrix.EXCLUDE }}
run: |
conda info
conda list
- name: Run tests
if: ${{ ! matrix.EXCLUDE }}
id: run_tests
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 pycycle --timeout=240 --show_skipped --deprecations_report=$RPT_FILE --coverage --coverpkg pycycle --durations=20
- name: Deprecations Report
if: ${{ ! matrix.EXCLUDE }}
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: Check NumPy 2.0 Compatibility
if: ${{ ! matrix.EXCLUDE }}
run: |
echo "============================================================="
echo "Check code for NumPy 2.0 compatibility"
echo "See: https://numpy.org/devdocs/numpy_2_0_migration_guide.html"
echo "============================================================="
python -m pip install ruff
cd ${{ github.workspace }}
ruff check . --select NPY201
- name: Slack unit test failure
if: steps.run_tests.outcome == 'failure'
uses: act10ns/slack@v2.0.0
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: ${{ steps.run_tests.outcome }}
message: |
`pyCycle`: Unit testing failed on `${{ matrix.NAME }}` build.
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Slack deprecation warnings
if: steps.deprecations_report.outcome == 'failure' && matrix.NAME == 'Ubuntu Baseline'
uses: act10ns/slack@v2.0.0
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: 'warning'
message: |
`pyCycle`: Deprecations were detected on `${{ matrix.NAME }}` build.
```${{ steps.deprecations_report.outputs.summary }}```
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
windows_tests:
runs-on: windows-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
# baseline versions
- NAME: Windows Baseline
PY: '3.12'
NUMPY: '1.26'
SCIPY: '1.14'
EXCLUDE: ${{ github.event_name == 'workflow_dispatch' && ! inputs.Windows_Baseline }}
name: ${{ matrix.NAME }}
defaults:
run:
shell: pwsh
steps:
- name: Display run details
run: |
echo "============================================================="
echo "Run #$env:GITHUB_RUN_NUMBER"
echo "Run ID: $env:GITHUB_RUN_ID"
echo "Testing: $env:GITHUB_REPOSITORY"
echo "Triggered by: $env:GITHUB_EVENT_NAME"
echo "Initiated by: $env:GITHUB_ACTOR"
echo "Excluded: ${{ matrix.EXCLUDE }}"
echo "============================================================="
- name: Checkout code
if: ${{ ! matrix.EXCLUDE }}
uses: actions/checkout@v3
- name: Setup conda
if: ${{ ! matrix.EXCLUDE }}
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.PY }}
miniforge-version: "latest"
- name: Install pyCycle
if: ${{ ! matrix.EXCLUDE }}
run: |
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y
python -m pip install --upgrade pip
echo "============================================================="
echo "Install pyCycle"
echo "============================================================="
python -m pip install -e .[all]
- name: Display environment info
if: ${{ ! matrix.EXCLUDE }}
run: |
conda info
conda list
- name: Run tests
if: ${{ ! matrix.EXCLUDE }}
id: run_tests
run: |
echo "============================================================="
echo "Run tests with coverage"
echo "============================================================="
testflo -n 1 pycycle --timeout=240 --show_skipped --coverage --coverpkg pycycle --durations=20
- name: Slack unit test failure
if: failure()
uses: act10ns/slack@v2.0.0
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
status: ${{ steps.run_tests.outcome }}
message: |
`pyCycle`: Unit testing failed on `${{ matrix.NAME }}` build.
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}