1
- name : Build wheels and deploy to PyPI
1
+ name : release- deploy
2
2
3
3
on :
4
4
release :
5
5
types : [ published ]
6
6
7
7
jobs :
8
- build_wheels :
9
- name : Build wheels for ${{ matrix.os }}
8
+ build-sdist :
9
+ name : Build source distribution
10
+ runs-on : ubuntu-latest
11
+ timeout-minutes : 10
12
+ steps :
13
+ - uses : actions/checkout@v2
14
+ with :
15
+ submodules : true
16
+
17
+ - uses : actions-rs/toolchain@v1
18
+ with :
19
+ toolchain : stable
20
+
21
+ - uses : actions/setup-python@v2
22
+ name : Install Python
23
+ with :
24
+ python-version : ' 3.10'
25
+
26
+ - name : Build sdist
27
+ run : |
28
+ python -m pip install -U pip
29
+ python -m pip install -U setuptools-rust
30
+ python -m pip install .
31
+ python setup.py sdist
32
+
33
+ - name : Store artifacts
34
+ uses : actions/upload-artifact@v2
35
+ with :
36
+ name : wheels
37
+ path : ./dist
38
+
39
+ build-wheels :
40
+ name : Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
10
41
runs-on : ${{ matrix.os }}
11
- env :
12
- CIBW_SKIP : " cp36-* *-musl*"
13
42
strategy :
14
43
fail-fast : false
15
44
matrix :
16
- os : [ubuntu-latest, windows-latest, macos-latest]
17
- python-version : ["3.10"]
45
+ include :
46
+ # Windows 32 bit
47
+ - os : windows-latest
48
+ python : 37
49
+ platform_id : win32
50
+ - os : windows-latest
51
+ python : 38
52
+ platform_id : win32
53
+ - os : windows-latest
54
+ python : 39
55
+ platform_id : win32
56
+ - os : windows-latest
57
+ python : 310
58
+ platform_id : win32
59
+
60
+ # Windows 64 bit
61
+ - os : windows-latest
62
+ python : 37
63
+ platform_id : win_amd64
64
+ - os : windows-latest
65
+ python : 38
66
+ platform_id : win_amd64
67
+ - os : windows-latest
68
+ python : 39
69
+ platform_id : win_amd64
70
+ - os : windows-latest
71
+ python : 310
72
+ platform_id : win_amd64
73
+
74
+ # Linux 64 bit manylinux2010
75
+ - os : ubuntu-latest
76
+ python : 37
77
+ platform_id : manylinux_x86_64
78
+ manylinux_image : manylinux2010
79
+ - os : ubuntu-latest
80
+ python : 38
81
+ platform_id : manylinux_x86_64
82
+ manylinux_image : manylinux2010
83
+ - os : ubuntu-latest
84
+ python : 39
85
+ platform_id : manylinux_x86_64
86
+ manylinux_image : manylinux2010
87
+ - os : ubuntu-latest
88
+ python : 310
89
+ platform_id : manylinux_x86_64
90
+ manylinux_image : manylinux2010
91
+
92
+ # Linux 64 bit manylinux2014
93
+ - os : ubuntu-latest
94
+ python : 37
95
+ platform_id : manylinux_x86_64
96
+ manylinux_image : manylinux2014
97
+ - os : ubuntu-latest
98
+ python : 38
99
+ platform_id : manylinux_x86_64
100
+ manylinux_image : manylinux2014
101
+ - os : ubuntu-latest
102
+ python : 39
103
+ platform_id : manylinux_x86_64
104
+ manylinux_image : manylinux2014
105
+ - os : ubuntu-latest
106
+ python : 310
107
+ platform_id : manylinux_x86_64
108
+ manylinux_image : manylinux2014
109
+
110
+ # MacOS x86_64
111
+ - os : macos-latest
112
+ python : 37
113
+ platform_id : macosx_x86_64
114
+ - os : macos-latest
115
+ python : 38
116
+ platform_id : macosx_x86_64
117
+ - os : macos-latest
118
+ python : 39
119
+ platform_id : macosx_x86_64
120
+ - os : macos-latest
121
+ python : 310
122
+ platform_id : macosx_x86_64
123
+
124
+ # MacOS arm64
125
+ - os : macos-latest
126
+ python : 38
127
+ platform_id : macosx_arm64
128
+ - os : macos-latest
129
+ python : 39
130
+ platform_id : macosx_arm64
131
+ - os : macos-latest
132
+ python : 310
133
+ platform_id : macosx_arm64
18
134
19
135
steps :
20
136
- uses : actions/checkout@v2
21
137
with :
22
138
submodules : true
23
139
24
- # Install rust
25
140
- uses : actions-rs/toolchain@v1
26
141
with :
27
142
toolchain : stable
28
143
29
- # Install Python
30
144
- uses : actions/setup-python@v2
31
145
name : Install Python
32
146
with :
33
- python-version : ${{ matrix.python-version }}
34
-
35
- - name : Install requirements
36
- run : |
37
- pip install -U pip
38
- pip install cibuildwheel==2.3.1
39
- pip install setuptools-rust
147
+ python-version : ' 3.9'
40
148
41
- - name : Build sdist
149
+ - name : Install cibuildwheel
42
150
run : |
43
- python setup.py sdist
151
+ python -m pip install -U pip
152
+ python -m pip install -U setuptools-rust
153
+ python -m pip install cibuildwheel==2.3.1
44
154
45
155
- name : Build wheels
156
+ env :
157
+ CIBW_BUILD : cp${{ matrix.python }}-${{ matrix.platform_id }}
158
+ CIBW_ARCHS : all
159
+ CIBW_MANYLINUX_X86_64_IMAGE : ${{ matrix.manylinux_image }}
160
+ CIBW_MANYLINUX_I686_IMAGE : ${{ matrix.manylinux_image }}
161
+ CIBW_BUILD_VERBOSITY : 1
162
+ CIBW_BEFORE_ALL : |
163
+ curl -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y && rustup target add i686-pc-windows-msvc
164
+ CIBW_ENVIRONMENT : ' PATH="$PATH:$HOME/.cargo/bin"'
46
165
run : |
47
166
python --version
48
167
python -m cibuildwheel --output-dir dist
49
- env :
50
- CIBW_BEFORE_ALL : |
51
- curl -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y && rustup target add i686-pc-windows-msvc
52
- CIBW_ENVIRONMENT : ' PATH="$PATH:$HOME/.cargo/bin"'
53
168
54
- - uses : actions/upload-artifact@v2
169
+ - name : Store artifacts
170
+ uses : actions/upload-artifact@v2
55
171
with :
56
172
name : wheels
57
173
path : ./dist
58
174
175
+ test-package :
176
+ name : Test built package
177
+ needs : [ build-wheels, build-sdist ]
178
+ runs-on : ubuntu-latest
179
+ timeout-minutes : 30
180
+ strategy :
181
+ fail-fast : false
182
+ matrix :
183
+ python-version : ['3.7', '3.8', '3.9', '3.10']
184
+
185
+ steps :
186
+ - uses : actions-rs/toolchain@v1
187
+ with :
188
+ toolchain : stable
189
+
190
+ - name : Set up Python ${{ matrix.python-version }}
191
+ uses : actions/setup-python@v2
192
+ with :
193
+ python-version : ${{ matrix.python-version }}
194
+
195
+ - name : Download the wheels
196
+ uses : actions/download-artifact@v2
197
+ with :
198
+ name : wheels
199
+ path : dist/
200
+
201
+ - name : Install from package wheels and test
202
+ run : |
203
+ python -m venv testwhl
204
+ source testwhl/bin/activate
205
+ python -m pip install -U pip
206
+ python -m pip install -U pytest pydicom pylibjpeg
207
+ python -m pip uninstall -y pylibjpeg-rle
208
+ python -m pip install git+https://github.com/pydicom/pylibjpeg-data
209
+ python -m pip install -U --find-links dist/ pylibjpeg-rle
210
+ python -c "import pytest; pytest.main(['--pyargs', 'rle.tests'])"
211
+ deactivate
212
+
213
+ - name : Install from package tarball and test
214
+ run : |
215
+ python -m venv testsrc
216
+ source testsrc/bin/activate
217
+ python -m pip install -U pip
218
+ python -m pip install -U pytest pydicom pylibjpeg
219
+ python -m pip uninstall -y pylibjpeg-rle
220
+ python -m pip install git+https://github.com/pydicom/pylibjpeg-data
221
+ export PATH="$PATH:$HOME/.cargo/bin"
222
+ python -m pip install -U dist/pylibjpeg-rle-*.tar.gz
223
+ python -c "import pytest; pytest.main(['--pyargs', 'rle.tests'])"
224
+ deactivate
225
+
59
226
# The pypi upload fails with non-linux containers, so grab the uploaded
60
227
# artifacts and run using those
61
228
# See: https://github.com/pypa/gh-action-pypi-publish/discussions/15
62
229
deploy :
63
230
name : Upload wheels to PyPI
64
- needs :
65
- - build_wheels
231
+ needs : [ test-package ]
66
232
runs-on : ubuntu-latest
67
233
68
234
steps :
@@ -72,13 +238,6 @@ jobs:
72
238
name : wheels
73
239
path : dist/
74
240
75
- # - name: Publish package to Test PyPi
76
- # uses: pypa/gh-action-pypi-publish@master
77
- # with:
78
- # user: __token__
79
- # password: ${{ secrets.TEST_PYPI_PASSWORD }}
80
- # repository_url: https://test.pypi.org/legacy/
81
-
82
241
- name : Publish package to PyPi
83
242
uses : pypa/gh-action-pypi-publish@master
84
243
with :
0 commit comments