forked from mborgerson/pyside6_qtads
-
Notifications
You must be signed in to change notification settings - Fork 1
158 lines (155 loc) · 6.19 KB
/
main.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
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@v4
with:
submodules: recursive
- name: Query PyPI for recent PySide release number
id: query
run: python ./scripts/get-recent-releases.py 3 >> $GITHUB_OUTPUT
- name: Build sdist
env:
PIP_EXTRA_INDEX_URL: https://download.qt.io/official_releases/QtForPython/
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@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: cp38-win_amd64
arch: x86_64
- os: ubuntu-latest
pyside_ver: ${{ needs.build_src.outputs.rel0 }}
wheel: cp38-manylinux_x86_64
arch: x86_64
- os: macos-latest
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@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
QT6_DIR=$QT_BASE_DIR\\$QT_VERSION\\msvc2019_64
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@v1
if: runner.os == 'Windows'
- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
env:
CIBW_ENVIRONMENT_LINUX: >
CMAKE_PREFIX_PATH=${{ env.QT6_DIR }}/lib/cmake
LD_LIBRARY_PATH=${{ env.QT6_DIR }}/lib
PIP_EXTRA_INDEX_URL=https://download.qt.io/official_releases/QtForPython/
VERBOSE=1
CIBW_ENVIRONMENT_MACOS: >
MACOSX_DEPLOYMENT_TARGET=11.0
CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
CMAKE_PREFIX_PATH=${QT6_DIR}/lib/cmake
PIP_EXTRA_INDEX_URL=https://download.qt.io/official_releases/QtForPython/
VERBOSE=1
CIBW_ENVIRONMENT_WINDOWS: >
CMAKE_PREFIX_PATH="${QT6_DIR}\\lib\\cmake"
PIP_EXTRA_INDEX_URL=https://download.qt.io/official_releases/QtForPython/
VERBOSE=1
CIBW_BEFORE_BUILD_LINUX: >
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
&& dnf install -y mesa-libGL libxslt llvm clang-libs
&& python3 -m pip install --user aqtinstall 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
&& 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 }}
CIBW_BEFORE_BUILD_WINDOWS: >
python3 -m pip install aqtinstall
&& python3 -m aqt install-qt windows desktop ${{ env.QT_VERSION }} win64_msvc2019_64 --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_28
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_28_x86_64 {wheel}
CIBW_REPAIR_WHEEL_COMMAND_MACOS:
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS:
# - name: Rename wheel to include Qt version
# run: |
# pushd wheelhouse
# for i in *.whl; do
# pkgname=$(echo $i | cut -d- -f1-2)
# pkginfo=$(echo $i | cut -d- -f3-)
# mv $i ${pkgname}-${{ matrix.pyside_ver }}-${pkginfo}
# done
# popd
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl
upload_pypi:
needs: [build_wheels, 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@v4
with:
name: source
path: dist
- uses: actions/download-artifact@v4
with:
name: wheels
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}