forked from vapoursynth/vapoursynth
-
Notifications
You must be signed in to change notification settings - Fork 4
276 lines (247 loc) · 10.1 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
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@v4
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- 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
# revert "resize: fix off by one error in AVX-512 vertical fp resizer"
git checkout e5b0de6
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@v5
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@v5
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@v5
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@v5
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@v5
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: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13-dev'
architecture: ${{ matrix.arch }}
- name: Install Python 3.13 cython and Save Path
shell: bash
run: |
py -3.13-${{ matrix.bits }} -m pip install --upgrade pip
py -3.13-${{ matrix.bits }} -m pip install cython setuptools wheel
echo "PYTHON313_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.13 plugin
run: |
py -3.13-${{ matrix.bits }} -m pip install . --no-deps -v
- 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.13-${{ matrix.bits }} -m pip install . --no-deps -v
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 "$PYTHON313_DIR"/Lib/site-packages/vapoursynth*.pyd installer/buildp$bits
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@v4
with:
name: build-${{matrix.arch}}
if-no-files-found: error
path: build.7z
- name: Run test for Python 3.13
if: ${{ matrix.test }}
run: py -3.13-${{ matrix.bits }} -m unittest discover -s test -p "*test.py"
- 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/