Skip to content

Commit 1191989

Browse files
authored
Merge pull request #4149 from t20100/ci-windows
Tests and continuous integration: Fixed issues and updated CI configuration
2 parents 269d0cb + bcaa18f commit 1191989

62 files changed

Lines changed: 290 additions & 324 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 51 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: CI
22

33
on:
4-
# Triggers the workflow on push only for the master branch or pull request events
54
push:
6-
branches: [master]
5+
branches: [main]
76
pull_request:
8-
9-
# Allows you to run this workflow manually from the Actions tab
107
workflow_dispatch:
118

129
defaults:
@@ -16,134 +13,89 @@ defaults:
1613
jobs:
1714
# This workflow contains a single job called "build"
1815
build:
19-
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.name-suffix }}"
16+
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.QT_API }}"
2017
runs-on: ${{ matrix.os }}
2118
strategy:
19+
fail-fast: false
2220
matrix:
2321
include:
24-
- name-suffix: "PyQt5 sdist"
25-
os: ubuntu-20.04
22+
- os: ubuntu-20.04
2623
python-version: "3.8"
27-
BUILD_OPTION: --sdist
28-
QT_BINDING: PyQt5
29-
RUN_TESTS_OPTIONS: --qt-binding=PyQt5 --no-opencl --low-mem
30-
- name-suffix: "PyQt5 wheel"
31-
os: macos-latest
32-
python-version: "3.10"
33-
BUILD_OPTION: --wheel
34-
QT_BINDING: PyQt5
35-
RUN_TESTS_OPTIONS: --qt-binding=PyQt5 --no-opencl --low-mem
24+
QT_API: PyQt5
25+
- os: ubuntu-latest
26+
python-version: "3.11"
27+
QT_API: PyQt6
28+
- os: ubuntu-latest
29+
python-version: "3.12"
30+
QT_API: PySide6
3631

37-
- name-suffix: "PySide6 sdist"
38-
os: ubuntu-latest
39-
python-version: "3.8"
40-
BUILD_OPTION: --sdist
41-
QT_BINDING: PySide6
42-
RUN_TESTS_OPTIONS: --qt-binding=PySide6 --no-opencl --low-mem
43-
- name-suffix: "PySide6 wheel"
44-
os: macos-latest
32+
- os: macos-13
33+
python-version: "3.10"
34+
QT_API: PyQt5
35+
- os: macos-13
36+
python-version: "3.12"
37+
QT_API: PyQt6
38+
- os: macos-13
4539
python-version: "3.9"
46-
BUILD_OPTION: --wheel
47-
QT_BINDING: "PySide6<6.7"
48-
RUN_TESTS_OPTIONS: --qt-binding=PySide6 --no-opencl --low-mem
40+
QT_API: PySide6
4941

50-
- name-suffix: "PyQt6 wheel"
51-
os: ubuntu-latest
52-
python-version: "3.11"
53-
BUILD_OPTION: --wheel
54-
QT_BINDING: PyQt6
55-
RUN_TESTS_OPTIONS: --qt-binding=PyQt6 --no-opengl --low-mem
56-
- name-suffix: "PyQt6 wheel"
57-
os: macos-latest
58-
python-version: "3.11"
59-
BUILD_OPTION: --wheel
60-
QT_BINDING: PyQt6
61-
RUN_TESTS_OPTIONS: --qt-binding=PyQt6 --no-opencl --low-mem
62-
63-
- name-suffix: "No GUI wheel"
64-
os: windows-latest
42+
- os: windows-latest
6543
python-version: "3.9"
66-
BUILD_COMMAND: --wheel
67-
QT_BINDING: PyQt5
68-
RUN_TESTS_OPTIONS: --no-gui --low-mem
69-
# No GUI tests on Windows
44+
QT_API: PyQt5
45+
- os: windows-latest
46+
python-version: "3.12"
47+
QT_API: PyQt6
48+
- os: windows-latest
49+
python-version: "3.10"
50+
QT_API: PySide6
7051

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

