Skip to content

Commit

Permalink
CI: Add workflow to run tests with PyQt6/PySide6
Browse files Browse the repository at this point in the history
For now the tests run on Linux only. Only pip-based installation is used
as conda has no PyQt6 package yet. The workflow file based on the
existing one for Linux.
  • Loading branch information
rear1019 committed Nov 29, 2024
1 parent 58ab1c8 commit 1e73d3c
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ fi

# Install dependencies
if [ "$USE_CONDA" = "true" ]; then
if [ -n "$QT6_BINDINGS" ]; then
echo "Cannot use Qt 6 with Conda" 1>&2
exit 1
fi

# Install dependencies per operating system
if [ "$OS" = "win" ]; then
Expand Down Expand Up @@ -70,6 +74,14 @@ else
pip install jedi==0.19.1
fi

if [ "$QT6_BINDINGS" = "pyqt6" ]; then
pip install pyqt6 pyqt6-webengine
elif [ "$QT6_BINDINGS" = "pyside6" ]; then
pip install pyside6
elif [ -n "$QT6_BINDINGS" ]; then
echo "Invalid Qt 6 bindings: $QT6_BINDINGS" 1>&2
exit 1
fi
fi

# Install subrepos from source
Expand Down
160 changes: 160 additions & 0 deletions .github/workflows/test-linux-qt6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: Linux tests with PyQt6/PySide6

on:
push:
branches:
- master
- pyqt6_ci # for testing only
paths:
- '.github/scripts/*.sh'
- '.github/workflows/*.yml'
- 'requirements/*.yml'
- 'MANIFEST.in'
- '**.bat'
- '**.py'
- '**.sh'
- '!installers-conda/**'
- '!.github/workflows/installers-conda.yml'
- '!.github/workflows/build-subrepos.yml'
- '!.github/workflows/purge-cache.yml'
- '!.github/scripts/installer_test.sh'

workflow_call:

workflow_dispatch:
inputs:
ssh:
# github_cli: gh workflow run test-linux.yml --ref <branch> -f ssh=true
description: 'Enable ssh debugging'
required: false
default: false
type: boolean

concurrency:
group: test-linux-${{ github.ref }}
cancel-in-progress: true

env:
ENABLE_SSH: ${{ github.event_name == 'workflow_dispatch' && inputs.ssh }}

jobs:
build:
# Use this to disable the workflow
# if: false
name: Linux - Py${{ matrix.PYTHON_VERSION }}, ${{ matrix.QT6_BINDINGS }}, ${{ matrix.INSTALL_TYPE }}, ${{ matrix.TEST_TYPE }}
runs-on: ubuntu-20.04
env:
CI: 'true'
QTCONSOLE_TESTING: 'true'
CODECOV_TOKEN: "56731c25-9b1f-4340-8b58-35739bfbc52d"
OS: 'linux'
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
RUN_SLOW: ${{ matrix.TEST_TYPE == 'slow' }}
USE_CONDA: ${{ matrix.INSTALL_TYPE == 'conda' }}
USE_GDB: 'false'
QT6_BINDINGS: ${{ matrix.QT6_BINDINGS }}
strategy:
fail-fast: false
matrix:
INSTALL_TYPE: ['pip'] # conda has no PyQt6 package
PYTHON_VERSION: ['3.10']
TEST_TYPE: ['fast', 'slow']
QT6_BINDINGS: ['pyqt6', 'pyside6']
timeout-minutes: 90
steps:
- name: Setup Remote SSH Connection
if: env.ENABLE_SSH == 'true'
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60
with:
detached: true
- name: Checkout Pull Requests
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout Push
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
- name: Fetch branches
run: git fetch --prune --unshallow
- name: Install dependencies
shell: bash
run: |
sudo apt-get update --fix-missing
sudo apt-get install -qq pyqt5-dev-tools libxcb-xinerama0 libxcb-cursor0 xterm --fix-missing
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if requirements/*.txt has not changed
CACHE_NUMBER: 1
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-cacheconda-install${{ matrix.INSTALL_TYPE }}-${{ matrix.PYTHON_VERSION }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('requirements/*.yml') }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-cachepip-install${{ matrix.INSTALL_TYPE }}-${{ env.CACHE_NUMBER }}-${{ hashFiles('setup.py') }}
- name: Create conda test environment
if: env.USE_CONDA == 'true'
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.10-0'
environment-file: requirements/main.yml
environment-name: test
cache-downloads: true
create-args: python=${{ matrix.PYTHON_VERSION }}
- name: Create pip test environment
if: env.USE_CONDA != 'true'
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.10-0'
environment-name: test
cache-downloads: true
create-args: python=${{ matrix.PYTHON_VERSION }}
condarc: |
channels:
- conda-forge
- name: Install additional dependencies
shell: bash -l {0}
run: bash -l .github/scripts/install.sh
- name: Show conda test environment
if: env.USE_CONDA == 'true'
shell: bash -l {0}
run: |
micromamba info
micromamba list
- name: Show pip test environment
if: env.USE_CONDA != 'true'
shell: bash -l {0}
run: |
micromamba info
micromamba list
pip list
- name: Run manifest checks
shell: bash -l {0}
run: check-manifest
- name: Run tests with gdb
if: env.USE_GDB == 'true'
shell: bash -l {0}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: xvfb-run --auto-servernum gdb -return-child-result -batch -ex r -ex py-bt --args python runtests.py -s
- name: Run tests
shell: bash -l {0}
env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
QT_API: ${{ matrix.QT6_BINDINGS }}
PYTEST_QT_API: ${{ matrix.QT6_BINDINGS }}
run: |
rm -f pytest_log.txt # Must remove any log file from a previous run
# .github/scripts/run_tests.sh || \
# .github/scripts/run_tests.sh || \
# .github/scripts/run_tests.sh || \
.github/scripts/run_tests.sh
- name: Coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true

0 comments on commit 1e73d3c

Please sign in to comment.