4
4
pull_request :
5
5
paths :
6
6
- environment.yml
7
- - ' **/requirements*.txt'
8
7
- pyproject.toml
9
8
- util/dependency_management.py
10
9
- .github/workflows/test-install.yml
14
13
15
14
# https://docs.github.com/en/actions/using-jobs/using-concurrency
16
15
concurrency :
17
- # only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
16
+ # only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
18
17
group : ${{ github.workflow }}-${{ github.ref }}
19
18
cancel-in-progress : true
20
19
@@ -30,44 +29,24 @@ jobs:
30
29
steps :
31
30
- uses : actions/checkout@v4
32
31
33
- - name : Set up Python 3.9
32
+ - name : Set up Python 3.11
34
33
uses : actions/setup-python@v5
35
34
with :
36
35
python-version : ' 3.9'
37
36
38
- - name : Install utils/ dependencies
39
- run : pip install -r utils/requirements.txt
40
-
41
- - name : Validate
42
- run : |
43
- python ./utils/dependency_management.py check-requirements
44
- python ./utils/dependency_management.py validate-all
45
-
46
- resolve-pip-dependencies :
47
- # Check whether the environments defined in the requirements/* files are
48
- # resolvable.
49
-
50
- needs : [validate-dependency-specification]
51
- if : github.repository == 'aiidateam/aiida-core'
52
- runs-on : ubuntu-latest
53
- timeout-minutes : 5
54
-
55
- strategy :
56
- fail-fast : false
57
- matrix :
58
- python-version : ['3.9', '3.10', '3.11', '3.12']
37
+ - name : Set up uv
38
+ uses : astral-sh/setup-uv@v4
39
+ with :
40
+ version : 0.5.6
59
41
60
- steps :
61
- - uses : actions/checkout@v4
42
+ - name : Install utils/ dependencies
43
+ run : uv pip install --system -r utils/requirements.txt
62
44
63
- - name : Set up Python ${{ matrix.python-version }}
64
- uses : actions/setup-python@v5
65
- with :
66
- python-version : ${{ matrix.python-version }}
45
+ - name : Validate uv lockfile
46
+ run : uv lock --locked
67
47
68
- - name : Resolve dependencies from requirements file.
69
- run : |
70
- pip install --dry-run --ignore-installed -r requirements/requirements-py-${{ matrix.python-version }}.txt
48
+ - name : Validate conda environment file
49
+ run : python ./utils/dependency_management.py validate-environment-yml
71
50
72
51
create-conda-environment :
73
52
# Verify that we can create a valid conda environment from the environment.yml file.
@@ -220,7 +199,7 @@ jobs:
220
199
with :
221
200
python-version : ${{ matrix.python-version }}
222
201
extras : ' [atomic_tools,docs,notebook,rest,tests,tui]'
223
- from-requirements : ' false'
202
+ from-lock : ' false'
224
203
225
204
- name : Setup AiiDA environment
226
205
run : .github/workflows/setup.sh
@@ -230,112 +209,3 @@ jobs:
230
209
AIIDA_TEST_PROFILE : test_aiida
231
210
AIIDA_WARN_v3 : 1
232
211
run : pytest -n auto --db-backend psql tests -m 'not nightly' tests/
233
-
234
- - name : Freeze test environment
235
- run : pip freeze | sed '1d' | tee requirements-py-${{ matrix.python-version }}.txt
236
-
237
- # Add python-version specific requirements/ file to the requirements.txt artifact.
238
- # This artifact can be used in the next step to automatically create a pull request
239
- # updating the requirements (in case they are inconsistent with the pyproject.toml file).
240
- - uses : actions/upload-artifact@v4
241
- with :
242
- name : requirements-py-${{ matrix.python-version }}.txt
243
- path : requirements-py-${{ matrix.python-version }}.txt
244
-
245
- # Check whether the requirements/ files are consistent with the dependency specification in the pyproject.toml file.
246
- # If the check fails, warn the user via a comment and try to automatically create a pull request to update the files
247
- # (does not work on pull requests from forks).
248
-
249
- check-requirements :
250
-
251
- needs : tests
252
-
253
- runs-on : ubuntu-latest
254
- timeout-minutes : 5
255
-
256
- steps :
257
- - uses : actions/checkout@v4
258
-
259
- - name : Set up Python 3.9
260
- uses : actions/setup-python@v5
261
- with :
262
- python-version : 3.9
263
-
264
- - name : Install utils/ dependencies
265
- run : pip install -r utils/requirements.txt
266
-
267
- - name : Check consistency of requirements/ files
268
- id : check_reqs
269
- continue-on-error : true
270
- run : python ./utils/dependency_management.py check-requirements DEFAULT --no-github-annotate
271
-
272
- #
273
- # The following steps are only executed if the consistency check failed.
274
- #
275
- - name : Create commit comment
276
- if : steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
277
- uses : peter-evans/commit-comment@v3
278
- with :
279
- token : ${{ secrets.GITHUB_TOKEN }}
280
- path : pyproject.toml
281
- body : |
282
- The requirements/ files are inconsistent!
283
-
284
- # Check out the base branch so that we can prepare the pull request.
285
- - name : Checkout base branch
286
- if : steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
287
- uses : actions/checkout@v4
288
- with :
289
- ref : ${{ github.head_ref }}
290
- clean : true
291
-
292
- - name : Download requirements.txt files
293
- if : steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
294
- uses : actions/download-artifact@v4
295
- with :
296
- pattern : requirements-py-*
297
- merge-multiple : true
298
- path : requirements
299
-
300
- - name : Commit requirements files
301
- if : steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
302
- run : |
303
- git add requirements/*
304
-
305
- - name : Create pull request for updated requirements files
306
- if : steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
307
- id : create_update_requirements_pr
308
- continue-on-error : true
309
- uses : peter-evans/create-pull-request@v7
310
- with :
311
- branch : update-requirements
312
- commit-message : Automated update of requirements/ files.
313
- title : Update requirements/ files.
314
- body : |
315
- Update requirements files to ensure that they are consistent
316
- with the dependencies specified in the 'pyproject.toml' file.
317
-
318
- Please note, that this pull request was likely created to
319
- resolve the inconsistency for a specific dependency, however
320
- other versions that have changed since the last update will
321
- be included as part of this commit as well.
322
-
323
- Click [here](https://github.com/aiidateam/aiida-core/wiki/AiiDA-Dependency-Management) for more information.
324
-
325
- - name : Create PR comment on success
326
- if : steps.create_update_requirements_pr.outcome == 'Success'
327
- uses : peter-evans/create-or-update-comment@v4
328
- with :
329
- issue-number : ${{ github.event.number }}
330
- body : |
331
- I automatically created a pull request (#${{ steps.create_update_requirements_pr.outputs.pr_number }}) that adapts the
332
- requirements/ files according to the dependencies specified in the 'pyproject.toml' file.
333
-
334
- - name : Create PR comment on failure
335
- if : steps.create_update_requirements_pr.outcome == 'Failure'
336
- uses : peter-evans/create-or-update-comment@v4
337
- with :
338
- issue-number : ${{ github.event.number }}
339
- body : |
340
- Please update the requirements/ files to ensure that they
341
- are consistent with the dependencies specified in the 'pyproject.toml' file.
0 commit comments