-
Notifications
You must be signed in to change notification settings - Fork 14
136 lines (115 loc) · 4.13 KB
/
macos.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
name: macos
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
macos:
strategy:
fail-fast: false
matrix:
ver:
- { onnx: v1.18.0, gradle: 8.6 }
list:
- { os_ver: 11 }
- { os_ver: 12 }
- { os_ver: 13 }
runs-on: macos-${{ matrix.list.os_ver }}
env:
BUILD_SCRIPT: build-onnxruntime.sh
SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-macos-${{ matrix.list.os_ver }}-shared
STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-macos-${{ matrix.list.os_ver }}-static
JAVA_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-macos-${{ matrix.list.os_ver }}-java
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8.18'
# Setup JDK 11
- name: Set up JDK 11
uses: actions/setup-java@v3
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@v3
# 检出onnxruntime
- name: checkout onnxruntime
uses: actions/checkout@v3
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
run: |
cd onnxruntime-${{ matrix.ver.onnx }}
chmod a+x ${{ env.BUILD_SCRIPT }}
./${{ env.BUILD_SCRIPT }}
# install文件夹改名macos,并使用7z压缩
- name: 7z
run: |
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Darwin/Release/install macos
7z a ${{ env.SHARED_PKG_NAME }}.7z macos
rm -r -f macos
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Darwin/Release/install-static macos
7z a ${{ env.STATIC_PKG_NAME }}.7z macos
rm -r -f macos
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Darwin/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@v2
with:
name: ${{ env.JAVA_PKG_NAME }}
path: ${{ env.JAVA_PKG_NAME }}.7z
# 获取所有的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
# 创建release 上传release
# https://github.com/marketplace/actions/create-release
- name: Create release and upload-archive
uses: ncipollo/release-action@v1
with:
prerelease: false
bodyFile: release.md
artifacts: ${{ env.SHARED_PKG_NAME }}.7z, ${{ env.STATIC_PKG_NAME }}.7z, ${{ env.JAVA_PKG_NAME }}.7z
allowUpdates: true
artifactContentType: application/x-7z-compressed
token: ${{ secrets.GITHUB_TOKEN }}