1111 branches :
1212 - master
1313 - maint/*
14+ tags :
15+ - " *"
1416 pull_request :
1517 branches :
1618 - master
@@ -23,6 +25,59 @@ defaults:
2325 shell : bash
2426
2527jobs :
28+ build :
29+ runs-on : ubuntu-latest
30+ steps :
31+ - uses : actions/checkout@v3
32+ with :
33+ fetch-depth : 0
34+ - uses : actions/setup-python@v4
35+ with :
36+ python-version : 3
37+ - run : pip install --upgrade build twine
38+ - name : Build sdist and wheel
39+ run : python -m build
40+ - run : twine check dist/*
41+ - name : Build git archive
42+ run : git archive -v -o dist/nibabel-archive.tgz HEAD
43+ - uses : actions/upload-artifact@v3
44+ with :
45+ name : dist
46+ path : dist/
47+
48+ test-package :
49+ runs-on : ubuntu-latest
50+ needs : [build]
51+ strategy :
52+ matrix :
53+ package : ['wheel', 'sdist', 'archive']
54+ steps :
55+ - uses : actions/download-artifact@v3
56+ with :
57+ name : dist
58+ path : dist/
59+ - uses : actions/setup-python@v4
60+ with :
61+ python-version : 3
62+ - name : Display Python version
63+ run : python -c "import sys; print(sys.version)"
64+ - name : Update pip
65+ run : pip install --upgrade pip
66+ - name : Install wheel
67+ run : pip install dist/nibabel-*.whl
68+ if : matrix.package == 'wheel'
69+ - name : Install sdist
70+ run : pip install dist/nibabel-*.tar.gz
71+ if : matrix.package == 'sdist'
72+ - name : Install archive
73+ run : pip install dist/nibabel-archive.tgz
74+ if : matrix.package == 'archive'
75+ - run : python -c 'import nibabel; print(nibabel.__version__)'
76+ - name : Install test extras
77+ run : pip install nibabel[test]
78+ - name : Run tests
79+ run : pytest --doctest-modules --doctest-plus -v --pyargs nibabel
80+
2681 stable :
2782 # Check each OS, all supported Python, minimum versions and latest releases
2883 runs-on : ${{ matrix.os }}
@@ -68,28 +123,6 @@ jobs:
68123 check : skiptests
69124 pip-flags : ' '
70125 depends : ' '
71- # Check all installation methods
72- - os : ubuntu-latest
73- python-version : " 3.10"
74- install : wheel
75- check : test
76- pip-flags : ' '
77- depends : REQUIREMENTS
78- optional-depends : DEFAULT_OPT_DEPENDS
79- - os : ubuntu-latest
80- python-version : " 3.10"
81- install : sdist
82- check : test
83- pip-flags : ' '
84- depends : REQUIREMENTS
85- optional-depends : DEFAULT_OPT_DEPENDS
86- - os : ubuntu-latest
87- python-version : " 3.10"
88- install : archive
89- check : test
90- pip-flags : ' '
91- depends : REQUIREMENTS
92- optional-depends : DEFAULT_OPT_DEPENDS
93126 exclude :
94127 - os : ubuntu-latest
95128 architecture : x86
@@ -103,12 +136,12 @@ jobs:
103136 EXTRA_PIP_FLAGS : ${{ matrix.pip-flags }}
104137
105138 steps :
106- - uses : actions/checkout@v2
139+ - uses : actions/checkout@v3
107140 with :
108141 submodules : recursive
109142 fetch-depth : 0
110143 - name : Set up Python ${{ matrix.python-version }}
111- uses : actions/setup-python@v2
144+ uses : actions/setup-python@v4
112145 with :
113146 python-version : ${{ matrix.python-version }}
114147 architecture : ${{ matrix.architecture }}
@@ -131,8 +164,23 @@ jobs:
131164 run : tools/ci/submit_coverage.sh
132165 if : ${{ always() }}
133166 - name : Upload pytest test results
134- uses : actions/upload-artifact@v2
167+ uses : actions/upload-artifact@v3
135168 with :
136169 name : pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
137170 path : for_testing/test-results.xml
138171 if : ${{ always() && matrix.check == 'test' }}
172+
173+ publish :
174+ runs-on : ubuntu-latest
175+ environment : " Package deployment"
176+ needs : [stable, test-package]
177+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
178+ steps :
179+ - uses : actions/download-artifact@v3
180+ with :
181+ name : dist
182+ path : dist/
183+ - uses : pypa/gh-action-pypi-publish@release/v1
184+ with :
185+ user : __token__
186+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments