generated from nipype/pydra-tasks-template
-
Notifications
You must be signed in to change notification settings - Fork 6
118 lines (107 loc) · 3.73 KB
/
pythonpackage.yml
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
#This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
# Set once
env:
SUBPACKAGE: nipype1
FSLCONDA: https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/public/
NO_ET: 1 # etelemetry causes order-of-magnitude slowdowns
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -el {0}
jobs:
devcheck:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.12"] # Check oldest and newest versions
pip-flags: ["", "--editable"]
pydra:
- "pydra"
- "--editable git+https://github.com/nipype/pydra.git#egg=pydra"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
- name: Install Pydra
run: |
pip install ${{ matrix.pydra }}
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- name: Install task package
run: |
pip install ${{ matrix.pip-flags }} ".[dev]"
python -c "import pydra.tasks.$SUBPACKAGE as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: ${{ env.FSLCONDA }},conda-forge,defaults
channel-priority: true
- name: Install FSL
run: |
mamba install fsl-avwutils
mamba env config vars set FSLDIR="$CONDA_PREFIX" FSLOUTPUTTYPE="NIFTI_GZ"
# Hack because we're not doing a full FSL install
echo "6.0.7.9" > $CONDA_PREFIX/etc/fslversion
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install task package
run: |
pip install ".[test]"
python -c "import pydra.tasks.$SUBPACKAGE as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')"
- name: Test with pytest
run: |
pytest -sv --doctest-modules --pyargs pydra.tasks.$SUBPACKAGE \
--cov pydra.tasks.$SUBPACKAGE --cov-report xml --cov-report term-missing
- uses: codecov/codecov-action@v4
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
deploy:
needs: [build, devcheck, test]
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.repository_owner == 'nipype' && github.event.action == 'published'
environment: Publish
steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1