@@ -23,6 +23,59 @@ defaults:
2323 shell : bash
2424
2525jobs :
26+ build :
27+ runs-on : ubuntu-latest
28+ steps :
29+ - uses : actions/checkout@v3
30+ with :
31+ fetch-depth : 0
32+ - uses : actions/setup-python@v4
33+ with :
34+ python-version : 3
35+ - run : pip install --upgrade build twine
36+ - name : Build sdist and wheel
37+ run : python -m build
38+ - run : twine check dist/*
39+ - name : Build git archive
40+ run : git archive -v -o dist/nibabel-archive.tgz HEAD
41+ - uses : actions/upload-artifact@v3
42+ with :
43+ name : dist
44+ path : dist/
45+
46+ test-package :
47+ runs-on : ubuntu-latest
48+ needs : [build]
49+ strategy :
50+ matrix :
51+ package : ['wheel', 'sdist', 'archive']
52+ steps :
53+ - uses : actions/download-artifact@v3
54+ with :
55+ name : dist
56+ path : dist/
57+ - uses : actions/setup-python@v4
58+ with :
59+ python-version : 3
60+ - name : Display Python version
61+ run : python -c "import sys; print(sys.version)"
62+ - name : Update pip
63+ run : pip install --upgrade pip
64+ - name : Install wheel
65+ run : pip install dist/nibabel-*.whl
66+ if : matrix.package == 'wheel'
67+ - name : Install sdist
68+ run : pip install dist/nibabel-*.tar.gz
69+ if : matrix.package == 'sdist'
70+ - name : Install archive
71+ run : pip install dist/nibabel-archive.tgz
72+ if : matrix.package == 'archive'
73+ - run : python -c 'import nibabel; print(nibabel.__version__)'
74+ - name : Install test extras
75+ run : pip install nibabel[test]
76+ - name : Run tests
77+ run : pytest --doctest-modules --doctest-plus -v --pyargs nibabel
78+
2679 stable :
2780 # Check each OS, all supported Python, minimum versions and latest releases
2881 runs-on : ${{ matrix.os }}
@@ -136,3 +189,17 @@ jobs:
136189 name : pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
137190 path : for_testing/test-results.xml
138191 if : ${{ always() && matrix.check == 'test' }}
192+
193+ publish :
194+ runs-on : ubuntu-latest
195+ needs : [stable, test-package]
196+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
197+ steps :
198+ - uses : actions/download-artifact@v3
199+ with :
200+ name : dist
201+ path : dist/
202+ - uses : pypa/gh-action-pypi-publish@release/v1
203+ with :
204+ user : __token__
205+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments