windows #72
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |