Skip to content

Commit 9db3f2d

Browse files
committed
updated ci to pull in github tags for python versioning
1 parent e03104d commit 9db3f2d

File tree

2 files changed

+8
-76
lines changed

2 files changed

+8
-76
lines changed

.github/workflows/ci-cd.yml

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,18 @@ jobs:
4545
run: |
4646
git config --global user.email "[email protected]"
4747
git config --global user.name "Dummy User"
48-
4948
- name: install dependencies
5049
run: |
5150
sudo apt-get update
5251
sudo apt-get install clang qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build
53-
5452
- name: Run sccache-cache
5553
uses: mozilla-actions/[email protected]
56-
5754
- name: Get CMake
5855
uses: lukka/get-cmake@latest
5956
with:
6057
cmakeVersion: '3.16.3'
61-
6258
- name: Print CMake version
6359
run: cmake --version
64-
6560
- name: Clone latest MRtrix and switch to latest tag
6661
run: |
6762
mkdir $MRTRIX_HOME
@@ -71,10 +66,8 @@ jobs:
7166
git checkout pydra-usage-python-cmd
7267
git tag -a $MRTRIX_VERSION -m"Tag used to create a pydra-mrtrix3 release"
7368
git describe --abbrev=0
74-
7569
# echo "MRTRIX_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
7670
# git checkout $MRTRIX_VERSION
77-
7871
- name: configure
7972
run: |
8073
cd $MRTRIX_HOME/src
@@ -88,40 +81,31 @@ jobs:
8881
-D CMAKE_C_COMPILER=clang \
8982
-D CMAKE_CXX_COMPILER=clang++ \
9083
-D CMAKE_INSTALL_PREFIX=$MRTRIX_INSTALL
91-
9284
- name: Build Mrtrix
9385
run: |
9486
cd $MRTRIX_HOME/src
9587
cmake --build build
96-
9788
- name: Install Mrtrix
9889
run: |
9990
cd $MRTRIX_HOME/src
10091
cmake --install build
101-
10292
- name: Set PATH Variable
10393
run: echo "PATH=$PATH:$MRTRIX_INSTALL/bin" >> $GITHUB_ENV
104-
10594
- name: Set LD_LIBRARY_PATH Variable
10695
run: echo "LD_LIBRARY_PATH=$MRTRIX_INSTALL/lib" >> $GITHUB_ENV
107-
10896
- name: Change back to the root directory
10997
run: cd ..
110-
11198
- name: Set up Python
11299
uses: actions/setup-python@v2
113-
114100
- name: Install Python build dependencies
115101
run: |
116102
python -m pip install --upgrade pip
117-
118103
- name: Install pydra-auto-gen requirements
119104
run: >
120105
pip install
121106
-e related-packages/fileformats
122107
-e related-packages/fileformats-extras
123108
-e .[dev,test]
124-
125109
- name: Generate task specifications
126110
run: >
127111
./generate.py
@@ -130,22 +114,18 @@ jobs:
130114
$MRTRIX_VERSION
131115
--log-errors
132116
--latest
133-
134117
- name: Upload MRtrix3 install
135118
uses: actions/upload-artifact@v2
136119
with:
137120
name: MRtrix3
138121
path: ${{ env.MRTRIX_INSTALL}}
139-
140122
- name: Upload auto-gen pydra
141123
uses: actions/upload-artifact@v2
142124
with:
143125
name: AutoGen
144126
path: pydra/tasks/mrtrix3/${{ env.SUBPKG_NAME }}
145-
146127
- name: Write version file
147128
run: echo $MRTRIX_VERSION > mrtrix3_version.txt
148-
149129
- name: Upload version file
150130
uses: actions/upload-artifact@v2
151131
with:
@@ -165,40 +145,32 @@ jobs:
165145

