Skip to content

Commit

Permalink
MNT: make so only oldesta and newest supported python versions are ra…
Browse files Browse the repository at this point in the history
…n against in gh-actions tests
  • Loading branch information
nstelter-slac committed Jan 7, 2025
1 parent 4c715e1 commit 454959c
Showing 1 changed file with 75 additions and 60 deletions.
135 changes: 75 additions & 60 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,84 @@
# This workflow will install pydm dependencies and run the test suite for all combinations
# of operating systems and version numbers specified in the matrix
# This workflow will install pydm dependencies and run the test suite for all combinations
# of operating systems and version numbers specified in the matrix

name: Build Status
name: Build Status

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
latest_supported_python: 3.13
oldest_supported_python: 3.9

permissions:
contents: read
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
if: ${{ github.repository == 'slaclab/pydm' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.13']
pyqt-version: [5.12.3, 5.15.9]
env:
DISPLAY: ':99.0'
QT_MAC_WANTS_LAYER: 1 # PyQT gui tests involving qtbot interaction on macOS will fail without this
permissions:
contents: read

steps:
- uses: actions/checkout@v3
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: pydm-env
jobs:
build:
if: ${{ github.repository == 'slaclab/pydm' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Test with the latest and oldest actively supported python versions. The reasoning here is that the oldest
# would likely have the most diff from the latest, and testing all versions inbetween is probably excessive.
# (we could potentially create another .yml file that tests all python versions but only runs on creating release)

- name: Install pydm with mamba
shell: bash -el {0}
run: |
mamba install -c conda-forge pydm pyqt=${{ matrix.pyqt-version }}
# Test with older pyqt (5.12.3) since this is latest pyqt version that can load pydm plugins in designer.
include:
- { os: ubuntu-latest, python-version: ${{ env.oldest_supported_python }}, pyqt-version: 5.12.3 }
- { os: windows-latest, python-version: ${{ env.oldest_supported_python }}, pyqt-version: 5.12.3 }
- { os: macos-latest, python-version: ${{ env.oldest_supported_python }}, pyqt-version: 5.12.3 }

- name: Install additional python dependencies with pip
shell: bash -el {0}
run: |
pip install -r requirements.txt
if [ "$RUNNER_OS" == "Windows" ]; then
pip install -r windows-dev-requirements.txt
else
pip install -r dev-requirements.txt
fi
# But pyqt 5.12.3 is not installable with python 3.11+, so only test latest python with compatible pyqt 5.15.9.
- { os: ubuntu-latest, python-version: ${{ env.latest_supported_python }}, pyqt-version: 5.15.9 }
- { os: windows-latest, python-version: ${{ env.latest_supported_python }}, pyqt-version: 5.15.9 }
- { os: macos-latest, python-version: ${{ env.latest_supported_python }}, pyqt-version: 5.15.9 }
env:
DISPLAY: ':99.0'
QT_MAC_WANTS_LAYER: 1 # PyQT gui tests involving qtbot interaction on macOS will fail without this

- name: Install packages for testing a pyqt app on Linux
shell: bash -el {0}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install -y xvfb herbstluftwm libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
sleep 3
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_herbstluftwm_99.pid --make-pidfile --background --exec /usr/bin/herbstluftwm
sleep 1
fi
steps:
- uses: actions/checkout@v3
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Miniforge3
miniforge-version: latest
activate-environment: pydm-env

- name: Test with pytest
shell: bash -el {0}
run: |
python run_tests.py
- name: Install pydm with mamba
shell: bash -el {0}
run: |
mamba install -c conda-forge pydm pyqt=${{ matrix.pyqt-version }}
- name: Install additional python dependencies with pip
shell: bash -el {0}
run: |
pip install -r requirements.txt
if [ "$RUNNER_OS" == "Windows" ]; then
pip install -r windows-dev-requirements.txt
else
pip install -r dev-requirements.txt
fi
- name: Install packages for testing a pyqt app on Linux
shell: bash -el {0}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install -y xvfb herbstluftwm libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
sleep 3
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_herbstluftwm_99.pid --make-pidfile --background --exec /usr/bin/herbstluftwm
sleep 1
fi
- name: Test with pytest
shell: bash -el {0}
run: |
python run_tests.py

0 comments on commit 454959c

Please sign in to comment.