forked from nihui/rife-ncnn-vulkan
-
Notifications
You must be signed in to change notification settings - Fork 4
334 lines (316 loc) · 12.6 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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
name: release
on: [push, pull_request]
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
APPLICATION_NAME: rife-ncnn-vulkan
jobs:
setup:
runs-on: ubuntu-latest
outputs:
APPNAME: ${{ steps.get_appname.outputs.APPNAME }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: get-appname
id: get_appname
run: echo ::set-output name=APPNAME::${APPLICATION_NAME}
- name: get-version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
ubuntu:
needs: [setup]
runs-on: ubuntu-20.04
env:
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-ubuntu
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v1
with:
path: "1.3.268.0"
key: vulkansdk-linux-x86_64-1.3.268.0
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
wget https://sdk.lunarg.com/sdk/download/1.3.268.0/linux/vulkansdk-linux-x86_64-1.3.268.0.tar.xz -O vulkansdk-linux-x86_64-1.3.268.0.tar.gz
tar -xf vulkansdk-linux-x86_64-1.3.268.0.tar.gz
rm -rf 1.3.268.0/source 1.3.268.0/samples
find 1.3.268.0 -type f | grep -v -E 'vulkan|glslang' | xargs rm
- name: build
run: |
export VULKAN_SDK=`pwd`/1.3.268.0/x86_64
mkdir build && cd build
cmake ../src
cmake --build . -j 2
- name: package
run: |
mkdir -p ubuntu
cp README.md LICENSE ubuntu
cp build/${{ needs.setup.outputs.APPNAME }} ubuntu
strip -g ubuntu/${{ needs.setup.outputs.APPNAME }}
cp -r models/* ubuntu
zip -9 -r ubuntu.zip ubuntu
- name: log
run: |
ls
cd build && ls
- name: upload
uses: actions/upload-artifact@v2
with:
name: ubuntu
path: ubuntu.zip
openmp-macos:
runs-on: macos-11
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v1
with:
path: openmp-install
key: openmp-macos-release-11.0.0
- name: Select Xcode version
run: sudo xcode-select --switch '/Library/Developer/CommandLineTools'
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v2
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/openmp-11.0.0.src.tar.xz
tar -xf openmp-11.0.0.src.tar.xz
cd openmp-11.0.0.src
sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S
sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S
- name: build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-11.0.0.src
mkdir build-x86_64 && cd build-x86_64
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF ..
cmake --build . -j 3
cmake --build . --target install
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-11.0.0.src
mkdir build-arm64 && cd build-arm64
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DCMAKE_OSX_ARCHITECTURES="arm64" \
-DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF ..
cmake --build . -j 3
cmake --build . --target install
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -r openmp-11.0.0.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create openmp-11.0.0.src/build-x86_64/install/lib/libomp.a openmp-11.0.0.src/build-arm64/install/lib/libomp.a -o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v2
with:
name: openmp-macos
path: openmp-install
macos:
needs: [setup, openmp-macos]
runs-on: macos-11
env:
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-macos
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: download-openmp-macos
uses: actions/download-artifact@v2
with:
name: openmp-macos
path: openmp-macos
- name: install-openmp
run: |
sudo cp openmp-macos/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
sudo cp openmp-macos/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
wget https://github.com/TNTwise/Rife-Vulkan-Models/releases/download/1/vulkansdk-macos-1.2.162.0.dmg -O vulkansdk-macos-1.2.162.0.dmg
hdiutil attach vulkansdk-macos-1.2.162.0.dmg
cp -r /Volumes/vulkansdk-macos-1.2.162.0 .
rm -rf vulkansdk-macos-1.2.162.0/Applications
find vulkansdk-macos-1.2.162.0 -type f | grep -v -E 'vulkan|glslang|MoltenVK' | xargs rm
hdiutil detach /Volumes/vulkansdk-macos-1.2.162.0
- name: build-x86_64
run: |
export VULKAN_SDK=`pwd`/vulkansdk-macos-1.2.162.0/macOS
mkdir build-x86_64 && cd build-x86_64
cmake -DUSE_STATIC_MOLTENVK=ON -DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \
-DVulkan_INCLUDE_DIR=`pwd`/../vulkansdk-macos-1.2.162.0/MoltenVK/include \
-DVulkan_LIBRARY=`pwd`/../vulkansdk-macos-1.2.162.0/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a \
../src
cmake --build . -j 3
- name: build-arm64
run: |
export VULKAN_SDK=`pwd`/vulkansdk-macos-1.2.162.0/macOS
mkdir build-arm64 && cd build-arm64
cmake -DUSE_STATIC_MOLTENVK=ON -DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_CROSSCOMPILING=ON -DCMAKE_SYSTEM_PROCESSOR=arm64 \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \
-DVulkan_INCLUDE_DIR=`pwd`/../vulkansdk-macos-1.2.162.0/MoltenVK/include \
-DVulkan_LIBRARY=`pwd`/../vulkansdk-macos-1.2.162.0/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a \
../src
cmake --build . -j 3
# - name: build-arm64
# run: |
# export VULKAN_SDK=`pwd`/vulkansdk-macos-1.2.189.0/macOS
# mkdir build-arm64 && cd build-arm64
# cmake -DUSE_STATIC_MOLTENVK=ON -DCMAKE_OSX_ARCHITECTURES="arm64" \
# -DCMAKE_CROSSCOMPILING=ON -DCMAKE_SYSTEM_PROCESSOR=arm64 \
# -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
# -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
# -DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \
# ../src
# cmake --build . -j 3
- name: package
run: |
mkdir -p macos
cp README.md LICENSE macos/
lipo -create build-x86_64/${{ needs.setup.outputs.APPNAME }} build-arm64/${{ needs.setup.outputs.APPNAME }} -o macos/${{ needs.setup.outputs.APPNAME }}
strip macos/${{ needs.setup.outputs.APPNAME }}
cp -r models/* macos
zip -9 -r macos.zip macos
- name: upload
uses: actions/upload-artifact@v2
with:
name: macos
path: macos.zip
windows:
needs: [setup]
runs-on: windows-latest
env:
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-windows
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v1
with:
path: "VulkanSDK"
key: VulkanSDK-1.3.268.0-Installer
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/1.3.268.0/windows/VulkanSDK-1.3.268.0-Installer.exe?Human=true -OutFile VulkanSDK-1.3.268.0-Installer.exe
7z x -aoa ./VulkanSDK-1.3.268.0-Installer.exe -oVulkanSDK
- name: build
run: |
$env:VULKAN_SDK="$(pwd)/VulkanSDK"
mkdir build; cd build
cmake -A x64 ../src
cmake --build . --config Release -j 2
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
Copy-Item -Verbose -Path "README.md" -Destination "${{ env.PACKAGENAME }}"
Copy-Item -Verbose -Path "LICENSE" -Destination "${{ env.PACKAGENAME }}"
Copy-Item -Verbose -Path "build\Release\${{ needs.setup.outputs.APPNAME }}.exe" -Destination "${{ env.PACKAGENAME }}"
Copy-Item -Verbose -Path "C:\windows\system32\vcomp140.dll" -Destination "${{ env.PACKAGENAME }}"
Copy-Item -Verbose -Recurse -Path "models\*" -Destination "${{ env.PACKAGENAME }}"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: log release
run: |
dir
cd build
dir
cd Release
dir
- name: log ncnn
run: |
cd build
cd ncnn
dir
- name: logx64
run: |
cd build
cd x64
dir
- name: log
run: |
cd D:\a\rife-ncnn-vulkan\rife-ncnn-vulkan\rife-ncnn-vulkan-refs\heads
dir
- name: upload
uses: actions/upload-artifact@v2
with:
name: windows
path: D:\a\rife-ncnn-vulkan\rife-ncnn-vulkan\rife-ncnn-vulkan-refs\heads\master-windows.zip
release:
needs: [setup, ubuntu, windows,macos]
runs-on: ubuntu-latest
steps:
- name: download
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Generate version and tag
id: version_tag
run: |
version=$(python -c "from datetime import datetime; print(str(datetime.now()).split(' ')[0].replace('-',''))")
tag=$(python -c "import random, string; print(''.join(random.choices(string.ascii_letters, k=8)))")
echo "Version=$version"
echo "Tag=$version"
echo "::set-output name=version::$version"
echo "::set-output name=tag::$version"
- name: create-release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version_tag.outputs.tag }}
release_name: Release ${{ steps.version_tag.outputs.tag }}
draft: false
prerelease: false
- name: upload-ubuntu
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/ubuntu/ubuntu.zip
asset_name: ubuntu.zip
asset_content_type: application/zip
- name: upload-macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-macos
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/macos/macos.zip
asset_name: macos.zip
asset_content_type: application/zip
- name: log
run: |
ls
cd artifacts
ls
cd windows
ls
- name: upload-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-windows
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/windows/master-windows.zip
asset_name: windows.zip
asset_content_type: application/zip