Skip to content

Commit cdd5dc3

Browse files
jamesobutlerCopilot
andcommitted
CI: Update aqtinstall for Qt 6.11 support
Co-authored-by: Copilot <copilot@github.com>
1 parent 51a6376 commit cdd5dc3

2 files changed

Lines changed: 156 additions & 0 deletions

File tree

.github/workflows/build_cmake.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Build (CMake, Latest Qt)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
17+
jobs:
18+
build:
19+
name: "CMake | ${{ matrix.os }} | Qt ${{ matrix.qt-version }}"
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: ['ubuntu', 'windows']
24+
# Qt 5.12.* is excluded: CMakeLists.txt requires Qt >= 5.15.0.
25+
qt-version: [ '5.15.*', '6.10.*' ]
26+
python-version: [ '3.12' ]
27+
runs-on: ${{ matrix.os }}-latest
28+
steps:
29+
30+
- name: Install MSVC
31+
if: ${{ matrix.os == 'windows' }}
32+
uses: ilammy/msvc-dev-cmd@v1
33+
with:
34+
arch: amd64
35+
36+
- name: Install Qt ${{ matrix.qt-version }}
37+
uses: jurplel/install-qt-action@v4
38+
with:
39+
version: ${{ matrix.qt-version }}
40+
modules: ${{ startsWith(matrix.qt-version, '6') && 'qt5compat qtscxml qtpositioning qtwebchannel qtmultimedia qtwebengine' || '' }}
41+
arch: ${{ (matrix.os == 'ubuntu' && (startsWith(matrix.qt-version, '5') && 'gcc_64' || 'linux_gcc_64')) || startsWith(matrix.qt-version, '6') && 'win64_msvc2022_64' || 'win64_msvc2019_64' }}
42+
# aqtinstall 3.3.0 (latest release) lacks Qt 6.11 folder-structure support.
43+
# Use git 151f6f4 until aqtinstall 3.4.0 is released (miurahr/aqtinstall#1000).
44+
aqtsource: ${{ startsWith(matrix.qt-version, '6.11') && 'git+https://github.com/miurahr/aqtinstall.git@151f6f436c2f5a5ceb7890ad970ca6f3b4d83512' || '' }}
45+
46+
- name: Setup Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v6
48+
with:
49+
python-version: '${{ matrix.python-version }}'
50+
51+
- name: Checkout PythonQt
52+
uses: actions/checkout@v6
53+
54+
- name: Ccache
55+
if: ${{ matrix.os == 'ubuntu' }}
56+
uses: hendrikmuhs/ccache-action@v1.2.20
57+
with:
58+
key: ${{ runner.os }}-cmake-${{ matrix.qt-version }}
59+
evict-old-files: 'job'
60+
61+
- name: Set environment
62+
id: setenv
63+
run: |
64+
QT_VERSION_MAJOR=$(cut -f 1 -d . <<< "${{ matrix.qt-version }}")
65+
echo "QT_VERSION_MAJOR=$QT_VERSION_MAJOR" >> $GITHUB_ENV
66+
QT_VERSION_SHORT=$(cut -f 1,2 -d . <<< "${{ matrix.qt-version }}")
67+
echo "QT_VERSION_SHORT=$QT_VERSION_SHORT" >> $GITHUB_OUTPUT
68+
PYTHON_VERSION_FULL=$(python --version 2>&1 | cut -f 2 -d ' ')
69+
PYTHON_VERSION_SHORT=$(cut -f 1,2 -d . <<< $PYTHON_VERSION_FULL)
70+
echo "PYTHON_VERSION_SHORT=$PYTHON_VERSION_SHORT" >> $GITHUB_OUTPUT
71+
echo "$pythonLocation/bin" >> $GITHUB_PATH
72+
73+
- name: Build generator (Ubuntu)
74+
if: ${{ matrix.os == 'ubuntu' }}
75+
run: |
76+
cmake -G Ninja -S generator -B generator/build \
77+
-DCMAKE_BUILD_TYPE=Release \
78+
-DCMAKE_PREFIX_PATH="$QT_ROOT_DIR" \
79+
-DPythonQtGenerator_QT_VERSION=$QT_VERSION_MAJOR
80+
cmake --build generator/build
81+
82+
- name: Build generator (Windows)
83+
if: ${{ matrix.os == 'windows' }}
84+
shell: cmd
85+
run: |
86+
set QT_CMAKE_DIR=%QT_ROOT_DIR%\lib\cmake\Qt%QT_VERSION_MAJOR%
87+
cmake -G "Visual Studio 17 2022" -S generator -B generator\build ^
88+
"-DCMAKE_PREFIX_PATH=%QT_ROOT_DIR%;%QT_ROOT_DIR%\lib\cmake" ^
89+
"-DQt%QT_VERSION_MAJOR%_DIR=%QT_CMAKE_DIR%" ^
90+
-DPythonQtGenerator_QT_VERSION=%QT_VERSION_MAJOR% || exit /b 1
91+
cmake --build generator\build --config Release || exit /b 1
92+
93+
- name: Generate Wrappers (Ubuntu)
94+
if: ${{ matrix.os == 'ubuntu' }}
95+
run: |
96+
QTDIR="$QT_ROOT_DIR" \
97+
UBSAN_OPTIONS="halt_on_error=1" \
98+
ASAN_OPTIONS="detect_leaks=0:detect_stack_use_after_return=1:fast_unwind_on_malloc=0" \
99+
./generator/build/PythonQtGenerator \
100+
--output-directory=.
101+
102+
- name: Generate Wrappers (Windows)
103+
if: ${{ matrix.os == 'windows' }}
104+
shell: cmd
105+
run: |
106+
set QTDIR=%QT_ROOT_DIR%
107+
generator\build\Release\PythonQtGenerator.exe --output-directory=. || exit /b 1
108+
109+
- name: Upload Wrappers
110+
uses: actions/upload-artifact@v7
111+
with:
112+
name: cmake_wrappers_${{ matrix.os }}_${{ steps.setenv.outputs.QT_VERSION_SHORT }}
113+
path: generated_cpp
114+
if-no-files-found: error
115+
116+
- name: Build and test PythonQt (Ubuntu)
117+
if: ${{ matrix.os == 'ubuntu' }}
118+
run: |
119+
cmake -G Ninja -S . -B build \
120+
-DCMAKE_BUILD_TYPE=Release \
121+
-DCMAKE_PREFIX_PATH="$QT_ROOT_DIR" \
122+
-DPythonQt_QT_VERSION=$QT_VERSION_MAJOR \
123+
"-DPythonQt_GENERATED_PATH=$(pwd)/generated_cpp" \
124+
-DPythonQt_Wrap_QtCore=ON \
125+
-DBUILD_TESTING=ON \
126+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
127+
"-DCMAKE_CXX_FLAGS=-fsanitize=address,undefined -fno-sanitize-recover=undefined" \
128+
"-DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address,undefined" \
129+
"-DCMAKE_SHARED_LINKER_FLAGS=-fsanitize=address,undefined"
130+
cmake --build build --parallel $(nproc)
131+
PYTHONDEVMODE=1 PYTHONASYNCIODEBUG=1 PYTHONWARNINGS=error PYTHONMALLOC=malloc_debug \
132+
UBSAN_OPTIONS="halt_on_error=1" ASAN_OPTIONS="detect_leaks=0:detect_stack_use_after_return=1:fast_unwind_on_malloc=0" \
133+
QT_QPA_PLATFORM=offscreen \
134+
ctest --test-dir build --output-on-failure
135+
136+
- name: Build and test PythonQt (Windows)
137+
if: ${{ matrix.os == 'windows' }}
138+
shell: cmd
139+
run: |
140+
set QT_CMAKE_DIR=%QT_ROOT_DIR%\lib\cmake\Qt%QT_VERSION_MAJOR%
141+
cmake -G "Visual Studio 17 2022" -S . -B build ^
142+
"-DCMAKE_PREFIX_PATH=%QT_ROOT_DIR%;%QT_ROOT_DIR%\lib\cmake" ^
143+
"-DQt%QT_VERSION_MAJOR%_DIR=%QT_CMAKE_DIR%" ^
144+
-DPythonQt_QT_VERSION=%QT_VERSION_MAJOR% ^
145+
"-DPythonQt_GENERATED_PATH=%CD%\generated_cpp" ^
146+
-DPythonQt_Wrap_QtCore=ON ^
147+
-DBUILD_TESTING=ON || exit /b 1
148+
cmake --build build --config Release || exit /b 1
149+
set PYTHONDEVMODE=1
150+
set PYTHONASYNCIODEBUG=1
151+
set PYTHONWARNINGS=error
152+
set QT_QPA_PLATFORM=offscreen
153+
ctest --test-dir build --output-on-failure -C Release || exit /b 1

.github/workflows/build_latest.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
version: ${{ matrix.qt-version }}
3838
modules: ${{startsWith(matrix.qt-version, '6') && 'qt5compat qtscxml qtpositioning qtwebchannel qtmultimedia qtwebengine' || '' }}
3939
arch: ${{ (matrix.os == 'ubuntu' && (startsWith(matrix.qt-version, '5') && 'gcc_64' || 'linux_gcc_64')) || startsWith(matrix.qt-version, '5.12') && 'win64_msvc2017_64' || startsWith(matrix.qt-version, '6') && 'win64_msvc2022_64' || 'win64_msvc2019_64' }}
40+
# aqtinstall 3.3.0 (latest release) lacks Qt 6.11 folder-structure support.
41+
# Use git 151f6f4 until aqtinstall 3.4.0 is released (miurahr/aqtinstall#1000).
42+
aqtsource: ${{ startsWith(matrix.qt-version, '6.11') && 'git+https://github.com/miurahr/aqtinstall.git@151f6f436c2f5a5ceb7890ad970ca6f3b4d83512' || '' }}
4043

4144
- name: Setup Python ${{ matrix.python-version }}
4245
uses: actions/setup-python@v6

0 commit comments

Comments
 (0)