Skip to content
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

Move MSYS2 to GitHub Actions #4642

Merged
merged 10 commits into from
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ environment:
- PYTHON: C:/Python38-x64
- PYTHON: C:/Python35
- PYTHON: C:/Python35-x64
- PYTHON: C:/msys64/mingw32
EXECUTABLE: bin/python3
PIP_DIR: bin
TEST_OPTIONS: --processes=0
DEPLOY: NO
- PYTHON: C:/vp/pypy3
EXECUTABLE: bin/pypy.exe
VENV: YES
Expand All @@ -41,33 +36,17 @@ install:
c:\pillow\winbuild\appveyor_install_pypy3.cmd
}
- ps: |
if ($env:PYTHON -eq "c:/msys64/mingw32")
{
c:\msys64\usr\bin\bash -l -c c:\\pillow\\winbuild\\appveyor_install_msys2_deps.sh
}
else
{
c:\python37\python.exe c:\pillow\winbuild\build_dep.py
c:\pillow\winbuild\build_deps.cmd
$host.SetShouldExit(0)
}
- curl -fsSL -o gs952.exe https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs952/gs952w32.exe
- gs952.exe /S
- path %path%;C:\Program Files (x86)\gs\gs9.52\bin

build_script:
- ps: |
if ($env:PYTHON -eq "c:/msys64/mingw32")
{
c:\msys64\usr\bin\bash -l -c c:\\pillow\\winbuild\\appveyor_build_msys2.sh
Write-Host "through install"
$host.SetShouldExit(0)
}
else
{
& $env:PYTHON/$env:EXECUTABLE c:\pillow\winbuild\build.py
$host.SetShouldExit(0)
}
- cd c:\pillow
- '%PYTHON%\%EXECUTABLE% selftest.py --installed'

Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,80 @@ jobs:
with:
name: ${{ steps.wheel.outputs.dist }}
path: dist

msys:
runs-on: windows-2019

strategy:
fail-fast: false
matrix:
mingw: ["MINGW32", "MINGW64"]
include:
- mingw: "MINGW32"
package: "mingw-w64-i686"
- mingw: "MINGW64"
package: "mingw-w64-x86_64"

defaults:
run:
shell: bash.exe --login "{0}"
env:
MSYSTEM: ${{ matrix.mingw }}
CHERE_INVOKING: 1

timeout-minutes: 30
name: MSYS2 ${{ matrix.mingw }}

steps:
- uses: actions/checkout@v2

- name: Set up shell
run: echo ::add-path::C:\msys64\usr\bin\
shell: pwsh

- name: Install Dependencies
run: |
pacman -S --noconfirm \
${{ matrix.package }}-python3-pip \
${{ matrix.package }}-python3-setuptools \
${{ matrix.package }}-python3-pytest \
${{ matrix.package }}-python3-pytest-cov \
${{ matrix.package }}-python3-cffi \
${{ matrix.package }}-python3-olefile \
${{ matrix.package }}-python3-numpy \
${{ matrix.package }}-python3-pyqt5 \
${{ matrix.package }}-python3-numpy \
${{ matrix.package }}-freetype \
${{ matrix.package }}-lcms2 \
${{ matrix.package }}-libwebp \
${{ matrix.package }}-libjpeg-turbo \
${{ matrix.package }}-openjpeg2 \
${{ matrix.package }}-libimagequant \
${{ matrix.package }}-libraqm \
${{ matrix.package }}-ghostscript \
subversion

python3 -m pip install pyroma

pushd depends && ./install_extra_test_images.sh && popd

- name: Build Pillow
run: |
# libtiff is unable to open files
python3 setup.py build_ext --disable-tiff install

- name: Test Pillow
run: |
python3 selftest.py --installed
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests

- name: After success
run: |
.ci/after_success.sh

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: GHA_Windows
name: MSYS2 ${{ matrix.mingw }}
6 changes: 6 additions & 0 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ def is_pypy():
return hasattr(sys, "pypy_translation_info")


