nextcomment #8818
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.12"] | |
timeout-minutes: 30 | |
name: Python ${{ matrix.python-version }} | |
steps: | |
- name: Checkout Pillow | |
uses: actions/checkout@v4 | |
- name: Checkout cached dependencies | |
uses: actions/checkout@v4 | |
with: | |
repository: python-pillow/pillow-depends | |
path: winbuild\depends | |
- name: Checkout extra test images | |
uses: actions/checkout@v4 | |
with: | |
repository: python-pillow/test-images | |
path: Tests\test-images | |
# 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: Install Python dependencies | |
run: > | |
python3 -m pip install | |
coverage>=7.4.2 | |
olefile | |
pyroma | |
pytest | |
pytest-cov | |
pytest-timeout | |
- 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" | |
# 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 ." | |
& $env:pythonLocation\python.exe selftest.py --installed | |
shell: pwsh | |
- 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/test_file_wmf.py | |
shell: cmd | |
- name: Upload errors | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: errors | |
path: out.png |