Pillow/.github/workflows/test-windows.yml

292 lines
9.4 KiB
YAML
Raw Normal View History

2019-09-23 14:12:01 +03:00
name: Test Windows
on: [push, pull_request]
jobs:
build:
2019-11-03 00:01:26 +03:00
runs-on: windows-2019
2019-09-23 14:12:01 +03:00
strategy:
fail-fast: false
2019-09-23 14:12:01 +03:00
matrix:
2020-12-17 18:23:12 +03:00
python-version: ["pypy-3.6", "pypy-3.7", "3.6", "3.7", "3.8", "3.9", "3.10-dev"]
architecture: ["x86", "x64"]
include:
- architecture: "x86"
platform-vcvars: "x86"
platform-msbuild: "Win32"
- architecture: "x64"
platform-vcvars: "x86_amd64"
platform-msbuild: "x64"
exclude:
2020-01-25 22:03:26 +03:00
# PyPy does not support 64-bit on Windows
2020-12-17 18:23:12 +03:00
- python-version: "pypy-3.6"
architecture: "x64"
- python-version: "pypy-3.7"
architecture: "x64"
timeout-minutes: 30
2019-10-14 23:22:21 +03:00
name: Python ${{ matrix.python-version }} ${{ matrix.architecture }}
2019-10-14 23:22:21 +03:00
2019-09-23 14:12:01 +03:00
steps:
2020-01-01 04:43:00 +03:00
- name: Checkout Pillow
2020-03-29 21:18:39 +03:00
uses: actions/checkout@v2
2020-01-01 04:43:00 +03:00
- name: Checkout cached dependencies
2020-03-29 21:18:39 +03:00
uses: actions/checkout@v2
2019-11-20 21:20:01 +03:00
with:
repository: python-pillow/pillow-depends
2020-03-29 21:18:39 +03:00
path: winbuild\depends
2019-11-20 21:20:01 +03:00
2020-01-01 04:43:00 +03:00
- name: Cache pip
2020-06-16 05:05:34 +03:00
uses: actions/cache@v2
2019-11-17 14:51:42 +03:00
with:
path: ~\AppData\Local\pip\Cache
key:
2019-11-19 12:55:49 +03:00
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }}-${{ hashFiles('**/.github/workflows/test-windows.yml') }}
2019-11-17 14:51:42 +03:00
restore-keys: |
2019-11-19 12:55:49 +03:00
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }}-
2019-11-17 14:51:42 +03:00
${{ runner.os }}-${{ matrix.python-version }}-
# sets env: pythonLocation
- name: Set up Python
2020-06-30 22:01:19 +03:00
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
2019-09-25 10:58:29 +03:00
2020-01-01 04:43:00 +03:00
- name: Print build system information
run: python .github/workflows/system-info.py
2020-10-29 14:41:29 +03:00
- name: python -m pip install wheel pytest pytest-cov
2020-01-01 04:43:00 +03:00
run: python -m pip install wheel pytest pytest-cov
2019-10-14 23:22:21 +03:00
# TODO Remove when 3.8 / 3.9 includes setuptools 49.3.2+:
- name: Upgrade setuptools
if: "contains(matrix.python-version, '3.8') || contains(matrix.python-version, '3.9')"
run: python -m pip install -U "setuptools>=49.3.2"
2020-06-16 05:05:34 +03:00
- name: Install dependencies
id: install
2019-09-23 14:47:45 +03:00
run: |
2020-03-29 21:18:39 +03:00
7z x winbuild\depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\"
2020-10-06 18:07:55 +03:00
echo "$env:RUNNER_WORKSPACE\nasm-2.14.02" >> $env:GITHUB_PATH
2019-09-27 11:18:32 +03:00
2020-10-01 15:06:09 +03:00
winbuild\depends\gs9533w32.exe /S
2020-10-06 18:07:55 +03:00
echo "C:\Program Files (x86)\gs\gs9.53.3\bin" >> $env:GITHUB_PATH
2019-11-08 01:23:59 +03:00
xcopy /S /Y winbuild\depends\test_images\* Tests\images\
# make cache key depend on VS version
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" | find """catalog_buildVersion""" | ForEach-Object { $a = $_.split(" ")[1]; echo "::set-output name=vs::$a" }
2020-06-16 05:05:34 +03:00
shell: pwsh
- name: Cache build
id: build-cache
uses: actions/cache@v2
with:
path: winbuild\build
key:
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}-${{ steps.install.outputs.vs }}
2020-06-16 05:05:34 +03:00
- name: Prepare build
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
& python.exe winbuild\build_prepare.py -v --python=$env:pythonLocation --srcdir
2019-09-23 14:47:45 +03:00
shell: pwsh
2019-09-27 11:18:32 +03:00
- name: Build dependencies / libjpeg-turbo
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_libjpeg.cmd"
2020-11-21 17:07:31 +03:00
2019-09-23 14:47:45 +03:00
- name: Build dependencies / zlib
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_zlib.cmd"
2020-11-21 17:07:31 +03:00
- name: Build dependencies / LibTiff
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_libtiff.cmd"
2020-11-21 17:07:31 +03:00
2019-09-25 12:28:52 +03:00
- name: Build dependencies / WebP
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_libwebp.cmd"
2020-11-21 17:07:31 +03:00
# for FreeType CBDT font support
- name: Build dependencies / libpng
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libpng.cmd"
2020-11-21 17:07:31 +03:00
2019-09-25 12:28:52 +03:00
- name: Build dependencies / FreeType
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_freetype.cmd"
2020-11-21 17:07:31 +03:00
2019-09-25 12:28:52 +03:00
- name: Build dependencies / LCMS2
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_lcms2.cmd"
2020-11-21 17:07:31 +03:00
2019-09-25 12:28:52 +03:00
- name: Build dependencies / OpenJPEG
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_openjpeg.cmd"
2020-06-21 13:32:37 +03:00
# GPL licensed
2019-09-27 13:37:54 +03:00
- name: Build dependencies / libimagequant
2020-06-21 13:32:37 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_libimagequant.cmd"
2019-09-27 13:37:54 +03:00
2019-12-31 20:13:16 +03:00
# Raqm dependencies
2019-09-30 02:04:26 +03:00
- name: Build dependencies / HarfBuzz
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_harfbuzz.cmd"
2020-11-21 17:07:31 +03:00
2019-09-30 02:04:26 +03:00
- name: Build dependencies / FriBidi
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_fribidi.cmd"
2020-11-21 17:07:31 +03:00
2019-09-30 11:37:46 +03:00
- name: Build dependencies / Raqm
2020-06-16 05:05:34 +03:00
if: steps.build-cache.outputs.cache-hit != 'true'
2020-01-01 04:43:00 +03:00
run: "& winbuild\\build\\build_dep_libraqm.cmd"
2019-09-30 11:37:46 +03:00
2020-06-16 05:05:34 +03:00
# trim ~150MB x 9
- name: Optimize build cache
if: steps.build-cache.outputs.cache-hit != 'true'
run: rmdir /S /Q winbuild\build\src
shell: cmd
2019-09-23 23:01:19 +03:00
- name: Build Pillow
run: |
2020-06-21 13:32:37 +03:00
$FLAGS=""
if ('${{ github.event_name }}' -eq 'push') { $FLAGS="--disable-imagequant" }
& winbuild\build\build_pillow.cmd $FLAGS install
& $env:pythonLocation\python.exe selftest.py --installed
shell: pwsh
2019-10-14 23:22:21 +03:00
# failing with PyPy3
- name: Enable heap verification
if: "!contains(matrix.python-version, 'pypy')"
2019-12-31 20:13:16 +03:00
run: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x86\\gflags.exe' /p /enable $env:pythonLocation\\python.exe"
2019-09-23 23:01:19 +03:00
- name: Test Pillow
2019-09-23 23:45:21 +03:00
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
2019-10-14 23:22:21 +03:00
- name: Prepare to upload errors
if: failure()
run: |
mkdir -p Tests/errors
shell: pwsh
2019-10-12 13:59:03 +03:00
- name: Upload errors
2020-06-30 22:01:19 +03:00
uses: actions/upload-artifact@v2
2019-10-12 13:59:03 +03:00
if: failure()
with:
name: errors
path: Tests/errors
2020-01-19 15:45:41 +03:00
- name: After success
run: |
.ci/after_success.sh
2020-01-19 22:20:13 +03:00
shell: pwsh
2020-01-19 15:45:41 +03:00
2019-09-23 23:45:21 +03:00
- name: Upload coverage
2019-12-24 11:11:46 +03:00
uses: codecov/codecov-action@v1
with:
2019-12-31 20:13:16 +03:00
file: ./coverage.xml
flags: GHA_Windows
2020-01-01 03:48:13 +03:00
name: ${{ runner.os }} Python ${{ matrix.python-version }} ${{ matrix.architecture }}
2019-09-25 10:58:29 +03:00
- name: Build wheel
id: wheel
if: "github.event_name == 'push'"
2019-09-25 10:58:29 +03:00
run: |
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a
2020-06-21 13:32:37 +03:00
winbuild\\build\\build_pillow.cmd --disable-imagequant bdist_wheel
shell: cmd
2019-09-25 10:58:29 +03:00
- uses: actions/upload-artifact@v2
if: "github.event_name == 'push'"
2019-09-25 10:58:29 +03:00
with:
name: ${{ steps.wheel.outputs.dist }}
2020-03-29 21:18:39 +03:00
path: dist\*.whl
2020-05-23 18:58:06 +03:00
msys:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
mingw: ["MINGW32", "MINGW64"]
include:
- mingw: "MINGW32"
2020-08-30 07:09:42 +03:00
name: "MSYS2 MinGW 32-bit"
package: "mingw-w64-i686"
- mingw: "MINGW64"
2020-08-30 07:09:42 +03:00
name: "MSYS2 MinGW 64-bit"
package: "mingw-w64-x86_64"
2020-05-23 18:58:06 +03:00
defaults:
run:
2020-05-26 18:23:27 +03:00
shell: bash.exe --login -eo pipefail "{0}"
2020-05-23 18:58:06 +03:00
env:
MSYSTEM: ${{ matrix.mingw }}
2020-05-23 18:58:06 +03:00
CHERE_INVOKING: 1
timeout-minutes: 30
2020-08-30 07:09:42 +03:00
name: ${{ matrix.name }}
2020-05-23 18:58:06 +03:00
steps:
- uses: actions/checkout@v2
2020-05-23 21:06:09 +03:00
- name: Set up shell
2020-10-06 18:07:55 +03:00
run: echo "C:\msys64\usr\bin\" >> $env:GITHUB_PATH
2020-05-23 18:58:06 +03:00
shell: pwsh
2020-05-23 21:06:09 +03:00
- name: Install Dependencies
2020-05-23 18:58:06 +03:00
run: |
pacman -S --noconfirm \
${{ matrix.package }}-python3-cffi \
${{ matrix.package }}-python3-numpy \
${{ matrix.package }}-python3-olefile \
${{ matrix.package }}-python3-pip \
${{ matrix.package }}-python3-pyqt5 \
${{ matrix.package }}-python3-pytest \
${{ matrix.package }}-python3-pytest-cov \
${{ matrix.package }}-python3-setuptools \
${{ matrix.package }}-freetype \
${{ matrix.package }}-ghostscript \
${{ matrix.package }}-lcms2 \
${{ matrix.package }}-libimagequant \
${{ matrix.package }}-libjpeg-turbo \
${{ matrix.package }}-libraqm \
2020-08-31 16:18:39 +03:00
${{ matrix.package }}-libtiff \
${{ matrix.package }}-libwebp \
${{ matrix.package }}-openjpeg2 \
2020-05-23 21:06:09 +03:00
subversion
python3 -m pip install pyroma
pushd depends && ./install_extra_test_images.sh && popd
2020-05-23 18:58:06 +03:00
- name: Build Pillow
2020-08-30 05:30:47 +03:00
run: CFLAGS="-coverage" python3 setup.py build_ext install
2020-05-23 18:58:06 +03:00
- name: Test Pillow
run: |
python3 selftest.py --installed
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
2020-05-23 20:41:37 +03:00
- name: Upload coverage
2020-05-24 04:25:27 +03:00
run: |
python3 -m pip install codecov
bash <(curl -s https://codecov.io/bash) -F GHA_Windows
env:
2020-08-30 07:09:42 +03:00
CODECOV_NAME: ${{ matrix.name }}
success:
needs: [build, msys]
runs-on: ubuntu-latest
name: Windows Test Successful
steps:
- name: Success
run: echo Windows Test Successful