fix builder v1.16.3 #62
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: linux | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os_name: [ubuntu] | |
ver: | |
- { onnx: v1.16.3, cmake: 3.28.2, python: 3.8.18, gradle: 8.5, jdk: openjdk-8-jdk } | |
list: | |
- { os_ver: 20.04, os_id: focal } | |
- { os_ver: 22.04, os_id: jammy } | |
arch: | |
[ | |
amd64, | |
arm64, | |
ppc64le, | |
] | |
name: ${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }} | |
env: | |
BUILD_SCRIPT: build-onnxruntime.sh | |
SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }}-shared | |
STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }}-static | |
JAVA_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }}-java | |
steps: | |
# 检出代码 | |
- 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 | |
run: | | |
cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ matrix.ver.onnx }} | |
chmod a+x ${{ env.BUILD_SCRIPT }} | |
- name: Host - update | |
run: sudo apt-get update | |
- name: Host - Install host qemu-static | |
run: sudo apt-get install -y qemu binfmt-support qemu-user-static | |
- name: Host - Docker multiarch bootstrap | |
run: sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: deploy cmake | |
run: | | |
wget https://github.com/benjaminwan/CmakeBuilder/releases/download/${{ matrix.ver.cmake }}/cmake-${{ matrix.ver.cmake }}-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}.7z -O cmake-${{ matrix.ver.cmake }}.7z | |
7z x cmake-${{ matrix.ver.cmake }}.7z -aoa | |
- name: deploy python | |
run: | | |
wget https://github.com/benjaminwan/PythonBuilder/releases/download/${{ matrix.ver.python }}/python-${{ matrix.ver.python }}-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}.7z -O python-${{ matrix.ver.python }}.7z | |
7z x python-${{ matrix.ver.python }}.7z -aoa | |
- name: deploy gradle | |
run: | | |
wget https://services.gradle.org/distributions/gradle-${{ matrix.ver.gradle }}-bin.zip -O gradle-${{ matrix.ver.gradle }}-bin.zip | |
7z x gradle-${{ matrix.ver.gradle }}-bin.zip -aoa | |
- name: Host - Create Docker template env file | |
run: | | |
echo "PATH=/root/cmake-${{ matrix.ver.cmake }}/bin:/root/python-${{ matrix.ver.python }}/bin:/root/gradle-${{ matrix.ver.gradle }}/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" > env.custom | |
echo "DEBIAN_FRONTEND=noninteractive" >> env.custom | |
echo "TZ=Etc/UTC" >> env.custom | |
- name: Host - Create docker container | |
run: docker run --name ${{ matrix.os_name }} --env-file env.custom --platform linux/${{ matrix.arch }} -it -d -w /root -v ${{ github.workspace }}:/root ${{ matrix.os_name }}:${{ matrix.list.os_id }} | |
- name: Docker - apt-get update | |
run: docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get update | |
- name: Docker - install build deps | |
run: docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get install -y build-essential git software-properties-common | |
- name: Docker - install jdk | |
run: | | |
docker exec --env-file env.custom -w /root ${{ matrix.os_name }} add-apt-repository -y ppa:openjdk-r/ppa | |
docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get update | |
docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get -y install ${{ matrix.ver.jdk }} | |
docker exec --env-file env.custom -w /root ${{ matrix.os_name }} java -version | |
JAVA_DIR=$(docker exec ${{ matrix.os_name }} readlink -f /usr/bin/javac | sed "s:/bin/javac::") | |
echo "$JAVA_DIR" | |
echo "JAVA_HOME=$JAVA_DIR" >> env.custom | |
echo "JAVA_INCLUDE_PATH=$JAVA_DIR/include" >> env.custom | |
- name: Docker - build | |
run: | | |
docker exec --env-file env.custom -w /root ${{ matrix.os_name }} git config --global --add safe.directory "*" | |
docker exec --env-file env.custom -w /root/onnxruntime-${{ matrix.ver.onnx }} ${{ matrix.os_name }} chmod a+x ${{ env.BUILD_SCRIPT }} | |
docker exec --env-file env.custom -w /root/onnxruntime-${{ matrix.ver.onnx }} ${{ matrix.os_name }} ./${{ env.BUILD_SCRIPT }} | |
# install文件夹改名linux,并使用7z压缩 | |
- name: 7zip | |
run: | | |
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Linux/Release/install linux | |
7z a ${{ env.SHARED_PKG_NAME }}.7z linux | |
rm -r -f linux | |
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Linux/Release/install-static linux | |
7z a ${{ env.STATIC_PKG_NAME }}.7z linux | |
rm -r -f linux | |
cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Linux/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 | |
# 上传artifact | |
- name: upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.STATIC_PKG_NAME }} | |
path: ${{ env.STATIC_PKG_NAME }}.7z | |
# 上传artifact | |
- name: upload | |
uses: actions/upload-artifact@v3 | |
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 }} |