GHA: test windows wheels in Docker

This commit is contained in:
nulano 2023-01-01 03:18:30 +01:00 committed by Nulano
parent 4ecf1df4ea
commit 1cbfb84652
3 changed files with 40 additions and 0 deletions

View File

@ -235,6 +235,20 @@ jobs:
%pythonLocation%\python.exe -m pip wheel -v -C raqm=vendor -C fribidi=vendor -C imagequant=disable .
shell: cmd
- name: Test Wheel
if: "github.event_name != 'pull_request' && !contains(matrix.python-version, 'pypy')"
run: |
cd C:\pillow
python -m pip install pytest pytest-timeout
for %%f in (dist\*.whl) do python -m pip install %%f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f
path C:\pillow\winbuild\build\bin\;%PATH%
set CI=
python -m pytest -vx Tests\check_wheel.py Tests
shell: cmd /c copy {0} docker.bat && docker run --rm -v %GITHUB_WORKSPACE%:C:\pillow %DOCKER_IMAGE% C:\pillow\docker.bat
env:
DOCKER_IMAGE: winamd64/python:${{ matrix.python-version }}-windowsservercore
- name: Upload wheel
uses: actions/upload-artifact@v3
if: "github.event_name != 'pull_request'"

24
Tests/check_wheel.py Normal file
View File

@ -0,0 +1,24 @@
import sys
import pytest
from PIL import features
@pytest.mark.skipif(sys.platform != "win32", reason="requires Windows")
def test_windows_wheel_features():
expected_modules = ["pil", "tkinter", "freetype2", "littlecms2", "webp"]
expected_codecs = ["jpg", "jpg_2000", "zlib", "libtiff"]
expected_features = [
"webp_anim",
"webp_mux",
"transp_webp",
"raqm",
"fribidi",
"harfbuzz",
"libjpeg_turbo",
]
assert features.get_supported_modules() == expected_modules
assert features.get_supported_codecs() == expected_codecs
assert features.get_supported_features() == expected_features

View File

@ -15,6 +15,8 @@ class TestImageGrab:
sys.platform not in ("win32", "darwin"), reason="requires Windows or macOS"
)
def test_grab(self):
if os.environ.get("USERNAME", "") == "ContainerAdministrator":
pytest.skip("can't grab screen when running in Docker")
ImageGrab.grab()
ImageGrab.grab(include_layered_windows=True)
ImageGrab.grab(all_screens=True)