def is_mingw():
import sysconfig
nulano marked this conversation as resolved.
Show resolved Hide resolved

return sysconfig.get_platform() == "mingw"


if sys.platform == "win32":
IMCONVERT = os.environ.get("MAGICK_HOME", "")
if IMCONVERT:
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_imagefont.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
assert_image_equal,
assert_image_similar,
assert_image_similar_tofile,
is_mingw,
is_pypy,
is_win32,
skip_unless_feature,
Expand Down Expand Up @@ -660,6 +661,7 @@ def test_variation_get(self):
{"name": b"Size", "minimum": 0, "maximum": 300, "default": 0}
]

@pytest.mark.skipif(is_mingw(), reason="epsilon too high for meaningful test")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what is causing the difference, but I am getting epsilon around 33 for both variation tests. Checking manually, I see there is a significantly different kerning after the first letter, but the output looks correct to me.

Note: MSYS2 is currently using FreeType version 2.10.2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you attach images for each case?

Copy link
Contributor Author

@nulano nulano May 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

test_variation_set_by_name (epsilon 31.5340 on line 686 of PR):
a.png (MSYS):
a

b.png (target - variation_adobe.png):
b

test_variation_set_by_axes (epsilon 39.6856 on line 720 of PR):
a.png (MSYS):
a

b.png (target - variation_adobe_axes.png):
b

Basic and Raqm layout are pixel identical. In fact, it looks like there is a bug in the tests where the used layout_engine is not being explicitly set and defaults to Raqm in both cases.

def test_variation_set_by_name(self):
font = self.get_font()

Expand Down Expand Up @@ -692,6 +694,7 @@ def _check_text(font, path, epsilon):
font.set_variation_by_name(name)
_check_text(font, "Tests/images/variation_tiny_name.png", 40)

@pytest.mark.skipif(is_mingw(), reason="epsilon too high for meaningful test")
def test_variation_set_by_axes(self):
font = self.get_font()

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_imagefontctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_complex_unicode_text():

target = "Tests/images/test_complex_unicode_text2.png"
with Image.open(target) as target_img:
assert_image_similar(im, target_img, 2.3)
assert_image_similar(im, target_img, 2.33)


def test_text_direction_rtl():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ def build_extensions(self):
if feature.jpeg2000:
libs.append(feature.jpeg2000)
defs.append(("HAVE_OPENJPEG", None))
if sys.platform == "win32":
if sys.platform == "win32" and not PLATFORM_MINGW:
defs.append(("OPJ_STATIC", None))
if feature.zlib:
libs.append(feature.zlib)
Expand Down
11 changes: 8 additions & 3 deletions src/_imagingft.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#define KEEP_PY_UNICODE

#if !defined(_MSC_VER)
#ifndef _WIN32
#include <dlfcn.h>
#endif

Expand Down Expand Up @@ -155,20 +155,25 @@ setraqm(void)
p_raqm.raqm = NULL;

/* Microsoft needs a totally different system */
#if !defined(_MSC_VER)
#ifndef _WIN32
p_raqm.raqm = dlopen("libraqm.so.0", RTLD_LAZY);
if (!p_raqm.raqm) {
p_raqm.raqm = dlopen("libraqm.dylib", RTLD_LAZY);
}
#else
p_raqm.raqm = LoadLibrary("libraqm");

/* Cygwin / MinGW */
if (!p_raqm.raqm) {
p_raqm.raqm = LoadLibrary("libraqm-0");
}
#endif

if (!p_raqm.raqm) {
return 1;
}

#if !defined(_MSC_VER)
#ifndef _WIN32
p_raqm.version_atleast = (t_raqm_version_atleast)dlsym(p_raqm.raqm, "raqm_version_atleast");
p_raqm.create = (t_raqm_create)dlsym(p_raqm.raqm, "raqm_create");
p_raqm.set_text = (t_raqm_set_text)dlsym(p_raqm.raqm, "raqm_set_text");
Expand Down