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

Test Windows with GitHub Actions #4084

Merged
merged 22 commits into from Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
211 changes: 211 additions & 0 deletions .github/workflows/test-windows.yml
@@ -0,0 +1,211 @@
name: Test Windows

on: [push, pull_request]

jobs:
build:

runs-on: windows-2016
strategy:
matrix:
python-version:
- "3.5.4"
- "3.6.8"
- "3.7.4"
nulano marked this conversation as resolved.
Show resolved Hide resolved
platform:
- name: "x86"
vars: "x86"
msbuild: "Win32"
- name: "x64"
vars: "x86_amd64"
msbuild: "x64"

name: Python ${{ matrix.python-version }} ${{ matrix.platform.name }}

steps:
- uses: actions/checkout@v1

- name: Fetch dependencies
run: |
curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip
7z x pillow-depends.zip -oc:\
mv c:\pillow-depends-master c:\pillow-depends
xcopy c:\pillow-depends\*.zip $env:GITHUB_WORKSPACE\winbuild\
xcopy c:\pillow-depends\*.tar.gz $env:GITHUB_WORKSPACE\winbuild\
xcopy /s c:\pillow-depends\test_images\* $env:GITHUB_WORKSPACE\tests\images\
cd $env:GITHUB_WORKSPACE/winbuild/
python.exe $env:GITHUB_WORKSPACE\winbuild\build_dep.py
# .\build_deps.cmd
env:
PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }}
EXECUTABLE: bin\python.exe
shell: pwsh

- name: Build dependencies / libjpeg
run: |
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\jpeg-9c
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
echo on
nmake -nologo -f makefile.vc setup-vc6
nmake -nologo -f makefile.vc clean
nmake -nologo -f makefile.vc nodebug=1 libjpeg.lib
copy /Y /B j*.h %INCLIB%
copy /Y /B *.lib %INCLIB%

- name: Build dependencies / zlib
run: |
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\zlib-1.2.11
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
echo on
nmake -nologo -f win32\Makefile.msc clean
nmake -nologo -f win32\Makefile.msc zlib.lib
copy /Y /B z*.h %INCLIB%
copy /Y /B *.lib %INCLIB%
copy /Y /B zlib.lib %INCLIB%\z.lib

- name: Build dependencies / libtiff
nulano marked this conversation as resolved.
Show resolved Hide resolved
run: |
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\tiff-4.0.10
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
echo on
copy %GITHUB_WORKSPACE%\winbuild\nmake.opt nmake.opt
nmake -nologo -f makefile.vc clean
nmake -nologo -f makefile.vc lib
copy /Y /B libtiff\tiff*.h %INCLIB%
copy /Y /B libtiff\*.dll %INCLIB%
copy /Y /B libtiff\*.lib %INCLIB%

- name: Build dependencies / webp
nulano marked this conversation as resolved.
Show resolved Hide resolved
run: |
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\libwebp-1.0.3
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
echo on
rmdir /S /Q output\release-static
nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output ARCH=${{ matrix.platform.name }} all
mkdir %INCLIB%\webp
copy /Y /B src\webp\*.h %INCLIB%\webp
copy /Y /B output\release-static\${{ matrix.platform.name }}\lib\* %INCLIB%

- name: Build dependencies / freetype
nulano marked this conversation as resolved.
Show resolved Hide resolved
run: |
REM Toolkit v100 not available; missing VCTargetsPath; Clean fails

set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\freetype-2.10.1
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
echo on
rmdir /S /Q objs
set DefaultPlatformToolset=v140
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets
set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe"
%MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release" /p:Platform=${{ matrix.platform.msbuild }} /m
xcopy /Y /E /Q include %INCLIB%
copy /Y /B objs\${{ matrix.platform.msbuild }}\Release\freetype.dll %INCLIB%
copy /Y /B objs\${{ matrix.platform.msbuild }}\Release\freetype.lib %INCLIB%

- name: Build dependencies / lcms2
nulano marked this conversation as resolved.
Show resolved Hide resolved
if: false
run: |
REM Projects\VC2015\lcms2.sln is not available in lcms2-2.7

