-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests and continuous integration: Fixed issues and updated CI configuration #4149
base: main
Are you sure you want to change the base?
Changes from all commits
199f34c
e8bfa3f
a970e37
d0a0fad
d720d95
ce9ab9b
a5f05d7
618ad66
ab2927f
7b5a0b1
9029ffd
1518c2a
69a07b5
f483058
e849464
f267bd0
9008b3b
4c6fbb8
24228d8
baefd3c
0ec10d9
cbf3a72
8631cdf
d2f7c50
2342c4a
f71d2a7
9fbb889
51e66d4
ba6e7dc
96b0e64
62f5df6
821f0dc
30abd19
6e4e93e
dbdb3a0
ed6d500
dfdc725
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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: | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using xvfb simplifies a lot and looks to work fine with OpenGL tests |
||
|
||
# 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 }}']));" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having the virtual env to run the tests inside the cloned repo caused trouble to pytest. |
||
|
||
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" | ||
|
||
|
||
|
@@ -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 | ||
|
@@ -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" | ||
|
@@ -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 | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
Comment on lines
-16
to
-21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer needed, just use |
||
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', | ||
] | ||
Comment on lines
-22
to
-28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now defined in |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"], | ||
) | ||
Comment on lines
+175
to
+178
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to test
--sdist
,python -m build
does so