-
Notifications
You must be signed in to change notification settings - Fork 16
204 lines (171 loc) · 7.46 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
name: windows
on:
workflow_dispatch:
jobs:
windows:
strategy:
fail-fast: false
matrix:
ver:
- { onnx: v1.18.0, gradle: 8.6 }
list:
- { win_ver: 2022, vs_name: vs2022, vs_ver: v143 }
crt:
[
md,
mt,
]
runs-on: windows-${{ matrix.list.win_ver }}
name: windows-${{ matrix.list.vs_name }}-${{ matrix.crt }}
env:
BUILD_SCRIPT: build-onnxruntime.ps1
SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-windows-${{ matrix.list.vs_name }}-shared-${{ matrix.crt }}
STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-windows-${{ matrix.list.vs_name }}-static-${{ matrix.crt }}
JAVA_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-windows-${{ matrix.list.vs_name }}-java-${{ matrix.crt }}
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8.10'
# Setup JDK 11
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ matrix.ver.gradle }}
- name: test gradle
run: gradle --version
# 检出代码
- uses: actions/checkout@v4
# 检出onnxruntime
- name: checkout onnxruntime
uses: actions/checkout@v4
with:
repository: microsoft/onnxruntime
path: onnxruntime-${{ matrix.ver.onnx }}
ref: ${{ matrix.ver.onnx }}
submodules: recursive
# 复制编译脚本
- name: copy build script
run: |
cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ matrix.ver.onnx }}
- name: build x64
shell: powershell
run: |
cd onnxruntime-${{ matrix.ver.onnx }}
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -SkipAutomaticLocation -HostArch amd64 -Arch amd64
.\${{ env.BUILD_SCRIPT }} -VsArch x64 -VsCRT ${{ matrix.crt }}
- name: build x86
shell: powershell
run: |
cd onnxruntime-${{ matrix.ver.onnx }}
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -SkipAutomaticLocation -HostArch amd64 -Arch x86
.\${{ env.BUILD_SCRIPT }} -VsArch x86 -VsCRT ${{ matrix.crt }}
- name: build arm64
shell: powershell
run: |
cd onnxruntime-${{ matrix.ver.onnx }}
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -SkipAutomaticLocation -HostArch amd64 -Arch arm64
.\${{ env.BUILD_SCRIPT }} -VsArch arm64 -VsCRT ${{ matrix.crt }}
- name: build arm64ec
shell: powershell
run: |
cd onnxruntime-${{ matrix.ver.onnx }}
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -SkipAutomaticLocation -HostArch amd64 -Arch arm64
.\${{ env.BUILD_SCRIPT }} -VsArch arm64ec -VsCRT ${{ matrix.crt }}
# install文件夹改名,并使用7z压缩
- name: 7zip pack shared libs
run: |
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install windows-x64
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-x86-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install windows-x86
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-arm64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install windows-arm64
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-arm64ec-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install windows-arm64ec
7z a ${{ env.SHARED_PKG_NAME }}.7z windows-x64 windows-x86 windows-arm64 windows-arm64ec
rm windows-x64 -r -fo
rm windows-x86 -r -fo
rm windows-arm64 -r -fo
rm windows-arm64ec -r -fo
- name: 7zip pack static libs
run: |
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install-static windows-x64
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-x86-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install-static windows-x86
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-arm64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install-static windows-arm64
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-arm64ec-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install-static windows-arm64ec
7z a ${{ env.STATIC_PKG_NAME }}.7z windows-x64 windows-x86 windows-arm64 windows-arm64ec
rm windows-x64 -r -fo
rm windows-x86 -r -fo
rm windows-arm64 -r -fo
rm windows-arm64ec -r -fo
- name: build x64 java
shell: powershell
run: |
cd onnxruntime-${{ matrix.ver.onnx }}
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -SkipAutomaticLocation -HostArch amd64 -Arch amd64
.\${{ env.BUILD_SCRIPT }} -VsArch x64 -VsCRT ${{ matrix.crt }} -BuildJava
- name: 7zip pack java libs
run: |
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/java/build/libs ${{ env.JAVA_PKG_NAME }}
7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }}
# 上传artifact
- name: upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.SHARED_PKG_NAME }}
path: ${{ env.SHARED_PKG_NAME }}.7z
- name: upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.STATIC_PKG_NAME }}
path: ${{ env.STATIC_PKG_NAME }}.7z
- name: upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.JAVA_PKG_NAME }}
path: ${{ env.JAVA_PKG_NAME }}.7z
release:
needs: [ windows ]
runs-on: ubuntu-latest
steps:
# 检出代码
- uses: actions/checkout@v4
# 获取所有的git log和tag
- name: Unshallow
run: git fetch --prune --unshallow
# 获取git log 从 previousTag 到 lastTag
- name: Get git log
id: git-log
run: |
previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)
lastTag=$(git describe --abbrev=0 --tags)
echo "previousTag:$previousTag ~ lastTag:$lastTag"
log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S')
echo "$log"
echo "log_state="$log"" >> $GITHUB_ENV
# 创建Changelog文件 triggered by git tag push
- name: Generate Changelog
if: startsWith(github.ref, 'refs/tags/')
run: |
echo -e '${{ env.log_state }}' > release.md
# 下载artifact
- name: download
uses: actions/download-artifact@v3
with:
path: artifacts
# 查看artifact
- name: list artifact
run: |
tree artifacts
# 创建release 上传release
# https://github.com/marketplace/actions/create-release
- name: upload-windows
uses: ncipollo/release-action@v1
with:
prerelease: false
bodyFile: release.md
artifacts: artifacts/*/*.7z
allowUpdates: true
artifactContentType: application/x-7z-compressed
token: ${{ secrets.GITHUB_TOKEN }}