2019-09-23 14:12:01 +03:00
|
|
|
name: Test Windows
|
|
|
|
|
2023-03-04 16:44:56 +03:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- ".github/workflows/docs.yml"
|
2023-10-02 11:01:23 +03:00
|
|
|
- ".github/workflows/wheels*"
|
|
|
|
- ".gitmodules"
|
|
|
|
- ".travis.yml"
|
2023-03-04 16:44:56 +03:00
|
|
|
- "docs/**"
|
2023-10-02 11:01:23 +03:00
|
|
|
- "wheels/**"
|
2023-03-04 16:44:56 +03:00
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- ".github/workflows/docs.yml"
|
2023-10-02 11:01:23 +03:00
|
|
|
- ".github/workflows/wheels*"
|
|
|
|
- ".gitmodules"
|
|
|
|
- ".travis.yml"
|
2023-03-04 16:44:56 +03:00
|
|
|
- "docs/**"
|
2023-10-02 11:01:23 +03:00
|
|
|
- "wheels/**"
|
2023-03-04 16:44:56 +03:00
|
|
|
workflow_dispatch:
|
2019-09-23 14:12:01 +03:00
|
|
|
|
2022-07-04 04:19:58 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-10-25 15:34:31 +03:00
|
|
|
concurrency:
|
2022-09-26 15:16:33 +03:00
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2019-09-23 14:12:01 +03:00
|
|
|
jobs:
|
|
|
|
build:
|
2022-01-30 06:40:30 +03:00
|
|
|
runs-on: windows-latest
|
2019-09-23 14:12:01 +03:00
|
|
|
strategy:
|
2019-09-24 19:15:31 +03:00
|
|
|
fail-fast: false
|
2019-09-23 14:12:01 +03:00
|
|
|
matrix:
|
2023-11-08 14:58:58 +03:00
|
|
|
python-version: ["pypy3.10", "pypy3.9", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
2021-09-06 15:07:53 +03:00
|
|
|
|
2019-09-24 19:15:31 +03:00
|
|
|
timeout-minutes: 30
|
2019-10-14 23:22:21 +03:00
|
|
|
|
2023-06-23 14:52:00 +03:00
|
|
|
name: Python ${{ matrix.python-version }}
|
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
|
2023-09-05 00:04:29 +03:00
|
|
|
uses: actions/checkout@v4
|
2019-09-24 19:15:31 +03:00
|
|
|
|
2020-01-01 04:43:00 +03:00
|
|
|
- name: Checkout cached dependencies
|
2023-09-05 00:04:29 +03:00
|
|
|
uses: actions/checkout@v4
|
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
|
|
|
|
2023-02-08 02:53:59 +03:00
|
|
|
- name: Checkout extra test images
|
2023-09-05 00:04:29 +03:00
|
|
|
uses: actions/checkout@v4
|
2023-02-08 02:53:59 +03:00
|
|
|
with:
|
|
|
|
repository: python-pillow/test-images
|
|
|
|
path: Tests\test-images
|
|
|
|
|
2019-09-24 19:15:31 +03:00
|
|
|
# sets env: pythonLocation
|
|
|
|
- name: Set up Python
|
2022-09-24 12:50:14 +03:00
|
|
|
uses: actions/setup-python@v4
|
2019-09-24 19:15:31 +03:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2023-11-08 14:58:58 +03:00
|
|
|
allow-prereleases: true
|
2021-11-18 14:42:41 +03:00
|
|
|
cache: pip
|
|
|
|
cache-dependency-path: ".github/workflows/test-windows.yml"
|
2019-09-25 10:58:29 +03:00
|
|
|
|
2020-01-01 04:43:00 +03:00
|
|
|
- name: Print build system information
|
2022-04-18 07:37:00 +03:00
|
|
|
run: python3 .github/workflows/system-info.py
|
2019-12-09 23:35:31 +03:00
|
|
|
|
2023-10-30 01:02:29 +03:00
|
|
|
- name: python3 -m pip install pytest pytest-cov pytest-timeout defusedxml olefile pyroma
|
|
|
|
run: python3 -m pip install pytest pytest-cov pytest-timeout defusedxml olefile pyroma
|
2019-10-14 23:22:21 +03:00
|
|
|
|
2020-06-16 05:05:34 +03:00
|
|
|
- name: Install dependencies
|
2020-11-24 15:53:42 +03:00
|
|
|
id: install
|
2019-09-23 14:47:45 +03:00
|
|
|
run: |
|
2023-04-14 04:13:28 +03:00
|
|
|
7z x winbuild\depends\nasm-2.16.01-win64.zip "-o$env:RUNNER_WORKSPACE\"
|
|
|
|
echo "$env:RUNNER_WORKSPACE\nasm-2.16.01" >> $env:GITHUB_PATH
|
2019-09-27 11:18:32 +03:00
|
|
|
|
2023-03-25 03:32:22 +03:00
|
|
|
choco install ghostscript --version=10.0.0.20230317
|
|
|
|
echo "C:\Program Files\gs\gs10.00.0\bin" >> $env:GITHUB_PATH
|
2019-11-08 01:23:59 +03:00
|
|
|
|
2023-01-28 00:19:03 +03:00
|
|
|
# Install extra test images
|
2023-02-08 02:53:59 +03:00
|
|
|
xcopy /S /Y Tests\test-images\* Tests\images
|
2020-11-24 15:53:42 +03:00
|
|
|
|
|
|
|
# make cache key depend on VS version
|
2022-10-29 00:51:09 +03:00
|
|
|
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" `
|
|
|
|
| find """catalog_buildVersion""" `
|
|
|
|
| ForEach-Object { $a = $_.split(" ")[1]; echo "vs=$a" >> $env:GITHUB_OUTPUT }
|
2020-06-16 05:05:34 +03:00
|
|
|
shell: pwsh
|
|
|
|
|
|
|
|
- name: Cache build
|
|
|
|
id: build-cache
|
2022-09-24 12:50:14 +03:00
|
|
|
uses: actions/cache@v3
|
2020-06-16 05:05:34 +03:00
|
|
|
with:
|
|
|
|
path: winbuild\build
|
|
|
|
key:
|
2020-11-24 15:53:42 +03:00
|
|
|
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}-${{ steps.install.outputs.vs }}
|
2019-10-01 21:32:38 +03:00
|
|
|
|
2020-06-16 05:05:34 +03:00
|
|
|
- name: Prepare build
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
2023-06-24 17:13:26 +03:00
|
|
|
& python.exe winbuild\build_prepare.py -v
|
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
|
|
|
|
2022-09-05 12:05:18 +03:00
|
|
|
- name: Build dependencies / xz
|
2020-06-16 05:05:34 +03:00
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2022-09-05 12:05:18 +03:00
|
|
|
run: "& winbuild\\build\\build_dep_xz.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
|
|
|
|
2022-09-05 13:48:42 +03:00
|
|
|
- name: Build dependencies / LibTiff
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
|
|
run: "& winbuild\\build\\build_dep_libtiff.cmd"
|
|
|
|
|
2020-12-30 05:27:28 +03:00
|
|
|
# for FreeType CBDT/SBIX font support
|
2020-03-29 11:31:10 +03:00
|
|
|
- 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
|
|
|
|
2022-09-07 20:59:55 +03:00
|
|
|
# for FreeType WOFF2 font support
|
|
|
|
- name: Build dependencies / brotli
|
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
|
|
|
run: "& winbuild\\build\\build_dep_brotli.cmd"
|
|
|
|
|
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"
|
2019-09-24 09:41:30 +03:00
|
|
|
|
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
|
|
|
|
2020-11-25 17:02:21 +03:00
|
|
|
# Raqm dependencies
|
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
|
|
|
|
2022-12-02 13:29:27 +03:00
|
|
|
# trim ~150MB for each job
|
2020-06-16 05:05:34 +03:00
|
|
|
- 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: |
|
2023-06-24 17:13:26 +03:00
|
|
|
$FLAGS="-C raqm=vendor -C fribidi=vendor"
|
|
|
|
if ('${{ github.event_name }}' -ne 'pull_request') { $FLAGS+=" -C imagequant=disable" }
|
|
|
|
cmd /c "winbuild\build\build_env.cmd && $env:pythonLocation\python.exe -m pip install -v $FLAGS ."
|
2019-10-02 20:48:55 +03:00
|
|
|
& $env:pythonLocation\python.exe selftest.py --installed
|
|
|
|
shell: pwsh
|
2019-10-14 23:22:21 +03:00
|
|
|
|
2022-02-24 01:16:05 +03:00
|
|
|
# skip PyPy for speed
|
2019-11-02 10:57:40 +03:00
|
|
|
- name: Enable heap verification
|
|
|
|
if: "!contains(matrix.python-version, 'pypy')"
|
2022-02-24 01:16:05 +03:00
|
|
|
run: |
|
|
|
|
& reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f
|
2019-11-02 10:57:40 +03:00
|
|
|
|
2019-09-23 23:01:19 +03:00
|
|
|
- name: Test Pillow
|
2019-09-23 23:45:21 +03:00
|
|
|
run: |
|
2019-10-02 20:48:55 +03:00
|
|
|
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
|
2019-10-25 14:16:51 +03:00
|
|
|
shell: cmd
|
2019-10-14 23:22:21 +03:00
|
|
|
|
2020-01-25 05:30:21 +03:00
|
|
|
- name: Prepare to upload errors
|
|
|
|
if: failure()
|
|
|
|
run: |
|
|
|
|
mkdir -p Tests/errors
|
2021-03-08 14:21:22 +03:00
|
|
|
shell: bash
|
2020-01-25 05:30:21 +03:00
|
|
|
|
2019-10-12 13:59:03 +03:00
|
|
|
- name: Upload errors
|
2022-03-04 12:04:12 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
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
|
2022-05-07 15:50:30 +03:00
|
|
|
uses: codecov/codecov-action@v3
|
2019-12-24 11:11:46 +03:00
|
|
|
with:
|
2019-12-31 20:13:16 +03:00
|
|
|
file: ./coverage.xml
|
|
|
|
flags: GHA_Windows
|
2023-06-23 14:52:00 +03:00
|
|
|
name: ${{ runner.os }} Python ${{ matrix.python-version }}
|
2019-09-25 10:58:29 +03:00
|
|
|
|
|
|
|
- name: Build wheel
|
|
|
|
id: wheel
|
2021-12-01 13:42:11 +03:00
|
|
|
if: "github.event_name != 'pull_request'"
|
2019-09-25 10:58:29 +03:00
|
|
|
run: |
|
2023-06-23 14:52:00 +03:00
|
|
|
mkdir fribidi
|
|
|
|
copy winbuild\build\bin\fribidi* fribidi
|
2022-09-05 07:49:48 +03:00
|
|
|
setlocal EnableDelayedExpansion
|
|
|
|
for %%f in (winbuild\build\license\*) do (
|
|
|
|
set x=%%~nf
|
|
|
|
rem Skip FriBiDi license, it is not included in the wheel.
|
|
|
|
set fribidi=!x:~0,7!
|
|
|
|
if NOT !fribidi!==fribidi (
|
|
|
|
rem Skip imagequant license, it is not included in the wheel.
|
|
|
|
set libimagequant=!x:~0,13!
|
|
|
|
if NOT !libimagequant!==libimagequant (
|
|
|
|
echo. >> LICENSE
|
|
|
|
echo ===== %%~nf ===== >> LICENSE
|
|
|
|
echo. >> LICENSE
|
|
|
|
type %%f >> LICENSE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-10-29 00:51:09 +03:00
|
|
|
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo dist=dist-%%a >> %GITHUB_OUTPUT%
|
2023-06-24 17:13:26 +03:00
|
|
|
call winbuild\\build\\build_env.cmd
|
|
|
|
%pythonLocation%\python.exe -m pip wheel -v -C raqm=vendor -C fribidi=vendor -C imagequant=disable .
|
2019-10-25 14:16:51 +03:00
|
|
|
shell: cmd
|
2019-09-25 10:58:29 +03:00
|
|
|
|
2022-08-24 23:04:43 +03:00
|
|
|
- name: Upload wheel
|
|
|
|
uses: actions/upload-artifact@v3
|
2021-12-01 13:42:11 +03:00
|
|
|
if: "github.event_name != 'pull_request'"
|
2019-09-25 10:58:29 +03:00
|
|
|
with:
|
|
|
|
name: ${{ steps.wheel.outputs.dist }}
|
2023-06-24 17:13:26 +03:00
|
|
|
path: "*.whl"
|
2020-05-23 18:58:06 +03:00
|
|
|
|
2022-08-24 23:04:43 +03:00
|
|
|
- name: Upload fribidi.dll
|
2022-11-09 10:42:46 +03:00
|
|
|
if: "github.event_name != 'pull_request' && matrix.python-version == 3.11"
|
2022-08-24 23:04:43 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: fribidi
|
|
|
|
path: fribidi\*
|
|
|
|
|
2020-09-23 09:56:17 +03:00
|
|
|
success:
|
2022-07-04 04:19:58 +03:00
|
|
|
permissions:
|
|
|
|
contents: none
|
2021-09-06 15:07:53 +03:00
|
|
|
needs: build
|
2020-09-23 09:56:17 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Windows Test Successful
|
|
|
|
steps:
|
|
|
|
- name: Success
|
|
|
|
run: echo Windows Test Successful
|