75-
# Install X server packages
55+
# Install packages:
56+
# OpenCL lib and icd
57+
# xvfb to run the GUI test headless
7658
# libegl1-mesa: Required by Qt xcb platform plugin
77-
# ocl-icd-opencl-dev: OpenCL headers, lib and icd loader
7859
# libgl1-mesa-glx: For OpenGL
7960
# xserver-xorg-video-dummy: For OpenGL
80-
# libxkbcommon-x11-0: needed for Qt plugins
81-
- name: Install X server
61+
# libxkbcommon-x11-0, ..: needed for Qt plugins
62+
- name: Install system packages
8263
if: runner.os == 'Linux'
8364
run: |
8465
sudo apt-get update
85-
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
66+
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
8667
87-
# Runs a single command using the runners shell
88-
- name: Set up Python
89-
uses: actions/setup-python@v5
68+
- uses: actions/setup-python@v5
9069
with:
9170
python-version: ${{ matrix.python-version }}
9271
cache: "pip"
9372

94-
- name: Upgrade distribution modules
73+
- name: Install build dependencies
9574
run: |
96-
python -m pip install --upgrade pip
97-
pip install --upgrade build setuptools wheel
98-
pip install --upgrade --pre cython
99-
100-
- name: Print python info used for build
101-
run: |
102-
python ./ci/info_platform.py
75+
pip install --upgrade --pre build cython setuptools wheel
10376
pip list
10477
105-
- name: Generate source package or wheel
78+
- name: Build
79+
env:
80+
MACOSX_DEPLOYMENT_TARGET: "10.9"
10681
run: |
107-
if [ ${{ runner.os }} == 'macOS' ]; then
108-
export MACOSX_DEPLOYMENT_TARGET=10.9;
109-
fi
110-
python -m build --no-isolation ${{ matrix.BUILD_OPTION }}
82+
python -m build --no-isolation
11183
ls dist
11284
113-
- name: Pre-install dependencies
114-
run: |
115-
if [ -s "ci/requirements-pinned.txt" ];
116-
then
117-
pip install -r ci/requirements-pinned.txt;
118-
fi
119-
pip install --pre -r requirements.txt
120-
pip uninstall -y PyQt5 PyQt6 PySide6
121-
pip install --pre "${{ matrix.QT_BINDING }}"
122-
123-
- name: Install pytest
124-
run: |
125-
pip install pytest
126-
pip install pytest-xvfb
127-
pip install pytest-mock
128-
129-
- name: Install silx package
130-
run: pip install --pre --find-links dist/ --no-cache-dir --no-index --no-build-isolation silx
131-
132-
- name: Print python info used for tests
85+
- name: Install
13386
run: |
87+
pip install -r ci/requirements-pinned.txt
88+
pip install --pre "${{ matrix.QT_API }}"
89+
pip install --pre "$(ls dist/silx*.whl)[full,test]"
13490
python ./ci/info_platform.py
13591
pip list
13692
137-
# For Linux: Start X server with dummy video dirver
138-
# Use this instead of Xvfb to have RANDR extension
139-
# Otherwise there is a bug with Qt5.10.0
140-
- name: Run the tests
93+
- name: Test
94+
env:
95+
QT_API: ${{ matrix.QT_API }}
96+
SILX_TEST_LOW_MEM: "False"
14197
run: |
142-
if [ ${{ runner.os }} == 'Linux' ]; then
143-
export OCL_ICD_VENDORS=$(pwd)/intel_opencl_icd/vendors
144-
export DISPLAY=:99.0
145-
Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./99.log -config ./ci/xorg.conf :99 &
146-
sleep 3
98+
if [ ${{ runner.os }} == 'Windows' ]; then
99+
export WITH_GL_TEST=False
147100
fi
148-
echo "RUN_TESTS_OPTIONS="${{ matrix.RUN_TESTS_OPTIONS }}
149-
python run_tests.py --installed -v ${{ matrix.RUN_TESTS_OPTIONS }}
101+
python -c "import silx.test, sys; sys.exit(silx.test.run_tests(verbosity=1, args=['--qt-binding=${{ matrix.QT_API }}']));"

ci/appveyor.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,22 @@ environment:
2121
global:
2222
WIN_SDK_ROOT: "C:\\Program Files\\Microsoft SDKs\\Windows"
2323
VENV_BUILD_DIR: "venv_build"
24-
VENV_TEST_DIR: "venv_test"
24+
VENV_TEST_DIR: "..\\venv_test"
2525

2626
matrix:
2727
# Python 3.9
2828
- PYTHON_DIR: "C:\\Python39-x64"
29-
QT_BINDING: "PyQt5"
30-
WITH_GL_TEST: True
29+
QT_API: "PyQt5"
3130
PIP_OPTIONS: "-q --pre"
3231

3332
# Python 3.12
3433
- PYTHON_DIR: "C:\\Python312-x64"
35-
QT_BINDING: "PySide6<6.7"
36-
WITH_GL_TEST: True
34+
QT_API: "PySide6"
3735
PIP_OPTIONS: "-q --pre"
3836

3937
# Python 3.11
4038
- PYTHON_DIR: "C:\\Python311-x64"
41-
QT_BINDING: "PyQt6"
42-
WITH_GL_TEST: True
39+
QT_API: "PyQt6"
4340
PIP_OPTIONS: "-q"
4441

4542

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

5855
# Download Mesa OpenGL in Python directory when testing OpenGL
59-
- 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
56+
- curl -fsS -o %PYTHON_DIR%\\opengl32.dll https://www.silx.org/pub/silx/continuous_integration/opengl32_mingw-mesa-x86_64.dll
6057

6158
build_script:
6259
# Create build virtualenv
@@ -94,8 +91,7 @@ before_test:
9491
- pip install %PIP_OPTIONS% -r requirements.txt
9592

9693
# Install selected Qt binding
97-
- "pip uninstall -y PyQt5 PySide6 PyQt6"
98-
- pip install %PIP_OPTIONS% "%QT_BINDING%"
94+
- pip install %PIP_OPTIONS% "%QT_API%"
9995

10096
# Install pytest
10197
- "pip install %PIP_OPTIONS% pytest"
@@ -118,8 +114,7 @@ before_test:
118114

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

124119
after_test:
125120
# Leave test virtualenv

ci/xorg.conf

Lines changed: 0 additions & 21 deletions
This file was deleted.

pyproject.toml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,3 @@ safe = true
1313

1414
[tool.pytest.ini_options]
1515
minversion = "6.0"
16-
python_files = [
17-
"test/test*.py",
18-
"test/Test*.py",
19-
]
20-
python_classes = "Test"
21-
python_functions = "test"
22-
filterwarnings = [
23-
"error",
24-
# note the use of single quote below to denote "raw" strings in TOML
25-
'ignore:tostring\(\) is deprecated. Use tobytes\(\) instead\.:DeprecationWarning:OpenGL',
26-
'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning',
27-
'ignore:Unable to import recommended hash:UserWarning:pytools',
28-
]

run_tests.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -170,22 +170,10 @@ def normalize_option(option):
170170
return os.path.join(PROJECT_PATH, *option_parts[2:])
171171
return option
172172

173-
args = [normalize_option(p) for p in sys.argv[1:] if p != "--installed"]
174-
175-
# Run test on PROJECT_PATH if nothing is specified
176-
without_options = [a for a in args if not a.startswith("-")]
177-
if len(without_options) == 0:
178-
args += [PROJECT_PATH]
179-
180-
argv = ["--rootdir", PROJECT_PATH] + args
173+
test_module = importlib.import_module(f"{PROJECT_NAME}.test")
181174
sys.exit(
182-
subprocess.run(
183-
[
184-
sys.executable,
185-
"-m",
186-
"pytest",
187-
]
188-
+ argv,
189-
check=False,
190-
).returncode
175+
test_module.run_tests(
176+
module=None,
177+
args=[normalize_option(p) for p in sys.argv[1:] if p != "--installed"],
178+
)
191179
)

0 commit comments

Comments
 (0)