@@ -14,85 +14,148 @@ jobs:
14
14
build :
15
15
if : " !contains(github.event.head_commit.message, '[skip ci]')"
16
16
runs-on : ubuntu-latest
17
+ strategy :
18
+ matrix :
19
+ python-version : ["3.10"]
20
+ steps :
21
+ - uses : actions/checkout@v3
22
+ with :
23
+ fetch-depth : 0
24
+ - name : Set up Python ${{ matrix.python-version }}
25
+ uses : actions/setup-python@v3
26
+ with :
27
+ python-version : ${{ matrix.python-version }}
28
+ - name : Display Python version
29
+ run : python -c "import sys; print(sys.version)"
30
+ - name : Check python version and install build
31
+ run : |
32
+ python --version
33
+ python -m pip install -U build twine
34
+ - name : Build niworkflows
35
+ run : python -m build
36
+ - name : Check distributions
37
+ run : twine check dist/*
38
+ - uses : actions/upload-artifact@v3
39
+ with :
40
+ name : dist
41
+ path : dist/
42
+
43
+ get_data :
44
+ runs-on : ubuntu-latest
45
+ steps :
46
+ - name : Create test data directory
47
+ run : mkdir -p $HOME/.cache/stanford-crn
48
+ - name : Load test data cache
49
+ uses : actions/cache@v2
50
+ id : stanford-crn
51
+ with :
52
+ path : ~/.cache/stanford-crn/
53
+ key : data-v0-${{ github.ref_name }}-${{ github.sha }}
54
+ restore-keys : |
55
+ data-v0-${{ github.ref_name }}-
56
+ data-v0-
57
+ - name : Install datalad
58
+ run : |
59
+ sudo apt-get update -y
60
+ sudo apt-get install -y git-annex --no-install-recommends
61
+ python -m pip install datalad==0.14.7 datalad-osf
62
+ datalad wtf
63
+ - name : Fetch test data
64
+ run : |
65
+ DS=$HOME/.cache/stanford-crn
66
+ datalad install -r -s https://github.com/nipreps-data/niworkflows-data.git $DS
67
+ cd $DS
68
+ git -C BIDS-examples-1-enh-ds054 checkout enh/ds054
69
+ datalad update -r --merge -d .
70
+ datalad get -J 2 -r ds000003 ds000030/sub-10228/func
71
+
72
+ test :
73
+ needs : [build, get_data]
74
+ runs-on : ubuntu-latest
17
75
strategy :
18
76
matrix :
19
77
python-version : [3.7, 3.8, 3.9]
78
+ install : [repo]
79
+ include :
80
+ - python-version : 3.9
81
+ install : sdist
82
+ - python-version : 3.9
83
+ install : wheel
84
+ - python-version : 3.9
85
+ install : editable
86
+ env :
87
+ INSTALL_TYPE : ${{ matrix.install }}
20
88
21
89
steps :
90
+ - uses : actions/checkout@v3
91
+ with :
92
+ fetch-depth : 0
22
93
- name : Set up Python ${{ matrix.python-version }}
23
- uses : actions/setup-python@v2
94
+ uses : actions/setup-python@v3
24
95
with :
25
96
python-version : ${{ matrix.python-version }}
26
- - uses : actions/checkout@v2
97
+ - name : Load test data cache
98
+ uses : actions/cache@v2
99
+ id : stanford-crn
27
100
with :
28
- ssh-key : " ${{ secrets.NIPREPS_DEPLOY }}"
29
- fetch-depth : 0
30
- - name : Build in confined, updated environment and interpolate version
101
+ path : ~/.cache/stanford-crn/
102
+ key : data-v0-${{ github.ref_name }}-${{ github.sha }}
103
+ - name : Load TemplateFlow cache
104
+ uses : actions/cache@v2
105
+ id : templateflow
106
+ with :
107
+ path : ~/.cache/templateflow
108
+ key : templateflow-v0-${{ github.ref_name }}-${{ strategy.job-index }}-${{ github.sha }}
109
+ restore-keys : |
110
+ templateflow-v0-${{ github.ref_name }}-
111
+ templateflow-v0-
112
+ - name : Fetch packages
113
+ uses : actions/download-artifact@v3
114
+ with :
115
+ name : dist
116
+ path : dist/
117
+ - name : Select archive
118
+ run : |
119
+ if [ "$INSTALL_TYPE" = "sdist" ]; then
120
+ ARCHIVE=$( ls dist/*.tar.gz )
121
+ elif [ "$INSTALL_TYPE" = "wheel" ]; then
122
+ ARCHIVE=$( ls dist/*.whl )
123
+ elif [ "$INSTALL_TYPE" = "repo" ]; then
124
+ ARCHIVE="."
125
+ elif [ "$INSTALL_TYPE" = "editable" ]; then
126
+ ARCHIVE="-e ."
127
+ fi
128
+ echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
129
+ - name : Install package
130
+ run : python -m pip install $ARCHIVE
131
+ - name : Check version
31
132
run : |
32
- python -m venv /tmp/buildenv
33
- source /tmp/buildenv/bin/activate
34
- python -m pip install -U setuptools pip wheel twine docutils
35
- python setup.py sdist bdist_wheel
36
- python -m twine check dist/niworkflows*
37
-
38
133
# Interpolate version
39
134
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
40
135
TAG=${GITHUB_REF##*/}
41
136
fi
42
137
THISVERSION=$( python get_version.py )
43
138
THISVERSION=${TAG:-$THISVERSION}
44
- echo "Expected VERSION: \"${THISVERSION}\""
45
- echo "THISVERSION=${THISVERSION}" >> ${GITHUB_ENV}
46
-
47
- - name : Install in confined environment [sdist]
48
- run : |
49
- python -m venv /tmp/install_sdist
50
- source /tmp/install_sdist/bin/activate
51
- python -m pip install --upgrade pip wheel
52
- python -m pip install dist/niworkflows*.tar.gz
53
139
INSTALLED_VERSION=$(python -c 'import niworkflows; print(niworkflows.__version__, end="")')
54
140
echo "VERSION: \"${THISVERSION}\""
55
141
echo "INSTALLED: \"${INSTALLED_VERSION}\""
56
142
test "${INSTALLED_VERSION}" = "${THISVERSION}"
57
-
58
- - name : Install in confined environment [wheel]
59
- run : |
60
- python -m venv /tmp/install_wheel
61
- source /tmp/install_wheel/bin/activate
62
- python -m pip install --upgrade pip wheel
63
- python -m pip install dist/niworkflows*.whl
64
- INSTALLED_VERSION=$(python -c 'import niworkflows; print(niworkflows.__version__, end="")')
65
- echo "INSTALLED: \"${INSTALLED_VERSION}\""
66
- test "${INSTALLED_VERSION}" = "${THISVERSION}"
67
-
68
- - name : Install in confined environment [pip install .]
69
- run : |
70
- python -m venv /tmp/setup_install
71
- source /tmp/setup_install/bin/activate
72
- python -m pip install --upgrade pip wheel
73
- python -m pip install .
74
- INSTALLED_VERSION=$(python -c 'import niworkflows; print(niworkflows.__version__, end="")')
75
- echo "INSTALLED: \"${INSTALLED_VERSION}\""
76
- test "${INSTALLED_VERSION}" = "${THISVERSION}"
77
-
78
- - name : Install in confined environment [pip install -e .]
79
- run : |
80
- python -m venv /tmp/setup_develop
81
- source /tmp/setup_develop/bin/activate
82
- python -m pip install pip
83
- python -m pip install --upgrade pip wheel
84
- python -m pip install -e .
85
- INSTALLED_VERSION=$(python -c 'import niworkflows; print(niworkflows.__version__, end="")')
86
- echo "INSTALLED: \"${INSTALLED_VERSION}\""
87
- test "${INSTALLED_VERSION}" = "${THISVERSION}"
143
+ - name : Install test dependencies
144
+ run : python -m pip install "niworkflows[tests]"
145
+ - name : Run tests
146
+ uses : GabrielBB/xvfb-action@v1
147
+ with :
148
+ run : pytest -sv --no-xvfb --doctest-modules --cov niworkflows niworkflows
149
+ - uses : codecov/codecov-action@v2
150
+ name : Submit to CodeCov
88
151
89
152
flake8 :
90
153
if : " !contains(github.event.head_commit.message, '[skip ci]')"
91
154
runs-on : ubuntu-latest
92
155
steps :
93
- - uses : actions/checkout@v2
156
+ - uses : actions/checkout@v3
94
157
- name : Set up Python 3.7
95
- uses : actions/setup-python@v1
158
+ uses : actions/setup-python@v3
96
159
with :
97
160
python-version : 3.7
98
161
- run : pip install flake8
0 commit comments