1- name : Build wheels and deploy to PyPI
1+ name : release- deploy
22
33on :
44 release :
55 types : [ published ]
66
77jobs :
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 }}
1041 runs-on : ${{ matrix.os }}
11- env :
12- CIBW_SKIP : " cp36-* *-musl*"
1342 strategy :
1443 fail-fast : false
1544 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
18134
19135 steps :
20136 - uses : actions/checkout@v2
21137 with :
22138 submodules : true
23139
24- # Install rust
25140 - uses : actions-rs/toolchain@v1
26141 with :
27142 toolchain : stable
28143
29- # Install Python
30144 - uses : actions/setup-python@v2
31145 name : Install Python
32146 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'
40148
41- - name : Build sdist
149+ - name : Install cibuildwheel
42150 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
44154
45155 - 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"'
46165 run : |
47166 python --version
48167 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"'
53168
54- - uses : actions/upload-artifact@v2
169+ - name : Store artifacts
170+ uses : actions/upload-artifact@v2
55171 with :
56172 name : wheels
57173 path : ./dist
58174
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+
59226 # The pypi upload fails with non-linux containers, so grab the uploaded
60227 # artifacts and run using those
61228 # See: https://github.com/pypa/gh-action-pypi-publish/discussions/15
62229 deploy :
63230 name : Upload wheels to PyPI
64- needs :
65- - build_wheels
231+ needs : [ test-package ]
66232 runs-on : ubuntu-latest
67233
68234 steps :
@@ -72,13 +238,6 @@ jobs:
72238 name : wheels
73239 path : dist/
74240
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-
82241 - name : Publish package to PyPi
83242 uses : pypa/gh-action-pypi-publish@master
84243 with :
0 commit comments