ci: attempt to make the qt6 docker run work

On CI were were getting "Could not import sip" because link_pyqt was
looking for PyQt5.sip.
I made that look at QUTE_QT_WRAPPER since that's being set already on
tox.ini
There are probably a few other changes around link_pyqt and the makefile
etc we need to change when we switch the default wrapper.

I overrode the default `py` tox environment with py-qt6 to override
those wrapper related variables. I probably could have done something
sneaky with curly braces to make it so we don't have to add a few more
lines to the file. But in my opinion in config file is far to obfuscated
and hard to maintain already.

I changed the docker file to call the new py-qt6 env if it's a qt6
container. I'm not 100% sure that is required though since there is also
a tox invocation in the GH action definition, maybe that overrides the
container entrypoint? Also changed the indentation in the dockerfile
template a bit to make it easier to see where the conditionals start and
end.

Speaking of which I changed the matrix definition and tox invocation to
match a later one to hopefully make it so we can invoke different tox
environments in the containers without having to rebuild the containers.
Not sure I did that right, I'll see soon.

I added the unstable-qt6 container generation line so we can use it in
the future, and to match the not-qt6 one. I'm not switching to that in
CI though because the pyqt used by that is broken at the moment
(ref https://www.riverbankcomputing.com/pipermail/pyqt/2023-March/045214.html)

Also fixed the vim modeline in generate.py so my syntax highlighting
works.
This commit is contained in:
toofar 2023-03-18 15:20:19 +13:00
parent 151d808940
commit f68798a081
5 changed files with 37 additions and 24 deletions

View File

@ -89,12 +89,18 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
image: include:
- archlinux-webkit - testenv: py
- archlinux-webengine image: archlinux-webkit
- archlinux-webengine-qt6 - testenv: py
- archlinux-webengine-unstable image: archlinux-webengine
# - archlinux-webengine-unstable-qt6 # FIXME:qt6.5 activate - testenv: py-qt6
image: archlinux-webengine-qt6
- testenv: py
image: archlinux-webengine-unstable
args: ""
# - testenv: py
# image: archlinux-webengine-unstable-qt6 # FIXME:qt6.5 activate
container: container:
image: "qutebrowser/ci:${{ matrix.image }}" image: "qutebrowser/ci:${{ matrix.image }}"
env: env:
@ -112,7 +118,7 @@ jobs:
- name: Set up problem matchers - name: Set up problem matchers
run: "python scripts/dev/ci/problemmatchers.py py38 ${{ runner.temp }}" run: "python scripts/dev/ci/problemmatchers.py py38 ${{ runner.temp }}"
- name: Run tox - name: Run tox
run: dbus-run-session tox -e py run: "dbus-run-session -- tox -e ${{ matrix.testenv }} -- ${{ matrix.args }}"
tests: tests:
if: "!contains(github.event.head_commit.message, '[ci skip]')" if: "!contains(github.event.head_commit.message, '[ci skip]')"

View File

@ -10,19 +10,19 @@ RUN pacman -Su --noconfirm \
python-tox \ python-tox \
python-distlib \ python-distlib \
{% if qt6 %} {% if qt6 %}
qt6-base \ qt6-base \
qt6-declarative \ qt6-declarative \
{% if webengine %} {% if webengine %}
qt6-webengine python-pyqt6-webengine \ qt6-webengine python-pyqt6-webengine \
{% else %}{{ 1/0 }}{% endif %} {% else %}{{ 1/0 }}{% endif %}
python-pyqt6 \ python-pyqt6 \
{% else %} {% else %}
qt5-base \ qt5-base \
qt5-declarative \ qt5-declarative \
{% if webengine %} {% if webengine %}
qt5-webengine python-pyqtwebengine \ qt5-webengine python-pyqtwebengine \
{% endif %} {% endif %}
python-pyqt5 \ python-pyqt5 \
{% endif %} {% endif %}
xorg-xinit \ xorg-xinit \
xorg-server-xvfb \ xorg-server-xvfb \
@ -56,4 +56,4 @@ WORKDIR /home/user
CMD git clone /outside qutebrowser.git && \ CMD git clone /outside qutebrowser.git && \
cd qutebrowser.git && \ cd qutebrowser.git && \
tox -e py tox -e {% if qt6 %}py-qt6{% else %}py{% endif %}

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# vim: ft=sh fileencoding=utf-8 sts=4 sw=4 et: # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2019-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2019-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
@ -35,6 +35,7 @@ def main():
'archlinux-webengine': {'webengine': True, 'unstable': False, 'qt6': False}, 'archlinux-webengine': {'webengine': True, 'unstable': False, 'qt6': False},
'archlinux-webengine-qt6': {'webengine': True, 'unstable': False, 'qt6': True}, 'archlinux-webengine-qt6': {'webengine': True, 'unstable': False, 'qt6': True},
'archlinux-webengine-unstable': {'webengine': True, 'unstable': True, 'qt6': False}, 'archlinux-webengine-unstable': {'webengine': True, 'unstable': True, 'qt6': False},
'archlinux-webengine-unstable-qt6': {'webengine': True, 'unstable': True, 'qt6': True},
}[image] }[image]
with open('Dockerfile', 'w') as f: with open('Dockerfile', 'w') as f:

View File

@ -140,10 +140,10 @@ def link_pyqt(executable, venv_path, *, version='5'):
try: try:
get_lib_path(executable, f'PyQt{version}.sip') get_lib_path(executable, f'PyQt{version}.sip')
except Error: except Error:
# There is no PyQt5.sip, so we need to copy the toplevel sip. # There is no PyQt*.sip, so we need to copy the toplevel sip.
sip_file = get_lib_path(executable, 'sip') sip_file = get_lib_path(executable, 'sip')
else: else:
# There is a PyQt5.sip, it'll get copied with the PyQt5 dir. # There is a PyQt*.sip, it'll get copied with the PyQt* dir.
sip_file = None sip_file = None
sipconfig_file = get_lib_path(executable, 'sipconfig', required=False) sipconfig_file = get_lib_path(executable, 'sipconfig', required=False)
@ -218,7 +218,8 @@ def main():
executable = get_tox_syspython(args.path) if args.tox else sys.executable executable = get_tox_syspython(args.path) if args.tox else sys.executable
venv_path = get_venv_lib_path(args.path) venv_path = get_venv_lib_path(args.path)
link_pyqt(executable, venv_path) wrapper = os.environ["QUTE_QT_WRAPPER"]
link_pyqt(executable, venv_path, version=wrapper[-1])
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -53,6 +53,11 @@ commands =
{envpython} -bb -m pytest {posargs:tests} {envpython} -bb -m pytest {posargs:tests}
cov: {envpython} scripts/dev/check_coverage.py {posargs} cov: {envpython} scripts/dev/check_coverage.py {posargs}
[testenv:py-qt6]
setenv =
PYTEST_QT_API=pyqt6
QUTE_QT_WRAPPER=PyQt6
[testenv:bleeding] [testenv:bleeding]
basepython = {env:PYTHON:python3} basepython = {env:PYTHON:python3}
setenv = setenv =