-
Notifications
You must be signed in to change notification settings - Fork 1.7k
163 lines (149 loc) · 4.44 KB
/
mnn_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
name: mnn_release
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
setup:
permissions:
contents: none
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: get-version
id: get_version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
# 提取标签版本号
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
else
# 如果不是标签,则设置版本为 'dev'
echo "VERSION=dev" >> $GITHUB_OUTPUT
fi
linux-release:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: mnn_${{ needs.setup.outputs.VERSION }}_linux_x64_cpu_opencl
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: build
run: |
# j24 -> j4 avoid ld signal 9
sed -i "s/-j24/-j4/g" package_scripts/linux/build_lib.sh
./package_scripts/linux/build_lib.sh -o ${{ env.PACKAGENAME }}/lib -b opencl -s -c
- name: package
run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: artifact-${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-release:
needs: [setup]
runs-on: windows-latest
env:
PACKAGENAME: mnn_${{ needs.setup.outputs.VERSION }}_windows_x64_cpu_opencl
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: using msvc
uses: ilammy/msvc-dev-cmd@v1
- name: build
run: powershell .\package_scripts\win\build_lib_release.ps1 -path ${{ env.PACKAGENAME }}
- name: package
run: 7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: artifact-${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
macos-release:
needs: [setup]
runs-on: macos-latest
env:
PACKAGENAME: mnn_${{ needs.setup.outputs.VERSION }}_macos_x64_arm82_cpu_opencl_metal
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: build
run: ./package_scripts/mac/buildFrameWork.sh
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mv MNN-MacOS-CPU-GPU ${{ env.PACKAGENAME }}
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: artifact-${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
android-release:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: mnn_${{ needs.setup.outputs.VERSION }}_android_armv7_armv8_cpu_opencl_vulkan
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: build
run: ./package_scripts/android/build.sh -o ${{ env.PACKAGENAME }}
- name: package
run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: artifact-${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
ios-release:
needs: [setup]
runs-on: macos-latest
env:
PACKAGENAME: mnn_${{ needs.setup.outputs.VERSION }}_ios_armv82_cpu_metal_coreml
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: build
run: |
brew install coreutils
./package_scripts/ios/xcodebuildiOS.sh -o ios_build
- name: package
run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ios_build/Release-iphoneos/MNN.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: artifact-${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
upload-release:
name: upload_to_release
needs: [linux-release, windows-release, macos-release, android-release, ios-release]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: artifact-*
path: assert
- name: show file
run: ls assert
- uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: assert/*.zip
tags: true
draft: true