fix windows builder #14
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: | |
push: | |
tags: | |
- '*' | |
jobs: | |
windows: | |
strategy: | |
fail-fast: false | |
matrix: | |
list: | |
- { win_ver: 2019, vs_name: vs2019, vs_ver: v142 } | |
- { 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: | |
ONNX_VERSION: v1.15.1 | |
SHARED_PKG_NAME: onnxruntime-1.15.1-windows-${{ matrix.list.vs_name }}-shared-${{ matrix.crt }} | |
STATIC_PKG_NAME: onnxruntime-1.15.1-windows-${{ matrix.list.vs_name }}-static-${{ matrix.crt }} | |
steps: | |
# Setup JDK 11 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
# 检出代码 | |
- uses: actions/checkout@v3 | |
# 检出onnxruntime | |
- name: checkout onnxruntime | |
uses: actions/checkout@v3 | |
with: | |
repository: microsoft/onnxruntime | |
path: onnxruntime-${{ env.ONNX_VERSION }} | |
ref: ${{ env.ONNX_VERSION }} | |
submodules: recursive | |
# 复制编译脚本 | |
- name: copy build script | |
run: | | |
cp build-onnxruntime.bat onnxruntime-${{ env.ONNX_VERSION }} | |
cp onnxruntime_cmake_options.txt onnxruntime-${{ env.ONNX_VERSION }} | |
# 编译 | |
- name: build | |
run: | | |
cd onnxruntime-${{ env.ONNX_VERSION }} | |
./build-onnxruntime.bat ${{ matrix.list.vs_ver }} ${{ matrix.crt }} | |
# install文件夹改名,并使用7z压缩 | |
- name: 7zip | |
run: | | |
mv onnxruntime-${{ env.ONNX_VERSION }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/install windows-x64 | |
mv onnxruntime-${{ env.ONNX_VERSION }}/build-Win32-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/install windows-x86 | |
7z a ${{ env.SHARED_PKG_NAME }}.7z windows-x64 windows-x86 | |
rm windows-x64 -r -fo | |
rm windows-x86 -r -fo | |
mv onnxruntime-${{ env.ONNX_VERSION }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/install-static windows-x64 | |
mv onnxruntime-${{ env.ONNX_VERSION }}/build-Win32-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/install-static windows-x86 | |
7z a ${{ env.STATIC_PKG_NAME }}.7z windows-x64 windows-x86 | |
rm windows-x64 -r -fo | |
rm windows-x86 -r -fo | |
# 上传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 | |
release: | |
needs: [ windows ] | |
runs-on: ubuntu-latest | |
steps: | |
# 检出代码 | |
- uses: actions/checkout@v3 | |
# 获取所有的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 | |
name: onnxruntime ${{ github.ref }} | |
bodyFile: release.md | |
artifacts: artifacts/*/*.7z | |
allowUpdates: true | |
artifactContentType: application/x-7z-compressed | |
token: ${{ secrets.GITHUB_TOKEN }} |