set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\lcms2-2.7
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
echo on
rmdir /S /Q Lib
rmdir /S /Q Projects\VC2015\Release
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets
set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe"
%MSBUILD% Projects\VC2015\lcms2.sln /t:Clean;lcms2_static /p:Configuration="Release" /p:Platform=${{ matrix.platform.msbuild }} /m
xcopy /Y /E /Q include %INCLIB%
copy /Y /B Lib\MS\*.lib %INCLIB%

- name: Build dependencies / openjpeg
nulano marked this conversation as resolved.
Show resolved Hide resolved
run: |
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\openjpeg-2.3.1msvcr10-x32
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
echo on
cmake.exe -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" .
nmake -nologo -f Makefile clean
nmake -nologo -f Makefile
mkdir %INCLIB%\openjpeg-2.3.1
copy /Y /B src\lib\openjp2\*.h %INCLIB%\openjpeg-2.3.1
copy /Y /B bin\*.lib %INCLIB%

- name: Build dependencies / ghostscript
run: |
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\ghostscript-9.27
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
echo on
set MSVC_VERSION=14
set RCOMP="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\RC.Exe"
if "${{ matrix.platform.name }}"=="x64" set WIN64=""
nmake -nologo -f psi\msvc.mak
rem Add bin to PATH variable: Copy to INCLIB, then add INCLIB to PATH in Test step.
copy /Y /B bin\* %INCLIB%

- name: Build Pillow
run: |
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set MPLSRC=%GITHUB_WORKSPACE%
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
cd /D %GITHUB_WORKSPACE%
set DISTUTILS_USE_SDK=1
set LIB=%INCLIB%;%PYTHON%\tcl
set INCLUDE=%INCLIB%;%GITHUB_WORKSPACE%\depends\tcl86\include;%INCLUDE%
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1
set BLDOPT=install
%PYTHON%\%EXECUTABLE% setup.py build_ext --add-imaging-libs=msvcrt install
%PYTHON%\%EXECUTABLE% -c "from PIL import _webp;import os, shutil;shutil.copy(r'%INCLIB%\freetype.dll', os.path.dirname(_webp.__file__));"
%PYTHON%\%EXECUTABLE% selftest.py --installed
env:
PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }}
EXECUTABLE: python.exe

- name: pip install pytest pytest-cov codecov
run: '%PYTHON%\%PIP% install pytest pytest-cov codecov'
env:
PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }}
PIP: Scripts\pip.exe

- name: Test Pillow
run: |
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
rem Add GhostScript executables (copied to INCLIB) to PATH.
path %INCLIB%;%PATH%
cd /D %GITHUB_WORKSPACE%
%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests
env:
PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }}
EXECUTABLE: python.exe

- name: Upload coverage
run: |
cd /D %GITHUB_WORKSPACE%
%PYTHON%\%CODECOV% --file coverage.xml --name %PYTHON%
env:
PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }}
CODECOV: Scripts\codecov.exe

2 changes: 1 addition & 1 deletion winbuild/build.py
Expand Up @@ -127,7 +127,7 @@ def build_one(py_ver, compiler, bit):
setlocal
set LIB=%%LIB%%;C:\Python%(py_ver)s\tcl%(vc_setup)s
call %(python_path)s\%(executable)s setup.py %(imaging_libs)s %%BLDOPT%%
call %(python_path)s\%(executable)s -c "from PIL import _webp;import os, shutil;shutil.copy('%%INCLIB%%\\freetype.dll', os.path.dirname(_webp.__file__));"
call %(python_path)s\%(executable)s -c "from PIL import _webp;import os, shutil;shutil.copy(r'%%INCLIB%%\freetype.dll', os.path.dirname(_webp.__file__));"
endlocal

endlocal
Expand Down
5 changes: 5 additions & 0 deletions winbuild/config.py
Expand Up @@ -4,11 +4,16 @@
PILLOW_DEPENDS_DIR = "C:\\pillow-depends\\"

pythons = {
# for AppVeyor
"27": {"compiler": 7, "vc": 2010},
"pypy2": {"compiler": 7, "vc": 2010},
"35": {"compiler": 7.1, "vc": 2015},
"36": {"compiler": 7.1, "vc": 2015},
"37": {"compiler": 7.1, "vc": 2015},
# for GitHub Actions
"3.5": {"compiler": 7.1, "vc": 2015},
"3.6": {"compiler": 7.1, "vc": 2015},
"3.7": {"compiler": 7.1, "vc": 2015},
}

VIRT_BASE = "c:/vp/"
Expand Down