use powershell

This commit is contained in:
nulano 2023-01-01 04:33:09 +01:00 committed by Nulano
parent 1cbfb84652
commit fc5cd83ec0
2 changed files with 28 additions and 10 deletions

View File

@ -238,16 +238,8 @@ jobs:
- name: Test Wheel
if: "github.event_name != 'pull_request' && !contains(matrix.python-version, 'pypy')"
run: |
cd C:\pillow
python -m pip install pytest pytest-timeout
for %%f in (dist\*.whl) do python -m pip install %%f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f
path C:\pillow\winbuild\build\bin\;%PATH%
set CI=
python -m pytest -vx Tests\check_wheel.py Tests
shell: cmd /c copy {0} docker.bat && docker run --rm -v %GITHUB_WORKSPACE%:C:\pillow %DOCKER_IMAGE% C:\pillow\docker.bat
env:
DOCKER_IMAGE: winamd64/python:${{ matrix.python-version }}-windowsservercore
docker run --rm -v ${env:GITHUB_WORKSPACE}:C:\pillow mcr.microsoft.com/windows/servercore:ltsc2022 powershell C:\pillow\winbuild\test_docker.ps1 ${{ matrix.python-version }}.0 ${{ matrix.architecture }}
shell: pwsh
- name: Upload wheel
uses: actions/upload-artifact@v3

26
winbuild/test_docker.ps1 Normal file
View File

@ -0,0 +1,26 @@
param ([string]$python,[string]$arch)
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$suffix = if ($arch -eq "x64") {"-amd64"} else {""}
$url = 'https://www.python.org/ftp/python/{0}/python-{0}{1}.exe' -f ($python, $suffix)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $url -OutFile 'setup.exe'
Start-Process setup.exe -Wait -NoNewWindow -PassThru -ArgumentList @(
'/quiet',
'InstallAllUsers=0',
'TargetDir=C:\Python',
'PrependPath=1',
'Shortcuts=0',
'Include_doc=0',
'Include_pip=1',
'Include_test=0'
)
$env:CI = "true"
$env:path += ";C:\Python\;C:\pillow\winbuild\build\bin\"
cd C:\pillow
& python -VV
& python -m ensurepip
& python -m pip install pytest pytest-timeout
& python -m pip install "dist\$(Get-ChildItem dist\*.whl -Name)"
& python -m pytest -vx Tests\check_wheel.py Tests
if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }