Skip to content

Commit

Permalink
Fix CI (#1036)
Browse files Browse the repository at this point in the history
This gets a reasonable baseline CI working for Kiva and Enable.  It covers Python 3.8 and 3.10 with a reasonable set of Kiva backends and ETS toolkits.  It splits out the Linux Qt dependency installation into a separate action as is done in other ETS projects so it can be re-used across workflows.

There are a number of test cases skipped:

- WxPython on MacOS and Linux due to lack of appropriate wheels
- PyQt5 on Python 3.10 due to #1037
- PyQt5 on Windows due to #1038

This also adds a skip to a Cairo backend test case due to #1035 and a couple of drive-by fixes to the Cairo Kiva backend (Cairo was previously not being tested).
  • Loading branch information
corranwebster authored Apr 18, 2023
1 parent 5088b72 commit 1565976
Show file tree
Hide file tree
Showing 9 changed files with 257 additions and 79 deletions.
27 changes: 27 additions & 0 deletions .github/actions/install-qt-support/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Install Qt dependencies

This action calls `apt-get` to install packages required for running Qt on Ubuntu.

## Inputs

There are no inputs.

## Outputs

There are no outputs.

## Example usage

```yml

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Qt dependencies
uses: ./.github/actions/install-qt-support
```
30 changes: 30 additions & 0 deletions .github/actions/install-qt-support/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: install-qt-support
description: 'Install supporting OS packages for Qt-using code'
runs:
using: composite
steps:
- name: Install Linux packages for Qt
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev
sudo apt-get install qtchooser
sudo apt-get install qt5-qmake
sudo apt-get install qtbase5-dev-tools
sudo apt-get install libegl1
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install libxcb-icccm4
sudo apt-get install libxcb-image0
sudo apt-get install libxcb-keysyms1
sudo apt-get install libxcb-randr0
sudo apt-get install libxcb-render-util0
sudo apt-get install libxcb-xinerama0
sudo apt-get install libxcb-shape0
sudo apt-get install libxcb-cursor0
sudo apt-get install pulseaudio
sudo apt-get install libpulse-mainloop-glib0
# Needed to work around https://bugreports.qt.io/browse/PYSIDE-1547
sudo apt-get install libopengl0
# Needed for Qt6 video playback
sudo apt-get install libgstreamer-gl1.0-0
shell: bash
90 changes: 51 additions & 39 deletions .github/workflows/bleeding-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ jobs:
test-ets:
strategy:
matrix:
os: [ubuntu-latest]
toolkit: ['pyside6', 'pyside2']
python-version: [3.8]
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
toolkit: ['null', 'pyside6', 'wx']
python-version: ['3.10']
exclude:
# No Wx wheels available for ubuntu or macos
- os: 'ubuntu-latest'
toolkit: 'wx'
- os: 'macos-latest'
toolkit: 'wx'
runs-on: ${{ matrix.os }}
steps:
- name: Check out
Expand All @@ -23,57 +29,63 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install PySide2 (from PyPI) dependencies for Linux
- name: Install Qt dependencies
uses: ./.github/actions/install-qt-support
if: matrix.toolkit != 'wx' && matrix.toolkit != 'null'
- name: Install dependencies for Linux
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev
sudo apt-get install qtchooser
sudo apt-get install qt5-qmake
sudo apt-get install qtbase5-dev-tools
sudo apt-get install libegl1
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install libxcb-icccm4
sudo apt-get install libxcb-image0
sudo apt-get install libxcb-keysyms1
sudo apt-get install libxcb-randr0
sudo apt-get install libxcb-render-util0
sudo apt-get install libxcb-xinerama0
sudo apt-get install libxcb-shape0
if: matrix.toolkit != 'wx'
- name: Install Wx dependencies for Linux
# needed for GL
sudo apt-get install libglu1-mesa-dev
# needed for Celiagg
sudo apt-get install libfreetype-dev libharfbuzz-dev
# needed for Cairo
sudo apt-get install libcairo2-dev
if: matrix.os == 'ubuntu-latest'
- name: Install dependencies for Mac
run: |
sudo apt-get update
sudo apt-get install libsdl2-2.0-0
if: matrix.toolkit == 'wx'
- name: Install GL dependencies for Linux
run: sudo apt-get install libglu1-mesa-dev
brew install cairo
if: matrix.os == 'macos-latest'
- name: Install build dependencies
run: |
python -m pip install -U pip wheel
- name: Install prebuilt wxPython
run: python -m pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
if: matrix.toolkit == 'wx'
- name: Install prebuilt celiagg
run: python -m pip install celiagg
python -m pip install --upgrade pip wheel
- name: Install local packages
run: pip install ".[cairo,gl,layout,pdf,svg,test,${{ matrix.toolkit }}]"
- name: Install source dependencies
run: |
python -m pip install git+http://github.com/enthought/traits.git#egg=traits
python -m pip install git+http://github.com/enthought/pyface.git#egg=pyface[${{ matrix.toolkit }}]
python -m pip install git+http://github.com/enthought/traitsui.git#egg=traitsui[${{ matrix.toolkit }}]
- name: Install local packages
run: python -m pip install .[gl,layout,pdf,svg,test]
python -m pip install git+https://github.com/enthought/traits.git
python -m pip install git+https://github.com/enthought/pyface.git
python -m pip install git+https://github.com/enthought/traitsui.git
python -m pip install git+https://github.com/celiagg/celiagg.git
- name: Sanity check package version
run: python -m pip list
- name: Run enable test suite
- name: Run kiva test suite (Linux)
env:
PYTHONFAULTHANDLER: 1
ETS_QT4_IMPORTS: 1
run: xvfb-run python -m unittest discover -v kiva
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ runner.temp }}
- name: Run kiva test suite (not Linux)
env:
PYTHONFAULTHANDLER: 1
ETS_QT4_IMPORTS: 1
run: python -m unittest discover -v kiva
if: matrix.os != 'ubuntu-latest'
working-directory: ${{ runner.temp }}
- name: Run enable test suite (Linux)
env:
PYTHONFAULTHANDLER: 1
ETS_QT4_IMPORTS: 1
# kiva agg requires at least 15-bit color depth.
run: xvfb-run --server-args="-screen 0 1024x768x24" python -m unittest discover -v enable
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ runner.temp }}
- name: Run kiva test suite
- name: Run enable test suite (not Linux)
env:
PYTHONFAULTHANDLER: 1
run: xvfb-run python -m unittest discover -v kiva
ETS_QT4_IMPORTS: 1
run: python -m unittest discover -v enable
if: matrix.os != 'ubuntu-latest'
working-directory: ${{ runner.temp }}

