-
Notifications
You must be signed in to change notification settings - Fork 74
226 lines (212 loc) · 7.1 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: Build and deploy
on:
workflow_dispatch:
release:
types:
- published
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build sdist
run: python -m build --sdist
- name: Check the package
run: python -m twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
test_sdist:
needs: [build_sdist]
name: Test source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- uses: actions/download-artifact@v4
with:
name: cibw-sdist
path: dist
- name: Install from sdist
run: pip install "$(ls dist/silx-*.tar.gz)[full,test]"
- name: Run tests
env:
WITH_QT_TEST: "False"
WITH_GL_TEST: "False"
SILX_OPENCL: "False"
SILX_TEST_LOW_MEM: "False"
run: python -c "import silx.test, sys; sys.exit(silx.test.run_tests(verbosity=3))"
build_doc:
name: Build documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install pandoc&graphviz
run: sudo apt-get install pandoc graphviz
- name: Install silx
run: pip install .[full,test,doc]
- name: Build doc
env:
QT_QPA_PLATFORM: "offscreen"
run: |
export SILX_VERSION="$(python -c 'import silx; print(silx.strictversion)')"
sphinx-build doc/source/ "silx-${SILX_VERSION}_documentation/"
zip -r "silx-${SILX_VERSION}_documentation.zip" "silx-${SILX_VERSION}_documentation/"
- uses: actions/upload-artifact@v4
with:
name: documentation
path: silx-*_documentation.zip
build_windows_installer:
name: Build Windows "fat binary"
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install silx
run: pip install .[full,test]
- name: Install pyinstaller
# Install pyinstaller from source and compile bootloader
env:
PYINSTALLER_COMPILE_BOOTLOADER: "1"
PYINSTALLER_BOOTLOADER_WAF_ARGS: "--msvc_target=x64"
run: pip install pyinstaller --no-binary pyinstaller
- name: Build fat binary
run: |
cd package/windows
pyinstaller pyinstaller.spec
- uses: actions/upload-artifact@v4
with:
name: windows-installer
path: |
./package/windows/artifacts/silx-*.exe
./package/windows/artifacts/silx-*.zip
test_windows_installer:
needs: [build_windows_installer]
name: Test Windows "fat binary"
runs-on: windows-2022
steps:
- uses: actions/download-artifact@v4
with:
name: windows-installer
- name: Unzip "fat binary"
run: 7z x silx-*.zip
- name: Test
run: |
cd silx
./silx-view.exe --help
./silx.exe --help
build_wheels:
name: Build wheels on ${{ matrix.os }}-${{ matrix.cibw_archs }}
runs-on: ${{ matrix.os }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
cibw_archs: "auto64"
with_sse2: true
- os: ubuntu-20.04
cibw_archs: "aarch64"
with_sse2: false
- os: ubuntu-20.04
cibw_archs: "ppc64le"
with_sse2: false
- os: windows-2019
cibw_archs: "auto64"
with_sse2: true
- os: macos-11
cibw_archs: "universal2"
with_sse2: true
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
if: runner.os == 'Linux'
with:
platforms: all
- uses: pypa/[email protected]
env:
# Configure silx build
SILX_FORCE_CYTHON: "True"
SILX_WITH_OPENMP: "False"
# Configure silx tests
WITH_QT_TEST: "False"
WITH_GL_TEST: "False"
SILX_OPENCL: "False"
SILX_TEST_LOW_MEM: "False"
CIBW_ENVIRONMENT_PASS_LINUX: SILX_FORCE_CYTHON SILX_WITH_OPENMP WITH_QT_TEST WITH_GL_TEST SILX_OPENCL SILX_TEST_LOW_MEM
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
# Do not build for pypy and muslinux
CIBW_SKIP: pp* *-musllinux_*
CIBW_ARCHS: ${{ matrix.cibw_archs }}
# Install test dependencies
CIBW_TEST_EXTRAS: "full,test"
CIBW_TEST_COMMAND: python -c "import silx.test, sys; sys.exit(silx.test.run_tests(verbosity=3))"
# Skip tests for emulated architectures and arm64 macos
# Skip cp38 test on macos: Issue with libOpenGL
# Skip cp311 and cp312 on macos: bitshuffle does not build there
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *-macosx_arm64 *-macosx_universal2:arm64 cp38-macosx* cp311-macosx* cp312-macosx*"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
pypi-publish:
needs: [build_doc, build_sdist, build_wheels, test_sdist, build_windows_installer, test_windows_installer]
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
windows-installer-publish:
needs: [build_windows_installer, test_windows_installer]
name: Upload Windows installer
runs-on: ubuntu-latest
environment:
name: assets
permissions:
contents: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: windows-installer
- name: Upload release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export ASSETS=$(ls silx-*.exe silx-*.zip)
echo "ASSETS=${ASSETS}"
gh release upload ${{ github.event.release.tag_name }} ${ASSETS}