@@ -20,151 +20,109 @@ permissions:
2020jobs :
2121 build :
2222 runs-on : ubuntu-latest
23+ outputs :
24+ version : ${{ steps.get_version.outputs.version }}
25+ steps :
26+ - uses : actions/checkout@v3
27+ with :
28+ fetch-depth : 0
29+ - uses : actions/setup-python@v4
30+ with :
31+ python-version : 3
32+ - uses : actions/cache@v3
33+ with :
34+ path : ~/.cache/pip
35+ key : pip-cache-v1
36+ restore-keys : |
37+ pip-cache-
38+ - run : pip install --upgrade build twine
39+ - name : Build sdist and wheel
40+ run : python -m build
41+ - run : twine check dist/*
42+ - uses : actions/upload-artifact@v3
43+ with :
44+ name : dist
45+ path : dist/
46+ - name : Interpolate version in confined environment
47+ id : get_version
48+ run : |
49+ python -m venv /tmp/buildenv
50+ source /tmp/buildenv/bin/activate
51+ python -m pip install --upgrade setuptools setuptools_scm nipreps-versions
52+ if [[ "$GITHUB_REF" == refs/tags/* ]]; then
53+ TAG=${GITHUB_REF##*/}
54+ fi
55+ THISVERSION=$( python -m setuptools_scm )
56+ THISVERSION=${TAG:-$THISVERSION}
57+ echo "Expected VERSION: \"${THISVERSION}\""
58+ echo "version=${THISVERSION}" >> $GITHUB_OUTPUT
59+
60+ test-install :
61+ runs-on : ubuntu-latest
62+ needs : build
2363 strategy :
2464 matrix :
2565 python-version : [3.7, 3.8, 3.9]
66+ mode : ['repo', 'sdist', 'wheel', 'editable']
2667
68+ env :
69+ TEMPLATEFLOW_HOME : /tmp/home
70+ THISVERSION : ${{ needs.build.outputs.version }}
2771 steps :
2872 - uses : actions/checkout@v3
73+ if : matrix.mode == 'repo' || matrix.mode == 'editable'
2974 with :
3075 fetch-depth : 0
76+ - uses : actions/download-artifact@v3
77+ if : matrix.mode == 'sdist' || matrix.mode == 'wheel'
78+ with :
79+ name : dist
80+ path : /tmp/package/
3181 - name : Set up Python ${{ matrix.python-version }}
3282 uses : actions/setup-python@v4
3383 with :
3484 python-version : ${{ matrix.python-version }}
3585 - uses : actions/cache@v3
3686 with :
37- path : $HOME /.cache/pip
87+ path : ~ /.cache/pip
3888 key : pip-cache-v1
3989 restore-keys : |
4090 pip-cache-
41-
42- - name : Interpolate version in confined environment
91+ - name : Upgrade pip
92+ run : pip install --upgrade pip wheel
93+ - name : Set install command
4394 run : |
44- python -m venv /tmp/buildenv
45- source /tmp/buildenv/bin/activate
46- python -m pip install --upgrade setuptools setuptools_scm nipreps-versions
47- if [[ "$GITHUB_REF" == refs/tags/* ]]; then
48- TAG=${GITHUB_REF##*/}
49- fi
50- THISVERSION=$( python -m setuptools_scm )
51- THISVERSION=${TAG:-$THISVERSION}
52- echo "Expected VERSION: \"${THISVERSION}\""
53- echo "THISVERSION=${THISVERSION}" >> $GITHUB_ENV
54-
55- - name : Build packages
56- run : |
57- pip install build twine
58- python -m build
59- twine check dist/templateflow*
60- mv dist /tmp/package
61-
62- - name : Install in confined environment [pip]
63- env :
64- TEMPLATEFLOW_HOME : /tmp/home/pip
65- run : |
66- python -m venv /tmp/pip
67- source /tmp/pip/bin/activate
68- pip install --upgrade pip wheel
69- pip install .
70- INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
71- echo "VERSION: \"${THISVERSION}\""
72- echo "INSTALLED: \"${INSTALLED_VERSION}\""
73- test "${INSTALLED_VERSION}" = "${THISVERSION}"
74-
75- - name : Install in confined environment [sdist]
76- env :
77- TEMPLATEFLOW_HOME : /tmp/home/sdist
95+ case ${{ matrix.mode }} in
96+ repo)
97+ echo "TARGET=." >> $GITHUB_ENV
98+ ;;
99+ editable)
100+ echo "TARGET=-e ." >> $GITHUB_ENV
101+ ;;
102+ sdist)
103+ echo "TARGET=$( ls /tmp/package/templateflow*.tar.gz )" >> $GITHUB_ENV
104+ ;;
105+ wheel)
106+ echo "TARGET=$( ls /tmp/package/templateflow*.whl )" >> $GITHUB_ENV
107+ ;;
108+ esac
109+ - name : Install and check version
78110 run : |
79- python -m venv /tmp/install_sdist
80- source /tmp/install_sdist/bin/activate
81- pip install --upgrade pip wheel
82- pip install /tmp/package/templateflow*.tar.gz
111+ pip install $TARGET
83112 INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
84113 echo "VERSION: \"${THISVERSION}\""
85114 echo "INSTALLED: \"${INSTALLED_VERSION}\""
86115 test "${INSTALLED_VERSION}" = "${THISVERSION}"
87116
88- - name : Re-install in confined environment [sdist]
89- env :
90- TEMPLATEFLOW_HOME : /tmp/home/sdist
91- run : |
92- source /tmp/install_sdist/bin/activate
93- pip install /tmp/package/templateflow*.tar.gz --force-reinstall
94- find ${TEMPLATEFLOW_HOME} >> /tmp/.sdist-install.txt
95- - name : Re-install in confined environment [sdist - missing template]
96- env :
97- TEMPLATEFLOW_HOME : /tmp/home/sdist
98- run : |
99- rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
100- source /tmp/install_sdist/bin/activate
101- pip install /tmp/package/templateflow*.tar.gz --force-reinstall
102- python -c "import templateflow; templateflow.update(overwrite=False)"
103- find ${TEMPLATEFLOW_HOME} >> /tmp/.sdist-install-2.txt
104- diff /tmp/.sdist-install.txt /tmp/.sdist-install-2.txt
105- exit $?
106-
107- - name : Install in confined environment [wheel]
108- env :
109- TEMPLATEFLOW_HOME : /tmp/home/wheel
110- run : |
111- python -m venv /tmp/install_wheel
112- source /tmp/install_wheel/bin/activate
113- pip install --upgrade pip wheel
114- pip install /tmp/package/templateflow*.whl
115- INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
116- echo "INSTALLED: \"${INSTALLED_VERSION}\""
117- test "${INSTALLED_VERSION}" = "${THISVERSION}"
118-
119- - name : Re-install in confined environment [wheel]
120- env :
121- TEMPLATEFLOW_HOME : /tmp/home/wheel
122- run : |
123- source /tmp/install_wheel/bin/activate
124- pip install /tmp/package/templateflow*.whl --force-reinstall
125- find ${TEMPLATEFLOW_HOME} >> /tmp/.wheel-install.txt
126- - name : Re-install in confined environment [wheel - missing template]
127- env :
128- TEMPLATEFLOW_HOME : /tmp/home/wheel
129- run : |
130- rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
131- source /tmp/install_wheel/bin/activate
132- pip install /tmp/package/templateflow*.whl --force-reinstall
133- # Wheels do not run post-install hooks:
134- test ! -d ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
135- python -c "import templateflow; templateflow.update(overwrite=False)"
136- find ${TEMPLATEFLOW_HOME} >> /tmp/.wheel-install-2.txt
137- diff /tmp/.wheel-install.txt /tmp/.wheel-install-2.txt
138- exit $?
139-
140- - name : Install in confined environment [editable]
141- env :
142- TEMPLATEFLOW_HOME : /tmp/home/setup_develop
143- run : |
144- python -m venv /tmp/setup_develop
145- source /tmp/setup_develop/bin/activate
146- pip install --upgrade pip wheel
147- pip install -e .
148- INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")')
149- echo "INSTALLED: \"${INSTALLED_VERSION}\""
150- test "${INSTALLED_VERSION}" = "${THISVERSION}"
151-
152- - name : Re-install in confined environment [editable]
153- env :
154- TEMPLATEFLOW_HOME : /tmp/home/setup_develop
117+ - name : Re-install
155118 run : |
156- source /tmp/setup_develop/bin/activate
157- pip install -e .
158- find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-develop.txt
159-
160- - name : Re-install in confined environment [editable - missing template]
161- env :
162- TEMPLATEFLOW_HOME : /tmp/home/setup_develop
119+ pip install $TARGET --force-reinstall
120+ find ${TEMPLATEFLOW_HOME} >> /tmp/.install.txt
121+ - name : Re-install [missing template]
163122 run : |
164123 rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym
165- source /tmp/setup_develop/bin/activate
166- pip install -e .
124+ pip install $TARGET --force-reinstall
167125 python -c "import templateflow; templateflow.update(overwrite=False)"
168- find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-develop -2.txt
169- diff /tmp/.setup-develop .txt /tmp/.setup-develop -2.txt
126+ find ${TEMPLATEFLOW_HOME} >> /tmp/.install -2.txt
127+ diff /tmp/.install .txt /tmp/.install -2.txt
170128 exit $?
0 commit comments