Skip to content

.github/workflows/windows.yml: select latest Python 3.12 release #272

.github/workflows/windows.yml: select latest Python 3.12 release

.github/workflows/windows.yml: select latest Python 3.12 release #272

Workflow file for this run

name: Windows
on: [push, pull_request, workflow_dispatch]
jobs:
build-msvc:
runs-on: windows-2019
strategy:
matrix:
#arch: [x86, x64]
arch: [x64]
include:
#- arch: x86
# platform: Win32
# bits: 32
# # unable to diagnose this error during `import vapoursynth`
# # ImportError: DLL load failed while importing vapoursynth: A dynamic link library (DLL) initialization routine failed.
# test: false
- arch: x64
platform: x64
bits: 64
test: true
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Clone Dependencies
shell: bash
run: |
git clone https://github.com/vapoursynth/vsrepo --depth 1
git clone https://github.com/AmusementClub/zimg --branch v3.0
# revert the upgrade to msvc 2022 commit as we're still using 2019.
pushd zimg
git show 021ac40e5f350b19183bed25d498f437516da454 | patch -p1 -R
popd
git clone https://github.com/AviSynth/AviSynthPlus.git --depth 1
# just before the update to v143 toolset (MSVC 2022)
git clone https://github.com/sekrit-twc/libp2p
pushd libp2p
git checkout 10f88fcc811db84a2f25b4b87729d58a569b2486
popd
git clone https://github.com/microsoft/mimalloc --branch v2.0.1 --depth 1
- name: Build mimalloc
shell: cmd
run: |
cd mimalloc
msbuild ide/vs2019/mimalloc.sln /p:Configuration=Release /p:Platform=${{ matrix.arch }}
out\msvc-${{matrix.platform}}\Release\mimalloc-override-test.exe
cd ..
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
# Version range or exact version of a Python version to use, using SemVer's version range syntax.
python-version: 3.8
# The target architecture (x86, x64) of the Python interpreter.
architecture: ${{ matrix.arch }}
- name: Install Python 3.8 cython and Save Path
shell: bash
run: |
py -3.8-${{ matrix.bits }} -m pip install --upgrade pip
py -3.8-${{ matrix.bits }} -m pip install cython setuptools wheel
echo "PYTHON38_DIR=$pythonLocation" >> $GITHUB_ENV
- name: Setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: ${{ matrix.arch }}
- name: Install Python 3.9 cython and Save Path
shell: bash
run: |
py -3.9-${{ matrix.bits }} -m pip install --upgrade pip
py -3.9-${{ matrix.bits }} -m pip install cython setuptools wheel
echo "PYTHON39_DIR=$pythonLocation" >> $GITHUB_ENV
- name: Patch Python 3.9 Include Paths
run: |
$py_include_path = ((Split-Path -Path (Get-Command python.exe).Path) + "\include" )
$py_binary_path = ((Split-Path -Path (Get-Command python.exe).Path) + "\libs" )
(Get-Content -Path "msvc_project\VSScript\VSScript.vcxproj" -Raw) -replace "C:\\Program Files %28x86%29\\Python39-32\\libs",$py_binary_path | Set-Content "msvc_project\VSScript\VSScript.vcxproj"
(Get-Content -Path "msvc_project\VSScript\VSScript.vcxproj" -Raw) -replace "C:\\Program Files %28x86%29\\Python39-32\\include",$py_include_path | Set-Content "msvc_project\VSScript\VSScript.vcxproj"
(Get-Content -Path "msvc_project\VSScript\VSScript.vcxproj" -Raw) -replace "C:\\Program Files\\Python39\\libs",$py_binary_path | Set-Content "msvc_project\VSScript\VSScript.vcxproj"
(Get-Content -Path "msvc_project\VSScript\VSScript.vcxproj" -Raw) -replace "C:\\Program Files\\Python39\\include",$py_include_path | Set-Content "msvc_project\VSScript\VSScript.vcxproj"
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: ${{ matrix.arch }}
- name: Install Python 3.10 cython and Save Path
shell: bash
run: |
py -3.10-${{ matrix.bits }} -m pip install --upgrade pip
py -3.10-${{ matrix.bits }} -m pip install cython setuptools wheel
echo "PYTHON310_DIR=$pythonLocation" >> $GITHUB_ENV
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: ${{ matrix.arch }}
- name: Install Python 3.11 cython and Save Path
shell: bash
run: |
py -3.11-${{ matrix.bits }} -m pip install --upgrade pip
py -3.11-${{ matrix.bits }} -m pip install cython setuptools wheel
echo "PYTHON311_DIR=$pythonLocation" >> $GITHUB_ENV
- name: Setup Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
architecture: ${{ matrix.arch }}
- name: Install Python 3.12 cython and Save Path
shell: bash
run: |
py -3.12-${{ matrix.bits }} -m pip install --upgrade pip
py -3.12-${{ matrix.bits }} -m pip install cython setuptools wheel
echo "PYTHON312_DIR=$pythonLocation" >> $GITHUB_ENV
- name: Compile VS
run: |
msbuild msvc_project/VapourSynth.sln /t:Build /p:Configuration=Release /p:Platform=${{ matrix.platform }}
- name: Build Python 3.12 plugin
run: |
py -3.12-${{ matrix.bits }} -m pip install . --no-deps -v
- name: Build Python 3.11 plugin
run: |
py -3.11-${{ matrix.bits }} -m pip install . --no-deps -v
- name: Build Python 3.10 plugin
run: |
py -3.10-${{ matrix.bits }} -m pip install . --no-deps -v
- name: Build Python 3.9 plugin
run: |
py -3.9-${{ matrix.bits }} -m pip install . --no-deps -v
- name: Build Python 3.8 plugin
run: |
py -3.8-${{ matrix.bits }} -m pip install . --no-deps -v
- name: Build installer
run: |
pushd installer
$env:SKIP_COMPRESS="no"
$env:SKIP_WAIT="yes"
& ".\make portable.bat"
if ("${{ matrix.arch }}" -eq "x64") {
pushd buildp64
} else {
pushd buildp32
}
py -3.12-${{ matrix.bits }} -m pip install . --no-deps -v
py -3.11-${{ matrix.bits }} -m pip install . --no-deps -v
py -3.10-${{ matrix.bits }} -m pip install . --no-deps -v
py -3.9-${{ matrix.bits }} -m pip install . --no-deps -v
py -3.8-${{ matrix.bits }} -m pip install . --no-deps -v
popd
popd
- name: Build release
shell: bash
run: |
bits=${{ matrix.bits }}
arch=${{ matrix.arch }}
cp "$PYTHON312_DIR"/Lib/site-packages/vapoursynth*.pyd installer/buildp$bits
cp "$PYTHON311_DIR"/Lib/site-packages/vapoursynth*.pyd installer/buildp$bits
cp "$PYTHON310_DIR"/Lib/site-packages/vapoursynth*.pyd installer/buildp$bits
cp "$PYTHON39_DIR"/Lib/site-packages/vapoursynth*.pyd installer/buildp$bits
cp "$PYTHON38_DIR"/Lib/site-packages/vapoursynth*.pyd installer/buildp$bits
7z a -t7z -mx=3 ../build.7z .
mv ../*.7z .
mv installer/buildp$bits upload
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: build-${{matrix.arch}}
if-no-files-found: error
path: build.7z
- name: Run test for Python 3.12
if: ${{ matrix.test }}
run: py -3.12-${{ matrix.bits }} -m unittest discover -s test -p "*test.py"
- name: Run test for Python 3.11
if: ${{ matrix.test }}
run: py -3.11-${{ matrix.bits }} -m unittest discover -s test -p "*test.py"
- name: Run test for Python 3.10
if: ${{ matrix.test }}
run: py -3.10-${{ matrix.bits }} -m unittest discover -s test -p "*test.py"
- name: Run test for Python 3.9
if: ${{ matrix.test }}
run: py -3.9-${{ matrix.bits }} -m unittest discover -s test -p "*test.py"
- name: Run test for Python 3.8
if: ${{ matrix.test }}
run: py -3.8-${{ matrix.bits }} -m unittest discover -s test -p "*test.py"
- name: Install sphinx
run: |
pip install -r python-requirements.txt
- name: Build Doc
shell: cmd
run: |
set SPHINXBUILD=sphinx-build
call docs_build.bat
- name: Build release
shell: bash
run: |
set -ex
mv doc/_build/html upload/doc
- name: Setup VC commands
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.platform}}
- name: Copy VC Runtime Libraries
shell: bash
run: |
cd upload
while true; do
changed=false
for dll in *.[dD][lL][lL] *.[Ee][Xx][Ee] *.[Pp][Yy][Dd]; do
for dep in $(dumpbin -dependents "$dll" | grep -o -i '\(vc\|msvc\)[a-z0-9_-]*\.dll'); do
echo "finding $dep for $dll"
if ! test -f ./"$dep"; then
changed=true
src="$(where "$dep" | grep -i 'MSVC' | head -1)"
echo "copying $src for $dep"
test -f "$src" || exit 1
cp -f "$src" .
fi
done
done
$changed || break
done
- name: Upload release artifact
uses: actions/upload-artifact@v3
with:
name: release-${{matrix.arch}}
if-no-files-found: error
path: |
upload/