-
Notifications
You must be signed in to change notification settings - Fork 1
312 lines (262 loc) · 11.5 KB
/
Release.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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: Release
on:
workflow_dispatch:
env:
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
jobs:
setup:
runs-on: ubuntu-latest
outputs:
DATE: ${{ steps.get_date.outputs.DATE }}
steps:
- name: Get current date
id: get_date
run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
macos:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.2.0"
- uses: pdm-project/setup-pdm@v3
name: Setup PDM
with:
python-version: ${{ matrix.python-version }}
architecture: x64
version: 2.11.1
prerelease: false
enable-pep582: false
allow-python-prereleases: false
update-python: true
- name: Check Python version
run: |
python --version
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v3.2.4
with:
path: "src/vulkansdk-macos-1.2.162.1"
key: vulkansdk-macos-1.2.162.1
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
cd src
wget https://github.com/Tohrusky/realcugan-ncnn-vulkan-build-macOS/releases/download/v0.0.1/vulkansdk-macos-1.2.162.1.dmg -O vulkansdk-macos-1.2.162.1.dmg
hdiutil attach vulkansdk-macos-1.2.162.1.dmg
cp -r /Volumes/vulkansdk-macos-1.2.162.1 .
rm -rf vulkansdk-macos-1.2.162.1/Applications
find vulkansdk-macos-1.2.162.1 -type f | grep -v -E 'vulkan|glslang|MoltenVK' | xargs rm
hdiutil detach /Volumes/vulkansdk-macos-1.2.162.1
- name: build-arm64
run: |
cd src
export VULKAN_SDK=`pwd`/vulkansdk-macos-1.2.162.1/macOS
mkdir build-arm64 && cd build-arm64
cmake -DUSE_STATIC_MOLTENVK=ON -DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_CROSSCOMPILING=ON -DCMAKE_SYSTEM_PROCESSOR=arm64 \
-DVulkan_INCLUDE_DIR=`pwd`/../vulkansdk-macos-1.2.162.1/MoltenVK/include \
-DVulkan_LIBRARY=`pwd`/../vulkansdk-macos-1.2.162.1/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a \
..
cmake --build . -j 4
- name: build-x86_64
run: |
cd src
export VULKAN_SDK=`pwd`/vulkansdk-macos-1.2.162.1/macOS
mkdir build-x86_64 && cd build-x86_64
cmake -DUSE_STATIC_MOLTENVK=ON -DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DCMAKE_CROSSCOMPILING=ON -DCMAKE_SYSTEM_PROCESSOR=x86_64 \
-DVulkan_INCLUDE_DIR=`pwd`/../vulkansdk-macos-1.2.162.1/MoltenVK/include \
-DVulkan_LIBRARY=`pwd`/../vulkansdk-macos-1.2.162.1/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a \
..
cmake --build . -j 4
- name: build python 3.8 wheel
if: matrix.python-version == '3.8'
run: |
lipo -create src/build-arm64/srmd_ncnn_vulkan_wrapper.cpython-38-darwin.so src/build-x86_64/srmd_ncnn_vulkan_wrapper.cpython-38-darwin.so -o src/srmd_ncnn_py/srmd_ncnn_vulkan_wrapper.cpython-38-darwin.so
pdm build --no-sdist --config-setting="--python-tag=cp38" --config-setting="--plat-name=macosx_10_15_x86_64"
- name: build python 3.9 wheel
if: matrix.python-version == '3.9'
run: |
lipo -create src/build-arm64/srmd_ncnn_vulkan_wrapper.cpython-39-darwin.so src/build-x86_64/srmd_ncnn_vulkan_wrapper.cpython-39-darwin.so -o src/srmd_ncnn_py/srmd_ncnn_vulkan_wrapper.cpython-39-darwin.so
pdm build --no-sdist --config-setting="--python-tag=cp39" --config-setting="--plat-name=macosx_11_0_universal2"
- name: build python 3.10 wheel
if: matrix.python-version == '3.10'
run: |
lipo -create src/build-arm64/srmd_ncnn_vulkan_wrapper.cpython-310-darwin.so src/build-x86_64/srmd_ncnn_vulkan_wrapper.cpython-310-darwin.so -o src/srmd_ncnn_py/srmd_ncnn_vulkan_wrapper.cpython-310-darwin.so
pdm build --no-sdist --config-setting="--python-tag=cp310" --config-setting="--plat-name=macosx_11_0_universal2"
- name: build python 3.11 wheel
if: matrix.python-version == '3.11'
run: |
lipo -create src/build-arm64/srmd_ncnn_vulkan_wrapper.cpython-311-darwin.so src/build-x86_64/srmd_ncnn_vulkan_wrapper.cpython-311-darwin.so -o src/srmd_ncnn_py/srmd_ncnn_vulkan_wrapper.cpython-311-darwin.so
pdm build --no-sdist --config-setting="--python-tag=cp311" --config-setting="--plat-name=macosx_11_0_universal2"
- name: build python 3.12 wheel
if: matrix.python-version == '3.12'
run: |
lipo -create src/build-arm64/srmd_ncnn_vulkan_wrapper.cpython-312-darwin.so src/build-x86_64/srmd_ncnn_vulkan_wrapper.cpython-312-darwin.so -o src/srmd_ncnn_py/srmd_ncnn_vulkan_wrapper.cpython-312-darwin.so
pdm build --no-sdist --config-setting="--python-tag=cp312" --config-setting="--plat-name=macosx_11_0_universal2"
- name: upload
uses: actions/upload-artifact@v3
with:
path: dist
windows:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: pdm-project/setup-pdm@v3
name: Setup PDM
with:
python-version: ${{ matrix.python-version }}
architecture: x64
version: 2.11.1
prerelease: false
enable-pep582: false
allow-python-prereleases: false
update-python: true
- name: Check Python version
run: |
python --version
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v3
with:
path: "VulkanSDK"
key: VulkanSDK-1.2.162.1-Installer
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/Tohrusky/realcugan-ncnn-vulkan-build-macOS/releases/download/v0.0.1/VulkanSDK-1.2.162.1-Installer.exe -OutFile VulkanSDK-1.2.162.1-Installer.exe
7z x -aoa ./VulkanSDK-1.2.162.1-Installer.exe -oVulkanSDK
Remove-Item .\VulkanSDK\Demos, .\VulkanSDK\Samples, .\VulkanSDK\Third-Party, .\VulkanSDK\Tools, .\VulkanSDK\Tools32, .\VulkanSDK\Bin32, .\VulkanSDK\Lib32 -Recurse
- name: Build
run: |
$env:VULKAN_SDK="$(pwd)\VulkanSDK"
$env:CMAKE_FLAGS="-DPY_VERSION=${{ matrix.python-version }}"
cd src
mkdir build && cd build
cmake -A x64 -DCMAKE_CXX_FLAGS="-frtti -fexceptions" ..
cmake --build . --config Release -j 4
- name: pre build wheel
run: |
echo F | xcopy .\src\build\Release\srmd_ncnn_vulkan_wrapper.*.pyd .\src\srmd_ncnn_py
- name: build python 3.8 wheel
if: matrix.python-version == '3.8'
run: pdm build --no-sdist --config-setting="--python-tag=cp38" --config-setting="--plat-name=win_amd64"
- name: build python 3.9 wheel
if: matrix.python-version == '3.9'
run: pdm build --no-sdist --config-setting="--python-tag=cp39" --config-setting="--plat-name=win_amd64"
- name: build python 3.10 wheel
if: matrix.python-version == '3.10'
run: pdm build --no-sdist --config-setting="--python-tag=cp310" --config-setting="--plat-name=win_amd64"
- name: build python 3.11 wheel
if: matrix.python-version == '3.11'
run: pdm build --no-sdist --config-setting="--python-tag=cp311" --config-setting="--plat-name=win_amd64"
- name: build python 3.12 wheel
if: matrix.python-version == '3.12'
run: pdm build --no-sdist --config-setting="--python-tag=cp312" --config-setting="--plat-name=win_amd64"
- name: upload
uses: actions/upload-artifact@v3
with:
path: dist
linux:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: pdm-project/setup-pdm@v3
name: Setup PDM
with:
python-version: ${{ matrix.python-version }}
architecture: x64
version: 2.11.1
prerelease: false
enable-pep582: false
allow-python-prereleases: false
update-python: true
- name: Check Python version
run: |
python --version
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v3.2.4
with:
path: "1.2.162.1"
key: vulkansdk-linux-x86_64-1.2.162.1
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
wget https://github.com/Tohrusky/realcugan-ncnn-vulkan-build-macOS/releases/download/v0.0.1/vulkansdk-linux-x86_64-1.2.162.1.tar.gz -O vulkansdk-linux-x86_64-1.2.162.1.tar.gz
tar -xf vulkansdk-linux-x86_64-1.2.162.1.tar.gz
rm -rf 1.2.162.1/source 1.2.162.1/samples
find 1.2.162.1 -type f | grep -v -E 'vulkan|glslang' | xargs rm
- name: build
env:
CC: clang
CXX: clang++
run: |
export VULKAN_SDK=`pwd`/1.2.162.1/x86_64
cd src
mkdir build && cd build
cmake -DOpenMP_CXX_FLAGS="-fexceptions -frtti" ..
cmake --build . -j 4
- name: pre build wheel
run: |
cp src/build/srmd_ncnn_vulkan_wrapper.*.so src/srmd_ncnn_py
- name: build python 3.8 wheel
if: matrix.python-version == '3.8'
run: pdm build --no-sdist --config-setting="--python-tag=cp38" --config-setting="--plat-name=manylinux1_x86_64"
- name: build python 3.9 wheel
if: matrix.python-version == '3.9'
run: pdm build --no-sdist --config-setting="--python-tag=cp39" --config-setting="--plat-name=manylinux1_x86_64"
- name: build python 3.10 wheel
if: matrix.python-version == '3.10'
run: pdm build --no-sdist --config-setting="--python-tag=cp310" --config-setting="--plat-name=manylinux1_x86_64"
- name: build python 3.11 wheel
if: matrix.python-version == '3.11'
run: pdm build --no-sdist --config-setting="--python-tag=cp311" --config-setting="--plat-name=manylinux1_x86_64"
- name: build python 3.12 wheel
if: matrix.python-version == '3.12'
run: pdm build --no-sdist --config-setting="--python-tag=cp312" --config-setting="--plat-name=manylinux1_x86_64"
- name: upload
uses: actions/upload-artifact@v3
with:
path: dist
Release:
needs: [setup, macos, windows, linux]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: asset
- name: dist
run: |
mkdir dist
cp asset/artifact/* dist
cd dist && ls
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API }}
- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v1
with:
name: Release ${{ needs.setup.outputs.DATE }}
tag_name: ${{ needs.setup.outputs.DATE }}
body: Auto Release.
draft: false
prerelease: false
files: dist/*