forked from cniemira/pyside6_qtads
-
Notifications
You must be signed in to change notification settings - Fork 14
243 lines (239 loc) · 9.95 KB
/
Copy pathmain.yml
File metadata and controls
243 lines (239 loc) · 9.95 KB
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
on: [push, pull_request]
jobs:
build_src:
name: Build sdist
runs-on: ubuntu-latest
outputs:
rel0: ${{ steps.query.outputs.rel0 }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
with:
submodules: recursive
- name: Query PyPI for recent PySide release number
id: query
run: |
echo "rel0=$(curl -s https://pypi.org/pypi/PySide6/json | jq -r .info.version)" >> $GITHUB_OUTPUT
- name: Build sdist
env:
PYSIDE6_QTADS_NO_HARD_PYSIDE_REQUIREMENT: 1
run: |
python -m pip install --user build
python -m build --sdist
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v4
with:
name: source
path: dist/*.tar.gz
# FIXME: Automate minimum Python, manylinux, and custom auditwheel lib filter
build_wheels:
needs: build_src
name: Build wheel ${{ matrix.wheel }} for PySide ${{ matrix.pyside_ver }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
pyside_ver: ${{ needs.build_src.outputs.rel0 }}
wheel: cp310-win_amd64
arch: x86_64
- os: windows-11-arm
pyside_ver: ${{ needs.build_src.outputs.rel0 }}
wheel: cp310-win_arm64
arch: arm64
- os: ubuntu-latest
pyside_ver: ${{ needs.build_src.outputs.rel0 }}
wheel: cp310-manylinux_x86_64
arch: x86_64
- os: macos-15-intel
pyside_ver: ${{ needs.build_src.outputs.rel0 }}
wheel: cp310-macosx_x86_64
arch: x86_64
- os: macos-latest
pyside_ver: ${{ needs.build_src.outputs.rel0 }}
wheel: cp310-macosx_arm64
arch: arm64
steps:
- name: Download sdist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
with:
name: source
- name: Unpack sdist
shell: bash
run: tar --strip-components 1 -xvf *.tar.gz
- name: Setup Qt vars
shell: bash
run: |
QT_VERSION=$(echo ${{ matrix.pyside_ver }} | cut -d. -f-3)
if [[ "$RUNNER_OS" == "Windows" ]]; then
QT_BASE_DIR=${GITHUB_WORKSPACE}\\Qt
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
QT6_DIR=$QT_BASE_DIR\\$QT_VERSION\\msvc2022_arm64
QT_PLATFORM=windows_arm64
QT_ARCH=win64_msvc2022_arm64
else
QT6_DIR=$QT_BASE_DIR\\$QT_VERSION\\msvc2022_64
QT_PLATFORM=windows
QT_ARCH=win64_msvc2022_64
fi
echo "QT_PLATFORM=$QT_PLATFORM" >> $GITHUB_ENV
echo "QT_ARCH=$QT_ARCH" >> $GITHUB_ENV
echo "CC=cl.exe" >> $GITHUB_ENV
echo "CXX=cl.exe" >> $GITHUB_ENV
elif [[ "$RUNNER_OS" == "macOS" ]]; then
QT_BASE_DIR=${GITHUB_WORKSPACE}/Qt
QT6_DIR=$QT_BASE_DIR/$QT_VERSION/macos
elif [[ "$RUNNER_OS" == "Linux" ]]; then
QT_BASE_DIR=${GITHUB_WORKSPACE}/Qt
QT6_DIR=$QT_BASE_DIR/$QT_VERSION/gcc_64
else
echo "Unsupported runner OS $RUNNER_OS"
exit 1
fi
echo "QT_VERSION=$QT_VERSION" >> $GITHUB_ENV
echo "QT_BASE_DIR=$QT_BASE_DIR" >> $GITHUB_ENV
echo "QT6_DIR=$QT6_DIR" >> $GITHUB_ENV
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
if: runner.os == 'Windows'
with:
arch: ${{ matrix.arch }}
# XXX: Install headers compatible with shiboken's older libclang
# C:\llvm\lib\clang\20\include\arm_vector_types.h:20:9: error: unknown type name '__mfp8'
- name: Install LLVM and Clang
if: matrix.os == 'windows-11-arm'
uses: KyleMayes/install-llvm-action@ebc0426251bc40c7cd31162802432c68818ab8f0 # v2
with:
version: "19"
directory: "C:\\llvm"
- name: Build wheels
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
with:
output-dir: wheelhouse
env:
CIBW_ENVIRONMENT_LINUX: >
CMAKE_PREFIX_PATH=${{ env.QT6_DIR }}/lib/cmake
LD_LIBRARY_PATH=${{ env.QT6_DIR }}/lib
VERBOSE=1
CIBW_ENVIRONMENT_MACOS: >
MACOSX_DEPLOYMENT_TARGET=13.0
CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
CMAKE_PREFIX_PATH=${QT6_DIR}/lib/cmake
VERBOSE=1
CIBW_ENVIRONMENT_WINDOWS: >
CLANG_INSTALL_DIR="${LLVM_PATH}"
CMAKE_PREFIX_PATH="${QT6_DIR}\\lib\\cmake"
VERBOSE=1
CIBW_BEFORE_BUILD_LINUX: >
yum install -y mesa-libGL libxslt llvm clang clang-devel libxkbcommon-devel
&& python3 -m pip install --user "aqtinstall!=3.2.1" auditwheel
&& python3 -m aqt install-qt linux desktop ${{ env.QT_VERSION }} --outputdir ${{ env.QT_BASE_DIR }} --base http://mirrors.ocf.berkeley.edu/qt/
&& python3 ./scripts/set-qt-constraint.py ${{ matrix.pyside_ver }}
CIBW_BEFORE_BUILD_MACOS: >
python3 -m pip install "aqtinstall!=3.2.1"
&& python3 -m aqt install-qt mac desktop ${{ env.QT_VERSION }} --outputdir ${{ env.QT_BASE_DIR }} --base http://mirrors.ocf.berkeley.edu/qt/
&& python3 ./scripts/set-qt-constraint.py ${{ matrix.pyside_ver }}
# Installing aqtinstall from Git for https://github.com/miurahr/aqtinstall/pull/1000
CIBW_BEFORE_BUILD_WINDOWS: >
python3 -m pip install git+https://github.com/miurahr/aqtinstall.git
&& python3 -m aqt install-qt ${{ env.QT_PLATFORM }} desktop ${{ env.QT_VERSION }} ${{ env.QT_ARCH }} --outputdir ${{ env.QT_BASE_DIR }} --base http://mirrors.ocf.berkeley.edu/qt/
&& python3 ./scripts/set-qt-constraint.py ${{ matrix.pyside_ver }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_34
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: ${{ matrix.wheel }}
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
python ./scripts/custom-auditwheel.py repair -w {dest_dir} --only-plat --plat manylinux_2_34_x86_64 {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS:
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS:
CIBW_TEST_COMMAND: python -m unittest discover -v -s {package}/tests
CIBW_TEST_COMMAND_LINUX: QT_QPA_PLATFORM=minimal:enable_fonts python -m unittest discover -v -s {package}/tests
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v4
with:
name: wheel-${{ matrix.wheel }}
path: ./wheelhouse/*.whl
build_aarch64_wheel:
name: Build wheel ${{ matrix.wheel }} for PySide ${{ matrix.pyside_ver }} on ${{ matrix.os }}
needs: build_src
strategy:
matrix:
include:
- os: ubuntu-24.04-arm
pyside_ver: ${{ needs.build_src.outputs.rel0 }}
wheel: cp310-manylinux_aarch64
arch: aarch64
runs-on: ${{ matrix.os }}
steps:
- name: Download sdist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
with:
name: source
- name: Unpack sdist
shell: bash
run: tar --strip-components 1 -xvf *.tar.gz
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libgl1-mesa-dev \
libxslt1-dev git \
libglib2.0-dev \
patchelf \
python-is-python3 \
python3 \
python3-venv \
python3-pip \
libxkbcommon-dev
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v6
with:
python-version: "3.10"
activate-environment: true
- name: Install Python dependencies
run: uv pip install "aqtinstall!=3.2.1" PySide6 auditwheel
- name: Setup Qt vars
shell: bash
run: echo QT_VERSION=$(echo ${{ matrix.pyside_ver }} | cut -d. -f-3) >> $GITHUB_ENV
- name: Install Qt
run: aqt install-qt linux_arm64 desktop ${{ env.QT_VERSION }} --outputdir qt
- name: Build
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/qt/${{ env.QT_VERSION }}/gcc_arm64/lib
CMAKE_PREFIX_PATH: ${{ github.workspace }}/qt/${{ env.QT_VERSION }}/gcc_arm64/lib/cmake
run: uv build --verbose --wheel .
- name: Fixup wheel
env:
LD_LIBRARY_PATH: ${{ env.VIRTUAL_ENV }}/lib/python3.12/site-packages/PySide6/
run: |
mkdir dist-repaired
python ./scripts/custom-auditwheel.py repair -w dist-repaired --only-plat --plat manylinux_2_39_aarch64 ./dist/pyside6_qtads-*.whl
- name: Test wheel
run: |
uv pip install ./dist-repaired/*.whl
cd tests
python -m unittest discover
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v4
with:
name: wheel-${{ matrix.wheel }}
path: ./dist-repaired/*.whl
upload_pypi:
needs: [build_wheels, build_aarch64_wheel, build_src]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
with:
name: source
path: dist
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
with:
pattern: wheel-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}