notify-on-failure:
Expand Down
47 changes: 9 additions & 38 deletions .github/workflows/test-with-edm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,14 @@ jobs:
test-edm-linux:
strategy:
matrix:
toolkit: ['null', 'pyqt5', 'pyside2']
runtime: ['3.6']
include:
- toolkit: 'pyside6'
runtime: '3.8'
runs-on: ubuntu-latest
toolkit: ['null', 'pyside6']
runtime: ['3.8']
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Install Qt dependencies for Linux
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev
sudo apt-get install qtchooser
sudo apt-get install qt5-qmake
sudo apt-get install qtbase5-dev-tools
sudo apt-get install libegl1
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install libxcb-icccm4
sudo apt-get install libxcb-image0
sudo apt-get install libxcb-keysyms1
sudo apt-get install libxcb-randr0
sudo apt-get install libxcb-render-util0
sudo apt-get install libxcb-xinerama0
sudo apt-get install libxcb-shape0
- name: Install Qt dependencies
uses: ./.github/actions/install-qt-support
if: matrix.toolkit != 'wx'
- name: Install Wx dependencies for Linux
run: |
sudo apt-get update
sudo apt-get install libsdl1.2-dev
if: matrix.toolkit == 'wx'
- name: Install GL dependencies for Linux
run: sudo apt-get install libglu1-mesa-dev
- name: Cache EDM packages
Expand All @@ -64,20 +42,13 @@ jobs:
# kiva agg requires at least 15-bit color depth.
run: xvfb-run --server-args="-screen 0 1024x768x24" edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }}

