@@ -14,77 +14,85 @@ 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
+ test :
44
+ needs : [build]
45
+ runs-on : ubuntu-latest
17
46
strategy :
18
47
matrix :
19
48
python-version : [3.7, 3.8, 3.9]
49
+ install : [sdist, wheel, repo, editable]
50
+ env :
51
+ INSTALL_TYPE : ${{ matrix.install }}
20
52
21
53
steps :
54
+ - uses : actions/checkout@v3
55
+ with :
56
+ fetch-depth : 0
22
57
- name : Set up Python ${{ matrix.python-version }}
23
- uses : actions/setup-python@v2
58
+ uses : actions/setup-python@v3
24
59
with :
25
60
python-version : ${{ matrix.python-version }}
26
- - uses : actions/checkout@v2
61
+ - name : Fetch packages
62
+ uses : actions/download-artifact@v3
27
63
with :
28
- ssh-key : " ${{ secrets.NIPREPS_DEPLOY }}"
29
- fetch-depth : 0
30
- - name : Build in confined, updated environment and interpolate version
64
+ name : dist
65
+ path : dist/
66
+ - name : Select archive
67
+ run : |
68
+ if [ "$INSTALL_TYPE" = "sdist" ]; then
69
+ ARCHIVE=$( ls dist/*.tar.gz )
70
+ elif [ "$INSTALL_TYPE" = "wheel" ]; then
71
+ ARCHIVE=$( ls dist/*.whl )
72
+ elif [ "$INSTALL_TYPE" = "repo" ]; then
73
+ ARCHIVE="."
74
+ elif [ "$INSTALL_TYPE" = "editable" ]; then
75
+ ARCHIVE="-e ."
76
+ fi
77
+ echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
78
+ - name : Install package
79
+ run : python -m pip install $ARCHIVE
80
+ - name : Check version
31
81
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
82
# Interpolate version
39
83
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
40
84
TAG=${GITHUB_REF##*/}
41
85
fi
42
86
THISVERSION=$( python get_version.py )
43
87
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
88
INSTALLED_VERSION=$(python -c 'import niworkflows; print(niworkflows.__version__, end="")')
54
89
echo "VERSION: \"${THISVERSION}\""
55
90
echo "INSTALLED: \"${INSTALLED_VERSION}\""
56
91
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}"
92
+ - name : Install test dependencies
93
+ run : python -m pip install "niworkflows[tests]"
94
+ - name : Run tests
95
+ run : pytest -sv --doctest-modules --cov niworkflows niworkflows
88
96
89
97
flake8 :
90
98
if : " !contains(github.event.head_commit.message, '[skip ci]')"
0 commit comments