Skip to content

Commit

Permalink
Remove Python 3.7 from CI - Add Conda Package Testing (pyqtgraph#2211)
Browse files Browse the repository at this point in the history
Remove Python 3.7 CI Pipelines

In order to conform to NEP-29, we now stop testing bindings on Py 3.7. 
Unfortunately, this means that we cannot test against PySide2 5.12 as the
pip installable version doesn't work with Python 3.8.  To test against
PySide2 5.12, we will have to add conda-based CI pipelines as the
conda-forge version of PySide2 has various fixes.

This PR also updates 

* `.pre-commit-config.yaml`
* `.gitignore`
* `pytest.ini` to filter out warnings specific to conda-forge/pyside2/python 3.8
  • Loading branch information
j9ac9k authored Mar 15, 2022
1 parent f83b472 commit 088b488
Show file tree
Hide file tree
Showing 14 changed files with 276 additions and 125 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/etc/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: test
channels:
- conda-forge
- defaults
dependencies:
- python=3.8
- pyside2
- numpy
- scipy
- pyopengl
- pytest
- pytest-xdist
- pip
224 changes: 190 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,42 @@ name: main

on: [push, pull_request]

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
test-pip:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04 , windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
qt-lib: [pyqt, pyside]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
exclude:
- qt-lib: pyside
python-version: "3.8"
include:
- python-version: "3.7"
qt-lib: "pyqt"
qt-version: "PyQt5~=5.12.0"
numpy-version: "~=1.18.0"
- python-version: "3.7"
qt-lib: "pyside"
qt-version: "PySide2~=5.12.0"
numpy-version: "~=1.18.0"
- python-version: "3.8"
qt-lib: "pyqt"
qt-version: "PyQt5~=5.15.0"
numpy-version: "~=1.19.0"
- python-version: "3.8"
qt-lib: "pyside"
qt-version: "PySide2~=5.15.0"
numpy-version: "~=1.19.0"
qt-version: "PyQt5~=5.12.0"
- python-version: "3.9"
qt-lib: "pyqt"
qt-version: "PyQt6~=6.1.0"
numpy-version: "~=1.22.0"
qt-version: "PyQt5~=5.15.0"
- python-version: "3.9"
qt-lib: "pyside"
qt-version: "PySide6~=6.1.0"
numpy-version: "~=1.22.0"
qt-version: "PySide2~=5.15.0"
- python-version: "3.10"
qt-lib: "pyqt"
qt-version: "PyQt6"
numpy-version: "~=1.22.0"
- python-version: "3.10"
qt-lib: "pyside"
qt-version: "PySide6"
numpy-version: "~=1.22.0"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -57,6 +46,18 @@ jobs:
with:
# Semantic version range syntax or exact version of a Python version
python-version: ${{ matrix.python-version }}
cache: pip
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: "Install Windows-Mesa OpenGL DLL"
if: runner.os == 'Windows'
run: |
Expand All @@ -76,20 +77,23 @@ jobs:
shell: cmd
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ${{ matrix.qt-version }} numpy${{ matrix.numpy-version }} scipy pyopengl h5py matplotlib pytest pytest-xdist .
- name: Optionally Install Numba
if: matrix.python-version != '3.10'
run: |
python -m pip install numba
python -m pip install -r .github/workflows/requirements.txt ${{ matrix.qt-version }} .
- name: "Install Linux VirtualDisplay"
if: runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install -y libxkbcommon-x11-0 x11-utils
sudo apt-get install --no-install-recommends -y libyaml-dev libegl1-mesa libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0
sudo apt-get install -y libopengl0
python -m pip install pytest-xvfb
sudo apt-get install --no-install-recommends -y \
libxkbcommon-x11-0 \
x11-utils \
libyaml-dev \
libegl1-mesa \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libopengl0
- name: 'Debug Info'
run: |
echo python location: `which python`
Expand All @@ -116,7 +120,7 @@ jobs:
run: |
mkdir $SCREENSHOT_DIR
pytest tests -v
pytest pyqtgraph/examples -v -n auto
pytest pyqtgraph/examples -v -n 2
shell: bash
- name: Upload Screenshots
uses: actions/upload-artifact@v2
Expand All @@ -127,6 +131,109 @@ jobs:
env:
SCREENSHOT_DIR: ./screenshots

test-conda:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
auto-update-conda: false
channels: conda-forge,defaults
channel-priority: true
python-version: "3.8"
use-only-tar-bz2: true
- name: Get Date
id: get-date
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
shell: bash
- name: Cache Conda env
uses: actions/cache@v2
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('.github/workflows/etc/environment.yml') }}-${{ env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
id: cache
- name: Update environment
run: conda env update -n test -f .github/workflows/etc/environment.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: "Install Windows-Mesa OpenGL DLL"
if: runner.os == 'Windows'
run: |
curl -LJO https://github.com/pal1000/mesa-dist-win/releases/download/19.2.7/mesa3d-19.2.7-release-msvc.7z
7z x mesa3d-19.2.7-release-msvc.7z
cd x64
xcopy opengl32.dll C:\windows\system32\mesadrv.dll*
xcopy opengl32.dll C:\windows\syswow64\mesadrv.dll*
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DLL /t REG_SZ /d "mesadrv.dll" /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DriverVersion /t REG_DWORD /d 1 /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Flags /t REG_DWORD /d 1 /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Version /t REG_DWORD /d 2 /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DLL /t REG_SZ /d "mesadrv.dll" /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v DriverVersion /t REG_DWORD /d 1 /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Flags /t REG_DWORD /d 1 /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\MSOGL" /v Version /t REG_DWORD /d 2 /f
shell: cmd
- name: "Install Linux VirtualDisplay"
if: runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends \
libxkbcommon-x11-0 \
x11-utils \
libyaml-dev \
libegl1-mesa \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libopengl0
pip install pytest-xvfb
shell: bash -l {0}
- name: 'Debug Info'
run: |
echo python location: `which python`
echo python version: `python --version`
echo pytest location: `which pytest`
echo installed packages
conda list
pip list
echo pyqtgraph system info
python -c "import pyqtgraph as pg; pg.systemInfo()"
shell: bash -l {0}
env:
QT_DEBUG_PLUGINS: 1
- name: 'XVFB Display Info'
run: |
xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python -m pyqtgraph.util.glinfo
xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python -m pyqtgraph.util.get_resolution
if: runner.os == 'Linux'
shell: bash -l {0}
- name: 'Display Info'
run: |
python -m pyqtgraph.util.glinfo
python -m pyqtgraph.util.get_resolution
if: runner.os != 'Linux'
shell: bash -l {0}
- name: Run Tests
run: |
mkdir $SCREENSHOT_DIR
pytest tests -v
pytest pyqtgraph/examples -v -n 2
shell: bash -l {0}
env:
SCREENSHOT_DIR: ./screenshots

build-wheel:
name: build wheel
runs-on: ubuntu-latest
Expand All @@ -140,3 +247,52 @@ jobs:
run: |
python -m pip install setuptools wheel
python setup.py bdist_wheel
analyze:
name: analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install PyQt5 numpy scipy
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: 'python'
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
queries: +security-and-quality
setup-python-dependencies: false

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
22 changes: 22 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# numpy based on python version and NEP-29 requirements
numpy; python_version == '3.10'
numpy==1.21.5; python_version == '3.9'
numpy==1.19.5; python_version == '3.8'

# image testing
scipy==1.8.0

# optional high performance paths
numba==0.55.1; python_version == '3.9'

# optional 3D
pyopengl==3.1.6

# supplimental tools
matplotlib==3.5.1
h5py==3.6.0

# testing
pytest==7.1.0
pytest-xdist==2.5.0
pytest-xvfb==2.0.0; sys_platform == 'linux'
Loading

0 comments on commit 088b488

Please sign in to comment.