Skip to content

Commit 84e7d61

Browse files
committed
CI: Test with latest pip, stop using setup.py directly
1 parent 0ba0040 commit 84e7d61

File tree

1 file changed

+32
-71
lines changed

1 file changed

+32
-71
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 32 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,54 @@ on:
1212

1313
jobs:
1414
build:
15-
if: "!startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')"
1615
runs-on: ubuntu-latest
1716
strategy:
1817
matrix:
1918
python-version: [3.7, 3.8, 3.9]
20-
pip: ["pip==21.2", "pip~=22.0"]
2119

2220
steps:
23-
- uses: actions/checkout@v2
24-
- name: Fetch all tags (for setuptools_scm to work)
25-
run: |
26-
/usr/bin/git -c protocol.version=2 fetch --tags --prune --unshallow origin
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
2724
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v1
25+
uses: actions/setup-python@v4
2926
with:
3027
python-version: ${{ matrix.python-version }}
31-
- uses: actions/cache@v1
28+
- uses: actions/cache@v3
3229
with:
3330
path: $HOME/.cache/pip
3431
key: pip-cache-v1
3532
restore-keys: |
3633
pip-cache-
3734
38-
- name: Build in confined environment and interpolate version
35+
- name: Interpolate version in confined environment
3936
run: |
4037
python -m venv /tmp/buildenv
4138
source /tmp/buildenv/bin/activate
42-
python -m pip install -U "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
43-
setuptools_scm_git_archive pip twine docutils
44-
python setup.py sdist bdist_wheel
45-
python -m twine check dist/templateflow*
46-
47-
mv dist /tmp/package
48-
rm -rf templateflow.egg-info/
49-
50-
# Interpolate version
39+
python -m pip install --upgrade setuptools setuptools_scm nipreps-versions
5140
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
5241
TAG=${GITHUB_REF##*/}
5342
fi
54-
THISVERSION=$( python setup.py --version )
43+
THISVERSION=$( python -m setuptools_scm )
5544
THISVERSION=${TAG:-$THISVERSION}
5645
echo "Expected VERSION: \"${THISVERSION}\""
5746
echo "THISVERSION=${THISVERSION}" >> $GITHUB_ENV
5847
48+
- name: Build packages
49+
run: |
50+
pip install build twine
51+
python -m build
52+
twine check dist/templateflow*
53+
mv dist /tmp/package
54+
5955
- name: Install in confined environment [pip]
6056
env:
6157
TEMPLATEFLOW_HOME: /tmp/home/pip
6258
run: |
6359
python -m venv /tmp/pip
6460
source /tmp/pip/bin/activate
65-
python -m pip install -U "setuptools >= 45" "setuptools_scm >= 6.2" "${{ matrix.pip }}"
66-
python -m pip install .
61+
pip install --upgrade pip wheel
62+
pip install .
6763
INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
6864
echo "VERSION: \"${THISVERSION}\""
6965
echo "INSTALLED: \"${INSTALLED_VERSION}\""
@@ -75,8 +71,8 @@ jobs:
7571
run: |
7672
python -m venv /tmp/install_sdist
7773
source /tmp/install_sdist/bin/activate
78-
python -m pip install -U "setuptools >= 45" "${{ matrix.pip }}"
79-
python -m pip install /tmp/package/templateflow*.tar.gz
74+
pip install --upgrade pip wheel
75+
pip install /tmp/package/templateflow*.tar.gz
8076
INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
8177
echo "VERSION: \"${THISVERSION}\""
8278
echo "INSTALLED: \"${INSTALLED_VERSION}\""
@@ -87,15 +83,15 @@ jobs:
8783
TEMPLATEFLOW_HOME: /tmp/home/sdist
8884
run: |
8985
source /tmp/install_sdist/bin/activate
90-
python -m pip install /tmp/package/templateflow*.tar.gz --force-reinstall
86+
pip install /tmp/package/templateflow*.tar.gz --force-reinstall
9187
find ${TEMPLATEFLOW_HOME} >> /tmp/.sdist-install.txt
9288
- name: Re-install in confined environment [sdist - missing template]
9389
env:
9490
TEMPLATEFLOW_HOME: /tmp/home/sdist
9591
run: |
9692
rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
9793
source /tmp/install_sdist/bin/activate
98-
python -m pip install /tmp/package/templateflow*.tar.gz --force-reinstall
94+
pip install /tmp/package/templateflow*.tar.gz --force-reinstall
9995
python -c "import templateflow; templateflow.update(overwrite=False)"
10096
find ${TEMPLATEFLOW_HOME} >> /tmp/.sdist-install-2.txt
10197
diff /tmp/.sdist-install.txt /tmp/.sdist-install-2.txt
@@ -107,8 +103,8 @@ jobs:
107103
run: |
108104
python -m venv /tmp/install_wheel
109105
source /tmp/install_wheel/bin/activate
110-
python -m pip install -U "setuptools >= 45" "${{ matrix.pip }}"
111-
python -m pip install /tmp/package/templateflow*.whl
106+
pip install --upgrade pip wheel
107+
pip install /tmp/package/templateflow*.whl
112108
INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
113109
echo "INSTALLED: \"${INSTALLED_VERSION}\""
114110
test "${INSTALLED_VERSION}" = "${THISVERSION}"
@@ -118,84 +114,49 @@ jobs:
118114
TEMPLATEFLOW_HOME: /tmp/home/wheel
119115
run: |
120116
source /tmp/install_wheel/bin/activate
121-
python -m pip install /tmp/package/templateflow*.whl --force-reinstall
117+
pip install /tmp/package/templateflow*.whl --force-reinstall
122118
find ${TEMPLATEFLOW_HOME} >> /tmp/.wheel-install.txt
123119
- name: Re-install in confined environment [wheel - missing template]
124120
env:
125121
TEMPLATEFLOW_HOME: /tmp/home/wheel
126122
run: |
127123
rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
128124
source /tmp/install_wheel/bin/activate
129-
python -m pip install /tmp/package/templateflow*.whl --force-reinstall
125+
pip install /tmp/package/templateflow*.whl --force-reinstall
130126
# Wheels do not run post-install hooks:
131127
test ! -d ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
132128
python -c "import templateflow; templateflow.update(overwrite=False)"
133129
find ${TEMPLATEFLOW_HOME} >> /tmp/.wheel-install-2.txt
134130
diff /tmp/.wheel-install.txt /tmp/.wheel-install-2.txt
135131
exit $?
136132
137-
- name: Install in confined environment [setup.py - install]
138-
env:
139-
TEMPLATEFLOW_HOME: /tmp/home/setup_install
140-
run: |
141-
python -m venv /tmp/setup_install
142-
source /tmp/setup_install/bin/activate
143-
python -m pip install -U "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
144-
setuptools_scm_git_archive "${{ matrix.pip }}"
145-
python -m pip install "numpy==1.20" Cython "pandas==1.3" "scipy==1.7"
146-
python setup.py install
147-
INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
148-
echo "INSTALLED: \"${INSTALLED_VERSION}\""
149-
test "${INSTALLED_VERSION}" = "${THISVERSION}"
150-
151-
- name: Re-install in confined environment [setup.py - install]
152-
env:
153-
TEMPLATEFLOW_HOME: /tmp/home/setup_install
154-
run: |
155-
source /tmp/setup_install/bin/activate
156-
python setup.py install
157-
find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-install.txt
158-
- name: Re-install in confined environment [setup.py - install - missing template]
159-
env:
160-
TEMPLATEFLOW_HOME: /tmp/home/setup_install
161-
run: |
162-
rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
163-
source /tmp/setup_install/bin/activate
164-
python setup.py install
165-
python -c "import templateflow; templateflow.update(overwrite=False)"
166-
find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-install-2.txt
167-
diff /tmp/.setup-install.txt /tmp/.setup-install-2.txt
168-
exit $?
169-
170-
- name: Install in confined environment [setup.py - develop]
133+
- name: Install in confined environment [editable]
171134
env:
172135
TEMPLATEFLOW_HOME: /tmp/home/setup_develop
173136
run: |
174137
python -m venv /tmp/setup_develop
175138
source /tmp/setup_develop/bin/activate
176-
python -m pip install -U "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
177-
setuptools_scm_git_archive "${{ matrix.pip }}"
178-
python -m pip install "numpy==1.20" Cython "pandas==1.3" "scipy==1.7"
179-
python setup.py develop
139+
pip install --upgrade pip wheel
140+
pip install -e .
180141
INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
181142
echo "INSTALLED: \"${INSTALLED_VERSION}\""
182143
test "${INSTALLED_VERSION}" = "${THISVERSION}"
183144
184-
- name: Re-install in confined environment [setup.py - develop]
145+
- name: Re-install in confined environment [editable]
185146
env:
186147
TEMPLATEFLOW_HOME: /tmp/home/setup_develop
187148
run: |
188149
source /tmp/setup_develop/bin/activate
189-
python setup.py develop
150+
pip install -e .
190151
find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-develop.txt
191152
192-
- name: Re-install in confined environment [setup.py - develop - missing template]
153+
- name: Re-install in confined environment [editable - missing template]
193154
env:
194155
TEMPLATEFLOW_HOME: /tmp/home/setup_develop
195156
run: |
196157
rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
197158
source /tmp/setup_develop/bin/activate
198-
python setup.py develop
159+
pip install -e .
199160
python -c "import templateflow; templateflow.update(overwrite=False)"
200161
find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-develop-2.txt
201162
diff /tmp/.setup-develop.txt /tmp/.setup-develop-2.txt

0 commit comments

Comments
 (0)