-
Notifications
You must be signed in to change notification settings - Fork 93
268 lines (257 loc) · 8.59 KB
/
Copy pathfull-ci.yml
File metadata and controls
268 lines (257 loc) · 8.59 KB
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
# Full optional and scheduled CI coverage.
name: Full CI
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
pull_request:
branches: [main]
types: [labeled, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
env:
PYTEST_ADDOPTS: "--color=yes"
PIP_PROGRESS_BAR: "off"
WATERTAP_KERNEL_NAME: watertap-dev
jobs:
code-formatting:
name: Check code is formatted (Black)
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-full-ci')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install Black
run: |
black_requirement="$(grep -Eo '"black==[^"]+"' pyproject.toml | tr -d '"')"
pip --no-cache-dir install "$black_requirement"
- name: Run Black to verify that the committed code is formatted
run: |
black --check .
pylint:
name: Code linting (pylint)
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-full-ci')
runs-on: ubuntu-latest
needs: [code-formatting]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install dev dependencies
run: |
pip install -e ".[dev]"
pip list
- name: Environment summary
uses: ./.github/actions/environment-summary
with:
python-version: '3.11'
os: ubuntu-latest
job-name: pylint
- name: Run pylint
run: |
pylint watertap
tests:
name: Tests (py${{ matrix.python-version }}/${{ matrix.os }})
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-full-ci')
runs-on: ${{ matrix.os-version }}
needs: [code-formatting]
strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
os:
- linux
- win64
include:
- os: linux
os-version: ubuntu-22.04
- os: win64
os-version: windows-2022
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v4
with:
activate-environment: watertap-dev
python-version: ${{ matrix.python-version }}
miniforge-version: latest
channels: conda-forge
conda-remove-defaults: 'true'
- name: Install dependencies
run: |
echo '::group::Output of "conda install" commands'
conda install --quiet --yes pip setuptools wheel pandoc
echo '::endgroup::'
echo '::group::Output of "pip install" commands'
pip install -e ".[dev]"
echo '::endgroup::'
echo '::group::Output of "conda install -c conda-forge reaktoro cyipopt" command'
conda install -c conda-forge reaktoro cyipopt
echo '::endgroup::'
echo '::group::Display installed packages'
conda list
pip list
pip show idaes-pse
echo '::endgroup::'
echo '::group::Output of "idaes get-extensions" command'
idaes get-extensions --extra petsc --verbose
echo '::endgroup::'
- name: Environment summary
uses: ./.github/actions/environment-summary
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
job-name: tests
- name: Test with pytest
run: |
pytest --pyargs watertap --idaes-flowsheets --entry-points-group watertap.flowsheets --file-durations
- name: Upload pytest duration reports as job artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: pytest-duration-reports-${{ matrix.os }}-py${{ matrix.python-version }}
path: pytest-duration-reports/*.csv
if-no-files-found: warn
- name: Test documentation code
run: |
make -C docs doctest -d
user-mode-pytest:
name: pytest (user mode) (py${{ matrix.python-version }}/${{ matrix.os }})
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-full-ci')
runs-on: ${{ matrix.os-version }}
needs: [code-formatting]
strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
os:
- linux
- win64
include:
- os: linux
os-version: ubuntu-22.04
- os: win64
os-version: windows-2022
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v4
with:
activate-environment: watertap
python-version: ${{ matrix.python-version }}
channels: conda-forge
conda-remove-defaults: 'true'
auto-activate: false
- name: Define install URL (default)
env:
_repo_full_name: watertap-org/watertap
_ref_to_install: main
run: |
echo "_install_url=https://github.com/${_repo_full_name}/archive/${_ref_to_install}.zip" >> $GITHUB_ENV
- name: Define install URL (for PRs)
if: github.event.pull_request
env:
_repo_full_name: ${{ github.event.pull_request.head.repo.full_name }}
_ref_to_install: ${{ github.event.pull_request.head.sha }}
run: |
echo "_install_url=https://github.com/${_repo_full_name}/archive/${_ref_to_install}.zip" >> $GITHUB_ENV
- name: Bootstrap packaging tools and verify installation
run: |
conda install --quiet --yes pip setuptools wheel
python -m pip show setuptools wheel
- name: Install watertap and testing dependencies
run: |
echo '::group::Output of "pip install" commands'
pip install "watertap @ ${_install_url}" pytest
echo '::endgroup::'
echo '::group::Display installed packages'
conda list
pip list
pip show idaes-pse
echo '::endgroup::'
echo '::group::Output of "idaes get-extensions" command'
idaes get-extensions --extra petsc --verbose
echo '::endgroup::'
- name: Run pytest
run: |
pytest --pyargs watertap
notebooks:
name: Test notebooks (py${{ matrix.python-version }}/${{ matrix.os }})
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-full-ci')
runs-on: ${{ matrix.os-version }}
needs: [code-formatting]
strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
- '3.11'
os:
- linux
- win64
include:
- os: linux
os-version: ubuntu-22.04
- os: win64
os-version: windows-2022
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v4
with:
activate-environment: watertap-dev
python-version: ${{ matrix.python-version }}
channels: conda-forge
conda-remove-defaults: 'true'
- name: Install dependencies
run: |
echo '::group::Output of "conda install" commands'
conda install --quiet --yes pip setuptools wheel pandoc reaktoro
echo '::endgroup::'
echo '::group::Output of "pip install" commands'
pip install -e ".[dev]"
echo '::endgroup::'
echo '::group::Display installed packages'
conda list
pip list
pip show idaes-pse
echo '::endgroup::'
echo '::group::Output of "idaes get-extensions" command'
idaes get-extensions --extra petsc --verbose
echo '::endgroup::'
- name: Install Jupyter kernel
run: |
jupyter kernelspec list
python -m ipykernel install --user --name "${{ env.WATERTAP_KERNEL_NAME }}"
jupyter kernelspec list
- name: Environment summary
uses: ./.github/actions/environment-summary
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
job-name: notebooks
- name: Run pytest with nbmake
run: |
find tutorials -name "*.ipynb" -not -path "*/.ipynb_checkpoints/*" | grep -v "tutorials/flex_ro/mp_model.ipynb" | xargs pytest --nbmake --nbmake-kernel="${{ env.WATERTAP_KERNEL_NAME }}"