55 pull_request :
66 schedule :
77 - cron : 0 0 * * 0
8+ # Allow job to be triggered manually from GitHub interface
9+ workflow_dispatch :
10+
11+ # Force pytest to use color
12+ env :
13+ FORCE_COLOR : true
814
915concurrency :
1016 group : ${{ github.workflow }}-${{ github.ref }}
@@ -18,7 +24,20 @@ defaults:
1824 shell : bash -el {0}
1925
2026jobs :
21- build-linux :
27+ build-package :
28+ name : Build & inspect package
29+ runs-on : ubuntu-latest
30+ permissions :
31+ attestations : write
32+ id-token : write
33+
34+ steps :
35+ - uses : actions/checkout@v4
36+ with :
37+ fetch-depth : 0
38+ - uses : hynek/build-and-inspect-python-package@v2
39+
40+ test :
2241 if : " !contains(github.event.head_commit.message, '[skip ci]' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'nipreps/sdcflows'))"
2342 runs-on : ubuntu-latest
2443 env :
@@ -30,11 +49,16 @@ jobs:
3049 AFNI_IMSAVE_WARNINGS : NO
3150 AFNI_TTATLAS_DATASET : /opt/afni/atlases
3251 AFNI_PLUGINPATH : /opt/afni/plugins
33- ANTSPATH : /opt/ants
3452 strategy :
35- max-parallel : 5
53+ max-parallel : 6
3654 matrix :
3755 python-version : ["3.9", "3.10", "3.11", "3.12"]
56+ marks : ["not slow"]
57+ include :
58+ - python-version : " 3.9"
59+ marks : " slow and not veryslow"
60+ - python-version : " 3.12"
61+ marks : " veryslow"
3862
3963 steps :
4064 - uses : actions/cache@v4
6690 tcsh @update.afni.binaries -package linux_ubuntu_16_64 -bindir ${AFNI_HOME}
6791 fi
6892
69- - uses : actions/cache@v4
70- with :
71- path : /opt/ants
72- key : ants-v1
73- restore-keys : |
74- ants-v1
75- - name : Install ANTS
76- run : |
77- if [[ ! -d "${ANTSPATH}" ]]; then
78- sudo mkdir -p $ANTSPATH
79- curl -sSL "https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz" | sudo tar -xzC $ANTSPATH --strip-components 1
80- fi
81-
8293 - name : Git settings (pacify DataLad)
8394 run : |
8495 git config --global user.name 'NiPreps Bot'
@@ -89,11 +100,11 @@ jobs:
89100 auto-update-conda : true
90101 auto-activate-base : true
91102 python-version : ${{ matrix.python-version }}
92- channels : anaconda, https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/,conda-forge
103+ channels : https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/,conda-forge
93104 - uses : actions/cache@v4
94105 id : conda
95106 env :
96- CACHE_NUM : v4
107+ CACHE_NUM : v5
97108 with :
98109 path : |
99110 ~/conda_pkgs_dir
@@ -105,9 +116,9 @@ jobs:
105116 run : |
106117 conda install git-annex=*=alldep* pip
107118 pip install datalad datalad-osf
108- - name : Install fsl
119+ - name : Install fsl and ANTs
109120 run : |
110- conda install fsl-fugue fsl-topup
121+ conda install fsl-fugue fsl-topup ants
111122 - uses : actions/checkout@v4
112123 - name : Install dependencies
113124 timeout-minutes : 5
@@ -128,7 +139,7 @@ jobs:
128139 - uses : actions/cache@v4
129140 with :
130141 path : ${{ env.TEST_DATA_HOME }}
131- key : data-cache-v1
142+ key : data-cache-v2
132143 restore-keys : |
133144 data-cache-
134145 - name : Install test data
@@ -139,46 +150,85 @@ jobs:
139150 # ds001600
140151 datalad install -r https://github.com/nipreps-data/ds001600.git
141152 datalad update -r --merge -d ds001600/
142- datalad get -r -d ds001600/ ds001600/sub-1/
153+ datalad get -r -J 2 - d ds001600/ ds001600/sub-1/
143154
144155 # HCP/sub-101006
145156 datalad install -r https://github.com/nipreps-data/HCP101006.git
146157 datalad update -r --merge -d HCP101006/
147- datalad get -r -d HCP101006
158+ datalad get -r -J 2 - d HCP101006 HCP101006/*
148159
149160 # ds001771
150161 datalad install -r https://github.com/nipreps-data/ds001771.git
151162 datalad update -r --merge -d ds001771/
152- datalad get -r -d ds001771/ ds001771/sub-36/*
153- datalad get -r -d ds001771/derivatives ds001771/derivatives/openneuro/sub-36/*
163+ datalad get -r -J 2 - d ds001771/ ds001771/sub-36/*
164+ datalad get -r -J 2 - d ds001771/derivatives ds001771/derivatives/openneuro/sub-36/*
154165
155166 # ds000054
156167 datalad install -r https://github.com/nipreps-data/ds000054.git
157168 datalad update --merge -d ds000054/
158169 datalad get -r -d ds000054/ ds000054/sub-100185/*
170+ datalad get -r -J 2 -d ds000054/ ds000054/derivatives/smriprep-0.6/sub-100185/anat/
159171
160172 # ds000206
161173 datalad install -r https://github.com/nipreps-data/ds000206.git
162174 datalad update -r --merge -d ds000206/
163- datalad get -r -d ds000206/ ds000206/sub-05/
175+ datalad get -r -J 2 -d ds000206/ ds000206/sub-05/
176+
177+ # Brain extraction tests
178+ datalad install -r https://gin.g-node.org/nipreps-data/brain-extraction-tests
179+ datalad update --merge -d brain-extraction-tests/
180+ datalad get -r -J 2 -d brain-extraction-tests brain-extraction-tests/*
181+
182+ # HCPH pilot
183+ datalad install -r https://github.com/nipreps-data/hcph-pilot_fieldmaps.git
184+ datalad update -r --merge -d hcph-pilot_fieldmaps/
185+ datalad get -r -J 2 -d hcph-pilot_fieldmaps/ hcph-pilot_fieldmaps/*
186+
187+ - name : Set FreeSurfer variables
188+ run : |
189+ echo "FREESURFER_HOME=$HOME/.cache/freesurfer" >> $GITHUB_ENV
190+ echo "FS_LICENSE=$HOME/.cache/freesurfer/license.txt" >> $GITHUB_ENV
164191
165192 - name : Install FreeSurfer's mri_robust_template
166193 env :
167194 MRI_ROBUST_TEMPLATE : sx2n7/providers/osfstorage/5e825301d0e35400ebb481f2
168195 run : |
169196 curl https://files.osf.io/v1/resources/$MRI_ROBUST_TEMPLATE?direct > mri_robust_template
170197 sudo install mri_robust_template /usr/local/bin
171- mkdir -p $HOME/.cache/freesurfer/
172- echo "b2VzdGViYW5Ac3RhbmZvcmQuZWR1CjMwNzU2CiAqQ1MzYkJ5VXMxdTVNCiBGU2kvUGJsejJxR1V3Cg==" | base64 -d > $HOME/.cache/freesurfer/license.txt
198+ mkdir -p $( dirname $FS_LICENSE )
199+ echo "b2VzdGViYW5Ac3RhbmZvcmQuZWR1CjMwNzU2CiAqQ1MzYkJ5VXMxdTVNCiBGU2kvUGJsejJxR1V3Cg==" | base64 -d > $FS_LICENSE
173200
174201 - name : Run pytest with coverage
175202 run : |
176- export LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH
177- export PATH=$ANTSPATH:${AFNI_HOME}:/usr/lib/fsl/5.0:$PATH
178- pytest -v --cov sdcflows --cov-report xml:cov.xml --doctest-modules -n auto sdcflows
203+ export PATH=${AFNI_HOME}:$PATH
204+ export FSLDIR=${CONDA_PREFIX}
205+ pytest -v --cov sdcflows --cov-report xml:cov.xml --doctest-modules -n auto sdcflows \
206+ --durations=20 --durations-min=10 -m "$MARKS"
207+ env :
208+ MARKS : ${{ matrix.marks }}
179209
180210 - uses : codecov/codecov-action@v4
181211 with :
182212 file : cov.xml
183213 token : ${{ secrets.CODECOV_TOKEN }}
184214 if : ${{ always() }}
215+
216+ publish :
217+ name : Publish released package to pypi.org
218+ environment : release-pypi
219+ if : github.event.action == 'published'
220+ runs-on : ubuntu-latest
221+ needs : [build-package, test]
222+ permissions :
223+ attestations : write
224+ id-token : write
225+
226+ steps :
227+ - name : Download packages built by build-and-inspect-python-package
228+ uses : actions/download-artifact@v4
229+ with :
230+ name : Packages
231+ path : dist
232+
233+ - name : Upload package to PyPI
234+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments