Skip to content

Commit

Permalink
Merge pull request #4149 from t20100/ci-windows
Browse files Browse the repository at this point in the history
Tests and continuous integration: Fixed issues and updated CI configuration
  • Loading branch information
t20100 authored Sep 3, 2024
2 parents 269d0cb + bcaa18f commit 1191989
Show file tree
Hide file tree
Showing 62 changed files with 290 additions and 324 deletions.
150 changes: 51 additions & 99 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: CI

on:
# Triggers the workflow on push only for the master branch or pull request events
push:
branches: [master]
branches: [main]
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

defaults:
Expand All @@ -16,134 +13,89 @@ defaults:
jobs:
# This workflow contains a single job called "build"
build:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.name-suffix }}"
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.QT_API }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name-suffix: "PyQt5 sdist"
os: ubuntu-20.04
- os: ubuntu-20.04
python-version: "3.8"
BUILD_OPTION: --sdist
QT_BINDING: PyQt5
RUN_TESTS_OPTIONS: --qt-binding=PyQt5 --no-opencl --low-mem
- name-suffix: "PyQt5 wheel"
os: macos-latest
python-version: "3.10"
BUILD_OPTION: --wheel
QT_BINDING: PyQt5
RUN_TESTS_OPTIONS: --qt-binding=PyQt5 --no-opencl --low-mem
QT_API: PyQt5
- os: ubuntu-latest
python-version: "3.11"
QT_API: PyQt6
- os: ubuntu-latest
python-version: "3.12"
QT_API: PySide6

- name-suffix: "PySide6 sdist"
os: ubuntu-latest
python-version: "3.8"
BUILD_OPTION: --sdist
QT_BINDING: PySide6
RUN_TESTS_OPTIONS: --qt-binding=PySide6 --no-opencl --low-mem
- name-suffix: "PySide6 wheel"
os: macos-latest
- os: macos-13
python-version: "3.10"
QT_API: PyQt5
- os: macos-13
python-version: "3.12"
QT_API: PyQt6
- os: macos-13
python-version: "3.9"
BUILD_OPTION: --wheel
QT_BINDING: "PySide6<6.7"
RUN_TESTS_OPTIONS: --qt-binding=PySide6 --no-opencl --low-mem
QT_API: PySide6

- name-suffix: "PyQt6 wheel"
os: ubuntu-latest
python-version: "3.11"
BUILD_OPTION: --wheel
QT_BINDING: PyQt6
RUN_TESTS_OPTIONS: --qt-binding=PyQt6 --no-opengl --low-mem
- name-suffix: "PyQt6 wheel"
os: macos-latest
python-version: "3.11"
BUILD_OPTION: --wheel
QT_BINDING: PyQt6
RUN_TESTS_OPTIONS: --qt-binding=PyQt6 --no-opencl --low-mem

- name-suffix: "No GUI wheel"
os: windows-latest
- os: windows-latest
python-version: "3.9"
BUILD_COMMAND: --wheel
QT_BINDING: PyQt5
RUN_TESTS_OPTIONS: --no-gui --low-mem
# No GUI tests on Windows
QT_API: PyQt5
- os: windows-latest
python-version: "3.12"
QT_API: PyQt6
- os: windows-latest
python-version: "3.10"
QT_API: PySide6

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4

# Install X server packages
# Install packages:
# OpenCL lib and icd
# xvfb to run the GUI test headless
# libegl1-mesa: Required by Qt xcb platform plugin
# ocl-icd-opencl-dev: OpenCL headers, lib and icd loader
# libgl1-mesa-glx: For OpenGL
# xserver-xorg-video-dummy: For OpenGL
# libxkbcommon-x11-0: needed for Qt plugins
- name: Install X server
# libxkbcommon-x11-0, ..: needed for Qt plugins
- name: Install system packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libegl1-mesa ocl-icd-opencl-dev intel-opencl-icd libgl1-mesa-glx xserver-xorg-video-dummy libxkbcommon-x11-0 libxkbcommon0 libxkbcommon-dev libxcb-icccm4 libxcb-image0 libxcb-shm0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-cursor0 libxcb1
sudo apt-get install ocl-icd-opencl-dev intel-opencl-icd xvfb libegl1-mesa libgl1-mesa-glx xserver-xorg-video-dummy libxkbcommon-x11-0 libxkbcommon0 libxkbcommon-dev libxcb-icccm4 libxcb-image0 libxcb-shm0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-cursor0 libxcb1
# Runs a single command using the runners shell
- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Upgrade distribution modules
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build setuptools wheel
pip install --upgrade --pre cython
- name: Print python info used for build
run: |
python ./ci/info_platform.py
pip install --upgrade --pre build cython setuptools wheel
pip list
- name: Generate source package or wheel
- name: Build
env:
MACOSX_DEPLOYMENT_TARGET: "10.9"
run: |
if [ ${{ runner.os }} == 'macOS' ]; then
export MACOSX_DEPLOYMENT_TARGET=10.9;
fi
python -m build --no-isolation ${{ matrix.BUILD_OPTION }}
python -m build --no-isolation
ls dist
- name: Pre-install dependencies
run: |
if [ -s "ci/requirements-pinned.txt" ];
then
pip install -r ci/requirements-pinned.txt;
fi
pip install --pre -r requirements.txt
pip uninstall -y PyQt5 PyQt6 PySide6
pip install --pre "${{ matrix.QT_BINDING }}"
- name: Install pytest
run: |
pip install pytest
pip install pytest-xvfb
pip install pytest-mock
- name: Install silx package
run: pip install --pre --find-links dist/ --no-cache-dir --no-index --no-build-isolation silx

- name: Print python info used for tests
- name: Install
run: |
pip install -r ci/requirements-pinned.txt
pip install --pre "${{ matrix.QT_API }}"
pip install --pre "$(ls dist/silx*.whl)[full,test]"
python ./ci/info_platform.py
pip list
# For Linux: Start X server with dummy video dirver
# Use this instead of Xvfb to have RANDR extension
# Otherwise there is a bug with Qt5.10.0
- name: Run the tests
- name: Test
env:
QT_API: ${{ matrix.QT_API }}
SILX_TEST_LOW_MEM: "False"
run: |
if [ ${{ runner.os }} == 'Linux' ]; then
export OCL_ICD_VENDORS=$(pwd)/intel_opencl_icd/vendors
export DISPLAY=:99.0
Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./99.log -config ./ci/xorg.conf :99 &
sleep 3
if [ ${{ runner.os }} == 'Windows' ]; then
export WITH_GL_TEST=False
fi
echo "RUN_TESTS_OPTIONS="${{ matrix.RUN_TESTS_OPTIONS }}
python run_tests.py --installed -v ${{ matrix.RUN_TESTS_OPTIONS }}
python -c "import silx.test, sys; sys.exit(silx.test.run_tests(verbosity=1, args=['--qt-binding=${{ matrix.QT_API }}']));"
19 changes: 7 additions & 12 deletions ci/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@ environment:
global:
WIN_SDK_ROOT: "C:\\Program Files\\Microsoft SDKs\\Windows"
VENV_BUILD_DIR: "venv_build"
VENV_TEST_DIR: "venv_test"
VENV_TEST_DIR: "..\\venv_test"

matrix:
# Python 3.9
- PYTHON_DIR: "C:\\Python39-x64"
QT_BINDING: "PyQt5"
WITH_GL_TEST: True
QT_API: "PyQt5"
PIP_OPTIONS: "-q --pre"

# Python 3.12
- PYTHON_DIR: "C:\\Python312-x64"
QT_BINDING: "PySide6<6.7"
WITH_GL_TEST: True
QT_API: "PySide6"
PIP_OPTIONS: "-q --pre"

# Python 3.11
- PYTHON_DIR: "C:\\Python311-x64"
QT_BINDING: "PyQt6"
WITH_GL_TEST: True
QT_API: "PyQt6"
PIP_OPTIONS: "-q"


Expand All @@ -56,7 +53,7 @@ install:
- "python -m pip install %PIP_OPTIONS% --upgrade pip"

# Download Mesa OpenGL in Python directory when testing OpenGL
- IF %WITH_GL_TEST%==True curl -fsS -o %PYTHON_DIR%\\opengl32.dll http://www.silx.org/pub/silx/continuous_integration/opengl32_mingw-mesa-x86_64.dll
- curl -fsS -o %PYTHON_DIR%\\opengl32.dll https://www.silx.org/pub/silx/continuous_integration/opengl32_mingw-mesa-x86_64.dll

build_script:
# Create build virtualenv
Expand Down Expand Up @@ -94,8 +91,7 @@ before_test:
- pip install %PIP_OPTIONS% -r requirements.txt

# Install selected Qt binding
- "pip uninstall -y PyQt5 PySide6 PyQt6"
- pip install %PIP_OPTIONS% "%QT_BINDING%"
- pip install %PIP_OPTIONS% "%QT_API%"

# Install pytest
- "pip install %PIP_OPTIONS% pytest"
Expand All @@ -118,8 +114,7 @@ before_test:

test_script:
# Run tests with selected Qt binding and without OpenCL
- echo "WITH_GL_TEST=%WITH_GL_TEST%"
- "python run_tests.py --installed -v --no-opencl --low-mem"
- python -c "import silx.test, sys; sys.exit(silx.test.run_tests(verbosity=1, args=('--no-opencl', '--low-mem', '--qt-binding=%QT_API%')));"

after_test:
# Leave test virtualenv
Expand Down
21 changes: 0 additions & 21 deletions ci/xorg.conf

This file was deleted.

13 changes: 0 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,3 @@ safe = true

[tool.pytest.ini_options]
minversion = "6.0"
python_files = [
"test/test*.py",
"test/Test*.py",
]
python_classes = "Test"
python_functions = "test"
filterwarnings = [
"error",
# note the use of single quote below to denote "raw" strings in TOML
'ignore:tostring\(\) is deprecated. Use tobytes\(\) instead\.:DeprecationWarning:OpenGL',
'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning',
'ignore:Unable to import recommended hash:UserWarning:pytools',
]
22 changes: 5 additions & 17 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,10 @@ def normalize_option(option):
return os.path.join(PROJECT_PATH, *option_parts[2:])
return option

args = [normalize_option(p) for p in sys.argv[1:] if p != "--installed"]

# Run test on PROJECT_PATH if nothing is specified
without_options = [a for a in args if not a.startswith("-")]
if len(without_options) == 0:
args += [PROJECT_PATH]

argv = ["--rootdir", PROJECT_PATH] + args
test_module = importlib.import_module(f"{PROJECT_NAME}.test")
sys.exit(
subprocess.run(
[
sys.executable,
"-m",
"pytest",
]
+ argv,
check=False,
).returncode
test_module.run_tests(
module=None,
args=[normalize_option(p) for p in sys.argv[1:] if p != "--installed"],
)
)
Loading

0 comments on commit 1191989

Please sign in to comment.