# Test against EDM packages on Windows and OSX
# Test against EDM packages on Windows
test-with-edm:
strategy:
matrix:
os: [macos-latest, windows-latest]
toolkit: ['pyqt5', 'pyside2', 'wx']
runtime: ['3.6']
include:
- os: macos-latest
toolkit: 'pyside6'
runtime: '3.8'
- os: windows-latest
toolkit: 'pyside6'
runtime: '3.8'
os: ["windows-latest"]
toolkit: ['null', 'pyside6', 'wx']
runtime: ['3.8']
runs-on: ${{ matrix.os }}
env:
# Set root directory, mainly for Windows, so that the EDM Python
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/test-with-pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

# This workflow installs dependencies from main branch

name: Test with pip

on:
pull_request:
# Make it possible to manually trigger the workflow
workflow_dispatch:

jobs:
test-ets:
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
toolkit: ['null', 'pyside2', 'pyside6', 'pyqt5', 'wx']
python-version: ['3.8', '3.10']
exclude:
# No Wx wheels available for ubuntu or macos
- os: 'ubuntu-latest'
toolkit: 'wx'
- os: 'macos-latest'
toolkit: 'wx'
# PyQt5 API doesn't automatically cast float -> int, see #1037
- toolkit: 'pyqt5'
python-version: '3.10'
# Kiva tests hanging on windows, see #1038
- os: 'windows-latest'
toolkit: 'pyqt5'
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Qt dependencies
uses: ./.github/actions/install-qt-support
if: matrix.toolkit != 'wx' && matrix.toolkit != 'null'
- name: Install dependencies for Linux
run: |
# needed for GL
sudo apt-get install libglu1-mesa-dev
# needed for Celiagg
sudo apt-get install libfreetype-dev libharfbuzz-dev
# needed for Cairo
sudo apt-get install libcairo2-dev
if: matrix.os == 'ubuntu-latest'
- name: Install dependencies for Mac
run: |
brew install cairo
if: matrix.os == 'macos-latest'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Install local packages
run: pip install ".[cairo,gl,layout,pdf,svg,test,${{ matrix.toolkit }}]"
- name: Install celiagg manually
# This is needed until new release of celiagg
# - numpy is needed for install in current released version
run: pip install celiagg
- name: Sanity check package version
run: pip list
- name: Run kiva test suite (Linux)
env:
PYTHONFAULTHANDLER: 1
ETS_QT4_IMPORTS: 1
run: xvfb-run python -m unittest discover -v kiva
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ runner.temp }}
- name: Run kiva test suite (not Linux)
env:
PYTHONFAULTHANDLER: 1
ETS_QT4_IMPORTS: 1
run: python -m unittest discover -v kiva
if: matrix.os != 'ubuntu-latest'
working-directory: ${{ runner.temp }}
- name: Run enable test suite (Linux)
env:
PYTHONFAULTHANDLER: 1
ETS_QT4_IMPORTS: 1
# kiva agg requires at least 15-bit color depth.
run: xvfb-run --server-args="-screen 0 1024x768x24" python -m unittest discover -v enable
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ runner.temp }}
- name: Run enable test suite (not Linux)
env:
PYTHONFAULTHANDLER: 1
ETS_QT4_IMPORTS: 1
run: python -m unittest discover -v enable
if: matrix.os != 'ubuntu-latest'
working-directory: ${{ runner.temp }}
16 changes: 16 additions & 0 deletions enable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,25 @@
"pdf": ["reportlab"],
# Dependencies for SVG backend
"svg": ["pyparsing"],
# Dependencies for Celiagg backend
"celiagg": ["celiagg"],
# Dependencies for Cairo backend
"cairo": ["pycairo"],
# Dependencies purely for running tests.
"test": [
"PyPDF2<3.0", # for pdf drawing tests in kiva.
"setuptools",
],
# Dependencies for PySide6
"pyside6": ["pyface[pyside6]", "traitsui[pyside6]"],
# Dependencies for PySide2
"pyside2": ["pyface[pyside2]", "traitsui[pyside2]"],
# Dependencies for PyQt6
"pyqt6": ["pyface[pyqt6]", "traitsui[pyqt6]"],
# Dependencies for PyQt5
"pyqt5": ["pyface[pyqt5]", "traitsui[pyqt5]"],
# Dependencies for WxPython
"wx": ["pyface[wx]", "traitsui[wx]"],
# Dependencies for null backend (nothing right now)
"null": [],
}
Loading

0 comments on commit 1565976

Please sign in to comment.