Pillow/.github/workflows/test-windows.yml
2020-04-12 11:52:26 +10:00

169 lines
5.4 KiB
YAML

name: Test Windows
on: [push, pull_request]
jobs:
build:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
python-version: ["3.5", "3.6", "3.7", "3.8", "pypy3"]
architecture: ["x86", "x64"]
include:
- architecture: "x86"
platform-vcvars: "x86"
platform-msbuild: "Win32"
- architecture: "x64"
platform-vcvars: "x86_amd64"
platform-msbuild: "x64"
exclude:
# PyPy does not support 64-bit on Windows
- python-version: "pypy3"
architecture: "x64"
timeout-minutes: 30
name: Python ${{ matrix.python-version }} ${{ matrix.architecture }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v1
with:
repository: python-pillow/pillow-depends
ref: master
- name: Cache
uses: actions/cache@v1
with:
path: ~\AppData\Local\pip\Cache
key:
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }}-${{ hashFiles('**/.github/workflows/test-windows.yml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }}-
${{ runner.os }}-${{ matrix.python-version }}-
# sets env: pythonLocation
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Build system information
run: python .github/workflows/system-info.py
- name: pip install wheel pytest pytest-cov
run: |
"%pythonLocation%\python.exe" -m pip install wheel pytest pytest-cov
shell: cmd
- name: Prepare dependencies
run: |
7z x ..\pillow-depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\"
Write-Host "::add-path::$env:RUNNER_WORKSPACE\nasm-2.14.02"
..\pillow-depends\gs950w32.exe /S
Write-Host "::add-path::C:\Program Files (x86)\gs\gs9.50\bin"
mkdir $env:GITHUB_WORKSPACE\winbuild\depends\
xcopy ..\pillow-depends\*.zip $env:GITHUB_WORKSPACE\winbuild\depends\
xcopy ..\pillow-depends\*.tar.gz $env:GITHUB_WORKSPACE\winbuild\depends\
xcopy /s ..\pillow-depends\test_images\* $env:GITHUB_WORKSPACE\tests\images\
$env:PYTHON=$env:pythonLocation
cd $env:GITHUB_WORKSPACE/winbuild/
& python.exe $env:GITHUB_WORKSPACE\winbuild\build_prepare.py
shell: pwsh
- name: Build dependencies / libjpeg
run: "& .\\winbuild\\build_dep_libjpeg.cmd"
- name: Build dependencies / zlib
run: "& .\\winbuild\\build_dep_zlib.cmd"
- name: Build dependencies / LibTiff
run: "& .\\winbuild\\build_dep_libtiff.cmd"
- name: Build dependencies / WebP
run: "& .\\winbuild\\build_dep_libwebp.cmd"
- name: Build dependencies / FreeType
run: "& .\\winbuild\\build_dep_freetype.cmd"
- name: Build dependencies / LCMS2
run: "& .\\winbuild\\build_dep_lcms2.cmd"
- name: Build dependencies / OpenJPEG
run: "& .\\winbuild\\build_dep_openjpeg.cmd"
# GPL licensed; skip if building wheels
- name: Build dependencies / libimagequant
if: "github.event_name != 'push' || contains(matrix.python-version, 'pypy')"
run: "& .\\winbuild\\build_dep_libimagequant.cmd"
# Raqm dependencies
- name: Build dependencies / HarfBuzz
run: "& .\\winbuild\\build_dep_harfbuzz.cmd"
- name: Build dependencies / FriBidi
run: "& .\\winbuild\\build_dep_fribidi.cmd"
- name: Build dependencies / Raqm
run: "& .\\winbuild\\build_dep_libraqm.cmd"
- name: Build Pillow
run: |
cd $env:GITHUB_WORKSPACE
& winbuild\build_pillow.cmd install
& $env:pythonLocation\python.exe selftest.py --installed
shell: pwsh
# failing with PyPy3
- name: Enable heap verification
if: "!contains(matrix.python-version, 'pypy')"
run: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x86\\gflags.exe' /p /enable $env:pythonLocation\\python.exe"
- name: Test Pillow
run: |
path %GITHUB_WORKSPACE%\\winbuild\\build\\bin;%PATH%
python.exe -m pytest -vx -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests
shell: cmd
- name: Prepare to upload errors
if: failure()
run: |
mkdir -p Tests/errors
shell: pwsh
- name: Upload errors
uses: actions/upload-artifact@v1
if: failure()
with:
name: errors
path: Tests/errors
- name: After success
run: |
.ci/after_success.sh
shell: pwsh
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: GHA_Windows
name: ${{ runner.os }} Python ${{ matrix.python-version }}
- name: Build wheel
id: wheel
if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')"
run: |
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a
%GITHUB_WORKSPACE%\\winbuild\\build_pillow.cmd bdist_wheel"
shell: cmd
- uses: actions/upload-artifact@v1
if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')"
with:
name: ${{ steps.wheel.outputs.dist }}
path: dist
# - uses: actions/upload-artifact@v1
# if: matrix.architecture == 'x86'
# with:
# name: lib
# path: "winbuild\\build\\3.x\\x86\\lib"