166146
steps:
167147
- uses: actions/checkout@v2
168-
169148
- name: Download version file
170149
uses: actions/download-artifact@v2
171150
with:
172151
name: VersionFile
173152
path: mrtrix3_version.txt
174-
175153
- name: Extract Mrtrix version
176154
run: echo "MRTRIX_VERSION=$(cat mrtrix3_version.txt)" >> $GITHUB_ENV
177-
178155
- name: Download auto-gen pydra
179156
uses: actions/download-artifact@v2
180157
with:
181158
name: AutoGen
182159
path: pydra/tasks/mrtrix3/${{ env.SUBPKG_NAME }}
183-
184160
- name: Strip auto package from gitignore so it is included in package
185161
run: |
186162
sed -i '/\/pydra\/tasks\/mrtrix3\/${{ env.SUBPKG_NAME }}/d' .gitignore
187-
188163
- name: Set up Python ${{ matrix.python-version }}
189164
uses: actions/setup-python@v2
190165
with:
191166
python-version: ${{ matrix.python-version }}
192-
193167
- name: Install build dependencies
194168
run: |
195169
python -m pip install --upgrade pip
196-
197170
- name: Install Pydra
198171
run: |
199172
pip install ${{ matrix.pydra }}
200173
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
201-
202174
- name: Install task package
203175
run: |
204176
pip install ${{ matrix.pip-flags }} "related-packages/fileformats"
@@ -221,100 +193,84 @@ jobs:
221193
run: |
222194
sudo apt-get update
223195
sudo apt-get install clang qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build
224-
225196
- name: Checkout code
226197
uses: actions/checkout@v2
227-
198+
- name: Unset header
199+
# checkout@v2 adds a header that makes branch protection report errors
200+
# because the Github action bot is not a collaborator on the repo
201+
run: git config --local --unset http.https://github.com/.extraheader
202+
- name: Fetch tags
203+
run: git fetch --prune --unshallow
228204
- name: Download version file
229205
uses: actions/download-artifact@v2
230206
with:
231207
name: VersionFile
232208
path: mrtrix3_version.txt
233-
234209
- name: Extract Mrtrix version
235210
run: echo "MRTRIX_VERSION=$(cat mrtrix3_version.txt)" >> $GITHUB_ENV
236-
237211
- name: Download auto-gen pydra
238212
uses: actions/download-artifact@v2
239213
with:
240214
name: AutoGen
241215
path: pydra/tasks/mrtrix3/${{ env.SUBPKG_NAME }}
242-
243216
- name: Strip auto package from gitignore so it is included in package
244217
run: |
245218
sed -i '/\/pydra\/tasks\/mrtrix3\/${{ env.SUBPKG_NAME }}/d' .gitignore
246-
247219
- name: Download MRtrix3 install
248220
uses: actions/download-artifact@v2
249221
with:
250222
name: MRtrix3
251223
path: ${{ env.MRTRIX_INSTALL}}
252-
253224
- name: Make commands executable
254225
run: chmod +x ${{ env.MRTRIX_INSTALL }}/bin/*
255-
256226
- name: Set PATH Variable
257227
run: echo "PATH=$PATH:$MRTRIX_INSTALL/bin" >> $GITHUB_ENV
258-
259228
- name: Set LD_LIBRARY_PATH Variable
260229
run: echo "LD_LIBRARY_PATH=$MRTRIX_INSTALL/lib" >> $GITHUB_ENV
261-
262230
- name: Set up Python ${{ matrix.python-version }}
263231
uses: actions/setup-python@v2
264232
with:
265233
python-version: ${{ matrix.python-version }}
266-
267234
- name: Install build dependencies
268235
run: |
269236
python -m pip install --upgrade pip
270-
271237
- name: Install task package
272238
run: >
273239
pip install
274240
-e ./related-packages/fileformats
275241
-e ./related-packages/fileformats-extras
276242
-e '.[test]'
277-
278243
- name: Install dev branch of pydra until bugfix
279244
run: pip install --upgrade git+https://github.com/nipype/pydra.git@typing-bugfixes
280-
281245
- name: Test with pytest
282246
run: pytest -sv pydra/tasks/mrtrix3 --cov pydra.tasks.mrtrix3 --cov-report xml
283-
284247
- uses: codecov/codecov-action@v1
285248
if: ${{ always() }}
286249

287250
deploy-fileformats:
288251
needs: [devcheck, test]
289252
runs-on: ubuntu-latest
290253
steps:
291-
292254
- uses: actions/checkout@v3
293255
with:
294256
submodules: recursive
295257
fetch-depth: 0
296-
297258
- name: Set up Python
298259
uses: actions/setup-python@v4
299260
with:
300261
python-version: '3.11'
301-
302262
- name: Install build tools
303263
run: python -m pip install build twine
304-
305264
- name: Build source and wheel distributions
306265
run: python -m build ./related-packages/fileformats
307-
308266
- name: Check distributions
309267
run: twine check ./related-packages/fileformats/dist/*
310-
311268
- name: Check for PyPI token on tag
312269
id: deployable
313270
if: github.event_name == 'release' || github.event_name == 'repository_dispatch'
314271
env:
315272
PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_API_TOKEN }}"
316273
run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
317-
318274
- name: Upload to PyPI
319275
if: steps.deployable.outputs.DEPLOY
320276
uses: pypa/gh-action-pypi-publish@release/v1
@@ -327,33 +283,26 @@ jobs:
327283
needs: [deploy-fileformats]
328284
runs-on: ubuntu-latest
329285
steps:
330-
331286
- uses: actions/checkout@v3
332287
with:
333288
submodules: recursive
334289
fetch-depth: 0
335-
336290
- name: Set up Python
337291
uses: actions/setup-python@v4
338292
with:
339293
python-version: '3.11'
340-
341294
- name: Install build tools
342295
run: python -m pip install build twine
343-
344296
- name: Build source and wheel distributions
345297
run: python -m build ./related-packages/fileformats-extras
346-
347298
- name: Check distributions
348299
run: twine check ./related-packages/fileformats-extras/dist/*
349-
350300
- name: Check for PyPI token on tag
351301
id: deployable
352302
if: github.event_name == 'release' || github.event_name == 'repository_dispatch'
353303
env:
354304
PYPI_API_TOKEN: "${{ secrets.PYPI_FILEFORMATS_EXTRAS_API_TOKEN }}"
355305
run: if [ -n "$PYPI_API_TOKEN" ]; then echo "DEPLOY=true" >> $GITHUB_OUTPUT; fi
356-
357306
- name: Upload to PyPI
358307
if: steps.deployable.outputs.DEPLOY
359308
uses: pypa/gh-action-pypi-publish@release/v1
@@ -367,73 +316,58 @@ jobs:
367316
needs: [devcheck, test, deploy-fileformats, deploy-fileformats-extras]
368317
runs-on: ubuntu-latest
369318
steps:
370-
371319
- name: Checkout repo
372320
uses: actions/checkout@v2
373-
374321
- name: Set up Git user
375322
run: |
376323
git config --local user.email "[email protected]"
377324
git config --local user.name "GitHub Action"
378-
379325
- name: Download version file
380326
uses: actions/download-artifact@v2
381327
with:
382328
name: VersionFile
383329
path: mrtrix3_version.txt
384-
385330
- name: Extract Mrtrix version
386331
run: echo "MRTRIX_VERSION=$(cat mrtrix3_version.txt)" >> $GITHUB_ENV
387-
388332
- name: Download auto-gen pydra
389333
uses: actions/download-artifact@v2
390334
with:
391335
name: AutoGen
392336
path: pydra/tasks/mrtrix3/${{ env.SUBPKG_NAME }}
393-
394337
- name: Strip auto package from gitignore so it is included in package
395338
run: |
396339
sed -i '/\/pydra\/tasks\/mrtrix3\/${{ env.SUBPKG_NAME }}/d' .gitignore
397-
398340
- name: Add auto-generated directory to git repo
399341
if: github.event_name == 'release' || github.event_name == 'repository_dispatch'
400342
run: |
401343
git add pydra/tasks/mrtrix3/$SUBPKG_NAME
402344
git commit -am"added auto-generated version to make new tag for package version"
403345
git status
404-
405346
- name: Get latest version tag
406347
id: latest_tag
407348
run: |
408349
git fetch --tags
409350
echo "TAG=$(git tag -l | grep 'v.*' | tail -n 1 | awk -F post '{print $1}')" >> $GITHUB_OUTPUT
410-
411351
- name: Overwrite the tag of release event with latest commit (i.e. including the auto directory)
412352
if: github.event_name == 'release'
413353
run: |
414354
git tag -d ${{ steps.latest_tag.outputs.TAG }};
415355
git tag -a ${{ steps.latest_tag.outputs.TAG }} -m"Tag used to create a pydra-mrtrix3 $MRTRIX_VERSION release";
416-
417356
- name: Set up Python 3.11
418357
uses: actions/setup-python@v2
419358
with:
420359
python-version: 3.11
421-
422360
- name: Install build tools
423361
run: python -m pip install --upgrade pip twine build
424-
425362
- name: Build source and wheel distributions
426363
run: python -m build
427-
428364
- name: Check distributions
429365
run: twine check dist/*
430-
431366
- name: Upload sdist
432367
uses: actions/upload-artifact@v2
433368
with:
434369
name: SDist
435370
path: dist/*.tar.gz
436-
437371
# Deploy on tags if PYPI_API_TOKEN is defined in the repository secrets.
438372
# Secrets are not accessible in the if: condition [0], so set an output variable [1]
439373
# [0] https://github.community/t/16928
@@ -444,7 +378,6 @@ jobs:
444378
env:
445379
PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"
446380
run: if [ -n "$PYPI_API_TOKEN" ]; then echo ::set-output name=DEPLOY::true; fi
447-
448381
- name: Upload to PyPI
449382
if: steps.deployable.outputs.DEPLOY
450383
uses: pypa/gh-action-pypi-publish@release/v1

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "pydra-mrtrix3 contains Pydra task specifications for MRtrix3 tool
88
readme = "README.rst"
99
requires-python = ">=3.8"
1010
dependencies = [
11-
"fileformats-medimage_mrtrix3 >=3.0.4a4",
11+
"fileformats-medimage_mrtrix3 >=3.0.4a7",
1212
"numpy",
1313
"pydra >=0.23",
1414
]
@@ -36,8 +36,7 @@ dev = [
3636
"click >=8.1.3",
3737
"tqdm",
3838
"attrs >=23.1.0",
39-
"fileformats >= 0.8",
40-
"fileformats-extras >= 0.2.1",
39+
"fileformats-extras >= 0.12.1",
4140
]
4241
doc = [
4342
"packaging",

0 commit comments

Comments
 (0)