11
11
branches :
12
12
- master
13
13
- maint/*
14
+ tags :
15
+ - " *"
14
16
pull_request :
15
17
branches :
16
18
- master
@@ -23,6 +25,59 @@ defaults:
23
25
shell : bash
24
26
25
27
jobs :
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
+
26
81
stable :
27
82
# Check each OS, all supported Python, minimum versions and latest releases
28
83
runs-on : ${{ matrix.os }}
@@ -68,28 +123,6 @@ jobs:
68
123
check : skiptests
69
124
pip-flags : ' '
70
125
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
93
126
exclude :
94
127
- os : ubuntu-latest
95
128
architecture : x86
@@ -103,12 +136,12 @@ jobs:
103
136
EXTRA_PIP_FLAGS : ${{ matrix.pip-flags }}
104
137
105
138
steps :
106
- - uses : actions/checkout@v2
139
+ - uses : actions/checkout@v3
107
140
with :
108
141
submodules : recursive
109
142
fetch-depth : 0
110
143
- name : Set up Python ${{ matrix.python-version }}
111
- uses : actions/setup-python@v2
144
+ uses : actions/setup-python@v4
112
145
with :
113
146
python-version : ${{ matrix.python-version }}
114
147
architecture : ${{ matrix.architecture }}
@@ -131,8 +164,23 @@ jobs:
131
164
run : tools/ci/submit_coverage.sh
132
165
if : ${{ always() }}
133
166
- name : Upload pytest test results
134
- uses : actions/upload-artifact@v2
167
+ uses : actions/upload-artifact@v3
135
168
with :
136
169
name : pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
137
170
path : for_testing/test-results.xml
138
171
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