marker #9729
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Windows | |
on: | |
push: | |
branches: | |
- "**" | |
paths-ignore: | |
- ".github/workflows/docs.yml" | |
- ".github/workflows/wheels*" | |
- ".gitmodules" | |
- "docs/**" | |
- "wheels/**" | |
pull_request: | |
paths-ignore: | |
- ".github/workflows/docs.yml" | |
- ".github/workflows/wheels*" | |
- ".gitmodules" | |
- "docs/**" | |
- "wheels/**" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
COVERAGE_CORE: sysmon | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.13"] | |
timeout-minutes: 30 | |
name: Python ${{ matrix.python-version }} | |
steps: | |
- name: Checkout Pillow | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Checkout cached dependencies | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
repository: python-pillow/pillow-depends | |
path: winbuild\depends | |
# sets env: pythonLocation | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
cache: pip | |
cache-dependency-path: ".github/workflows/test-windows.yml" | |
- name: Print build system information | |
run: python3 .github/workflows/system-info.py | |
- name: Upgrade pip | |
run: | | |
python3 -m pip install --upgrade pip | |
- name: Install dependencies | |
id: install | |
run: | | |
choco install nasm --no-progress | |
echo "C:\Program Files\NASM" >> $env:GITHUB_PATH | |
# 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 "vs=$a" >> $env:GITHUB_OUTPUT } | |
shell: pwsh | |
- name: Cache build | |
id: build-cache | |
uses: actions/cache@v4 | |
with: | |
path: winbuild\build | |
key: | |
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}-${{ steps.install.outputs.vs }} | |
- name: Prepare build | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: | | |
& python.exe winbuild\build_prepare.py -v | |
shell: pwsh | |
- name: Build dependencies / libjpeg-turbo | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: "& winbuild\\build\\build_dep_libjpeg.cmd" | |
- name: Build dependencies / zlib | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: "& winbuild\\build\\build_dep_zlib.cmd" | |
- name: Build dependencies / OpenJPEG | |
run: "& winbuild\\build\\build_dep_openjpeg.cmd" | |
# trim ~150MB for each job | |
- name: Optimize build cache | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: rmdir /S /Q winbuild\build\src | |
shell: cmd | |
- name: Build Pillow | |
run: | | |
$FLAGS="-C raqm=vendor -C fribidi=vendor" | |
cmd /c "winbuild\build\build_env.cmd && $env:pythonLocation\python.exe -m pip install -v $FLAGS .[tests]" | |
& $env:pythonLocation\python.exe selftest.py --installed | |
shell: pwsh | |
# skip PyPy for speed | |
- name: Enable heap verification | |
if: "!contains(matrix.python-version, 'pypy')" | |
run: | | |
& reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f | |
- name: Test Pillow | |
run: | | |
path %GITHUB_WORKSPACE%\winbuild\build\bin;%PATH% | |
.ci\test.cmd | |
shell: cmd |