8
8
types : [published]
9
9
push :
10
10
branches :
11
- - master
11
+ - main
12
12
pull_request :
13
+ branches :
14
+ - main
13
15
14
16
concurrency :
15
17
group : ${{ github.workflow }}-${{ github.ref }}
@@ -18,75 +20,77 @@ concurrency:
18
20
permissions :
19
21
contents : read
20
22
21
- jobs :
23
+ env :
24
+ # Force tox and pytest to use color
25
+ FORCE_COLOR : true
22
26
27
+ jobs :
23
28
build :
29
+ name : Build & verify package
24
30
runs-on : ubuntu-latest
31
+ permissions :
32
+ attestations : write
33
+ id-token : write
25
34
steps :
26
35
- uses : actions/checkout@v4
27
36
with :
28
37
fetch-depth : 0
29
- - uses : actions/setup-python@v5
30
- with :
31
- python-version : 3
32
- - run : pip install --upgrade build twine
33
- - run : python -m build
34
- - run : twine check dist/*
35
- - uses : actions/upload-artifact@v4
38
+ - uses : hynek/build-and-inspect-python-package@v2
36
39
with :
37
- name : dist
38
- path : dist/
39
- - name : Build archive
40
- run : |
41
- git clean -fxd
42
- mkdir archive
43
- git archive -o archive/pydra.zip HEAD
44
- - uses : actions/upload-artifact@v4
45
- with :
46
- name : archive
47
- path : archive/
40
+ attest-build-provenance-github : ${{ github.event_name != 'pull_request' }}
48
41
49
42
test :
50
- needs : ['build']
43
+ runs-on : ${{ matrix.os }}
51
44
strategy :
52
45
matrix :
53
46
os : [ubuntu-latest, macos-latest, windows-latest]
54
47
python-version : ['3.11', '3.12', '3.13']
48
+ dependencies : [latest, pre]
49
+ include :
50
+ # Test minimum dependencies on oldest supported Python
51
+ - os : ubuntu-latest
52
+ python-version : " 3.11"
53
+ dependencies : min
55
54
fail-fast : false
56
- runs-on : ${{ matrix.os }}
55
+
56
+ env :
57
+ DEPENDS : ${{ matrix.dependencies }}
58
+
57
59
steps :
58
60
- name : Fetch repository
59
61
uses : actions/checkout@v4
60
- - name : Fetch tags
61
- run : git fetch --prune --unshallow
62
+ with :
63
+ fetch-depth : 0
64
+ - name : Install the latest version of uv
65
+ uses : astral-sh/setup-uv@v5
62
66
- name : Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
63
67
uses : actions/setup-python@v5
64
68
with :
65
69
python-version : ${{ matrix.python-version }}
66
- - name : Update pip
67
- run : python -m pip install --upgrade pip
68
- - name : Install Pydra
69
- run : pip install .[test]
70
- - name : Print version
71
- run : python -c "import pydra.engine; print(pydra.utils.__version__)"
72
- - name : Disable etelemetry
73
- run : echo "NO_ET=TRUE" >> $GITHUB_ENV
74
- - name : Pytest
70
+ - name : Install tox
75
71
run : |
76
- pytest -vs -n auto pydra --doctest-modules --import-mode=importlib --cov pydra --cov-config .coveragerc --cov-report xml:cov.xml --rootdir pydra
72
+ uv tool install tox --with=tox-uv --with=tox-gh-actions
73
+ - name : Show tox config
74
+ run : tox c
75
+ - name : Run tox
76
+ run : tox -v --exit-and-dump-after 1200
77
77
- name : Upload coverage to Codecov
78
78
uses : codecov/codecov-action@v5
79
79
with :
80
80
fail_ci_if_error : true
81
81
token : ${{ secrets.CODECOV_TOKEN }}
82
82
83
83
test-singularity :
84
- needs : ['build']
85
84
runs-on : ubuntu-22.04
86
85
strategy :
87
86
matrix :
88
87
python-version : ['3.11', '3.12', '3.13']
88
+ dependencies : [latest]
89
89
fail-fast : False
90
+
91
+ env :
92
+ DEPENDS : ${{ matrix.dependencies }}
93
+
90
94
steps :
91
95
- name : Set env
92
96
run : |
@@ -118,30 +122,32 @@ jobs:
118
122
run : |
119
123
echo ${{ github.ref }}
120
124
singularity --version
125
+ - uses : actions/checkout@v4
126
+ with :
127
+ fetch-depth : 0
128
+ - name : Install the latest version of uv
129
+ uses : astral-sh/setup-uv@v5
121
130
- name : Set up Python ${{ matrix.python-version }}
122
131
uses : actions/setup-python@v5
123
132
with :
124
133
python-version : ${{ matrix.python-version }}
125
- - name : Update build tools
126
- run : python -m pip install --upgrade pip
127
- - name : Checkout Pydra repo
128
- uses : actions/checkout@v4
129
- with :
130
- repository : ${{ github.repository }}
131
- - name : Fetch tags
132
- run : git fetch --prune --unshallow
133
- - name : Install pydra (test)
134
- run : pip install -e ".[test]"
135
- - name : Pytest
136
- run : pytest -vs --import-mode=importlib --cov pydra --cov-config .coveragerc --cov-report xml:cov.xml pydra/environments/tests/test_singularity.py pydra/environments/tests/test_environments.py --rootdir pydra
134
+ - name : Install tox
135
+ run : |
136
+ uv tool install tox --with=tox-uv --with=tox-gh-actions
137
+ - name : Show tox config
138
+ run : tox c
139
+ - name : Run tox
140
+ # Run test files with singularity tests; re-add the overridable "-n auto"
141
+ run : |
142
+ tox -v --exit-and-dump-after 1200 -- -n auto \
143
+ pydra/environments/tests/test_singularity.py pydra/environments/tests/test_environments.py
137
144
- name : Upload coverage to Codecov
138
145
uses : codecov/codecov-action@v5
139
146
with :
140
147
fail_ci_if_error : true
141
148
token : ${{ secrets.CODECOV_TOKEN }}
142
149
143
150
test-slurm :
144
- needs : ['build']
145
151
strategy :
146
152
matrix :
147
153
python-version : [3.11.5]
@@ -153,8 +159,8 @@ jobs:
153
159
- name : Disable etelemetry
154
160
run : echo "NO_ET=TRUE" >> $GITHUB_ENV
155
161
- uses : actions/checkout@v4
156
- - name : Fetch tags
157
- run : git fetch --prune --unshallow
162
+ with :
163
+ fetch-depth : 0
158
164
- name : Pull docker image
159
165
run : |
160
166
docker pull $DOCKER_IMAGE
@@ -174,20 +180,17 @@ jobs:
174
180
docker exec slurm bash -c "echo $NO_ET"
175
181
docker exec slurm bash -c "ls -la && echo list top level dir"
176
182
docker exec slurm bash -c "ls -la /pydra && echo list pydra dir"
177
- if [[ "${{ matrix.python-version }}" == "3.11.5" ]]; then
178
- docker exec slurm bash -c "CONFIGURE_OPTS=\"-with-openssl=/opt/openssl\" pyenv install -v 3.11.5"
179
- fi
183
+ docker exec slurm bash -c "CONFIGURE_OPTS=\"-with-openssl=/opt/openssl\" pyenv install -v ${{ matrix.python-version }}"
180
184
docker exec slurm bash -c "pyenv global ${{ matrix.python-version }}"
181
185
docker exec slurm bash -c "pip install --upgrade pip && pip install -e /pydra[test,psij] && python -c 'import pydra.engine; print(pydra.utils.__version__)'"
182
186
- name : Run pytest
183
187
run : |
184
- docker exec slurm bash -c "pytest /pydra/ pydra/workers/tests/test_worker.py --import-mode=importlib --rootdir /pydra/pydra -- only-worker=slurm --color=yes -vs --cov pydra --cov-config /pydra/.coveragerc --cov-report xml:/pydra/cov.xml "
188
+ docker exec slurm bash -c "cd /pydra; pytest pydra/workers/tests/test_worker.py --only-worker=slurm --color=yes"
185
189
- name : Upload coverage to Codecov
186
190
uses : codecov/codecov-action@v5
187
191
with :
188
192
fail_ci_if_error : true
189
193
token : ${{ secrets.CODECOV_TOKEN }}
190
- files : ./cov.xml
191
194
192
195
# test-sge:
193
196
# needs: ['build']
@@ -270,7 +273,6 @@ jobs:
270
273
# files: ./cov.xml
271
274
272
275
build-docs :
273
- needs : ['build']
274
276
runs-on : ubuntu-latest
275
277
# Set up the environment so that it finds conda
276
278
defaults :
@@ -306,8 +308,8 @@ jobs:
306
308
dbus-monitor --session &
307
309
sleep 3
308
310
- uses : actions/checkout@v4
309
- - name : Fetch tags
310
- run : git fetch --prune --unshallow
311
+ with :
312
+ fetch-depth : 0
311
313
- name : Install Minconda
312
314
uses : conda-incubator/setup-miniconda@v3
313
315
with :
@@ -321,63 +323,44 @@ jobs:
321
323
uses : actions/setup-python@v5
322
324
with :
323
325
python-version : ' 3.x'
324
- - name : Install dependencies
325
- run : |
326
- python -m pip install --upgrade pip
327
- pip install build twine
328
326
- name : Install package
329
327
run : pip install .[doc]
330
328
- name : Install Python3 kernel
331
329
run : python -m ipykernel install --user
332
330
- name : Build docs
333
- run : |
334
- cd docs
335
- make html
336
- cd ..
331
+ run : make -C docs html
337
332
- uses : actions/upload-artifact@v4
338
333
with :
339
334
name : docs
340
335
path : docs/build/html
341
336
342
337
deploy :
343
- needs : [build-docs, test, test-singularity, test-slurm]
338
+ needs : [build, build -docs, test, test-singularity, test-slurm]
344
339
runs-on : ubuntu-latest
340
+ if : github.event_name == 'release'
341
+ permissions :
342
+ attestations : write
343
+ id-token : write
345
344
steps :
346
345
- name : Download dist
347
346
uses : actions/download-artifact@v4
348
347
with :
349
- name : dist
348
+ name : Packages
350
349
path : dist
351
- - name : Check for PyPI token on tag
352
- id : deployable
353
- if : github.event_name == 'release'
354
- env :
355
- PYPI_API_TOKEN : " ${{ secrets.PYPI_API_TOKEN }}"
356
- run : if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
357
350
- name : Upload to PyPI
358
- if : steps.deployable.outputs.DEPLOY
359
351
uses : pypa/gh-action-pypi-publish@release/v1
360
- with :
361
- user : __token__
362
- password : ${{ secrets.PYPI_API_TOKEN }}
363
352
364
353
deploy-docs :
365
354
needs : [build-docs, deploy]
366
355
runs-on : ubuntu-latest
356
+ if : github.event_name == 'release'
367
357
steps :
368
358
- name : Download docs
369
359
uses : actions/download-artifact@v4
370
360
with :
371
361
name : docs
372
362
path : docs-build
373
- - name : Check for GHPAGES_DEPLOY_KEY token
374
- id : deployable
375
- if : github.event_name == 'release'
376
- env :
377
- GHPAGES_DEPLOY_KEY : " ${{ secrets.GHPAGES_DEPLOY_KEY }}"
378
- run : if [ -n "$GHPAGES_DEPLOY_KEY" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
379
363
- name : Deploy Docs to GitHub Pages
380
- if : steps.deployable.outputs.DEPLOY
381
364
uses : peaceiris/actions-gh-pages@v4
382
365
with :
383
366
github_token : ${{ secrets.GHPAGES_DEPLOY_KEY }}
0 commit comments