Remove the annoying import of example exception cather #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
push: | |
branches-ignore: "dependabot/**" | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
run-mypy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install mypy | |
run: pip install mypy | |
- name: Run mypy | |
run: mypy | |
test-pip: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
qt-lib: [pyqt, pyside] | |
python-version: ["3.9", "3.10", "3.11"] | |
include: | |
- python-version: "3.9" | |
qt-lib: "pyqt" | |
qt-version: "PyQt5~=5.15.0" | |
- python-version: "3.9" | |
qt-lib: "pyside" | |
qt-version: "PySide2~=5.15.0" | |
- python-version: "3.10" | |
qt-lib: "pyqt" | |
qt-version: "PyQt6~=6.2.0 PyQt6-Qt6~=6.2.0" | |
- python-version: "3.10" | |
qt-lib: "pyside" | |
qt-version: "PySide6~=6.2.0" | |
- python-version: "3.11" | |
qt-lib: "pyqt" | |
qt-version: "PyQt6" | |
- python-version: "3.11" | |
qt-lib: "pyside" | |
qt-version: "PySide6-Essentials" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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 "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: pip cache | |
uses: actions/cache@v3 | |
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: | | |
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 Dependencies | |
run: | | |
python -m pip install -r .github/workflows/etc/requirements.txt ${{ matrix.qt-version }} . | |
- name: "Install Linux VirtualDisplay" | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update -y --allow-releaseinfo-change | |
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 \ | |
libxcb-cursor0 | |
- name: 'Debug Info' | |
run: | | |
echo python location: `which python` | |
echo python version: `python --version` | |
echo pytest location: `which pytest` | |
echo installed packages | |
python -m pip list | |
echo pyqtgraph system info | |
python -c "import pyqtgraph as pg; pg.systemInfo()" | |
shell: bash | |
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' | |
- name: 'Display Info' | |
run: | | |
python -m pyqtgraph.util.glinfo | |
python -m pyqtgraph.util.get_resolution | |
if: runner.os != 'Linux' | |
- name: Run Tests | |
run: | | |
mkdir $SCREENSHOT_DIR | |
pytest tests -v | |
pytest pyqtgraph/examples -v -n 2 | |
shell: bash | |
- name: Upload Screenshots | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Screenshots (Python ${{ matrix.python-version }} - Qt-Bindings ${{ matrix.qt-lib }} - OS ${{ matrix.os }}) | |
path: $SCREENSHOT_DIR | |
if-no-files-found: ignore | |
env: | |
SCREENSHOT_DIR: ./screenshots | |
test-conda: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
qt-lib: [pyqt, pyside] | |
include: | |
- qt-lib: pyqt | |
environment-file: .github/workflows/etc/environment-pyqt.yml | |
- qt-lib: pyside | |
environment-file: .github/workflows/etc/environment-pyside.yml | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
miniforge-variant: Mambaforge | |
environment-file: ${{ matrix.environment-file }} | |
auto-update-conda: false | |
python-version: "3.10" | |
use-mamba: true | |
- name: "Install Test Framework" | |
run: pip install pytest pytest-xdist | |
- 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 --allow-releaseinfo-change | |
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 \ | |
libxcb-cursor0 | |
pip install pytest-xvfb | |
- 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()" | |
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' | |
- name: 'Display Info' | |
run: | | |
python -m pyqtgraph.util.glinfo | |
python -m pyqtgraph.util.get_resolution | |
if: runner.os != 'Linux' | |
- name: Run Tests | |
run: | | |
mkdir $SCREENSHOT_DIR | |
pytest tests -v | |
pytest pyqtgraph/examples -v -n 2 | |
env: | |
SCREENSHOT_DIR: ./screenshots | |
build-wheel: | |
name: build wheel | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Build Wheel | |
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@v4 | |
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@v5 | |
with: | |
python-version: '3.11' | |
- 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@v2 | |
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@v2 | |
# ℹ️ 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@v2 |