From bc8e8928fefaaaa9008fc0777398a716da30dd60 Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Sat, 3 Aug 2024 15:45:01 +0900 Subject: [PATCH] =?UTF-8?q?add:=20=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=83=8E=E3=83=BC=E3=83=88=E3=81=AB=E6=A9=9F=E6=A2=B0=E5=8F=AF?= =?UTF-8?q?=E8=AA=AD=E3=81=AA``=E3=82=92=E7=BD=AE=E3=81=8F=20(#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add: リリースノートに機械可読な`
`を置く * `
`の組み立てを`build-spec-table`に集約する * `data-*`属性に情報を書く * fixup! `data-*`属性に情報を書く * "アーキテクチャ"に統一する --- .github/workflows/build.yml | 131 +++++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3010bad..4f5974d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -339,10 +339,55 @@ jobs: path: artifact/* - name: Generate RELEASE_NAME - if: env.RELEASE == 'true' run: | echo "RELEASE_NAME=${{ matrix.artifact_name }}-${{ env.ONNXRUNTIME_VERSION }}" >> "$GITHUB_ENV" + - name: Generate specifications + run: | + build_opts=(${{ matrix.build_opts }}) + + for arg in "${build_opts[@]}"; do + case "$arg" in + CMAKE_SYSTEM_NAME=Windows) os=Windows ;; + CMAKE_SYSTEM_NAME=Linux) os=Linux ;; + CMAKE_SYSTEM_NAME=Darwin) os=macOS ;; + --android) os=Android ;; + --ios) os=iOS ;; + + CMAKE_SYSTEM_PROCESSOR=x86_64 | CMAKE_OSX_ARCHITECTURES=x86_64 | x86_64) arch=x86_64 ;; + --x86) arch=x86 ;; + CMAKE_OSX_ARCHITECTURES=arm64 | --arm64 | arm64 | arm64-v8a) arch=AArch64 ;; + --arm) arch=ARMv7 ;; + + --use_cuda) use_cuda=1 ;; + --use_dml) use_dml=1 ;; + esac + done + + jq ' + { + "os": $os, + "arch": $arch, + # ONNX Runtimeが示す順番に従う + "devices": [ + ("CUDA" | select($use_cuda == "1")), + ("DirectML" | select($use_dml == "1")), + "CPU" + ] | join("/") + }' \ + -n \ + --arg os "$os" \ + --arg arch "$arch" \ + --arg use_cuda "$use_cuda" \ + --arg use_dml "$use_dml" \ + > "$RELEASE_NAME.json" + + - name: Upload specifications + uses: actions/upload-artifact@v4 + with: + name: specs-${{ matrix.artifact_name }} + path: ${{ env.RELEASE_NAME }}.json + - name: Rearchive artifact if: env.RELEASE == 'true' run: | @@ -360,10 +405,15 @@ jobs: build-xcframework: needs: build-onnxruntime runs-on: macos-12 + outputs: + release-name: ${{ steps.gen-envs.outputs.release-name }} steps: - name: Generate RELEASE_NAME and ONNXRUNTIME_BASENAME + id: gen-envs run: | - echo "RELEASE_NAME=onnxruntime-ios-xcframework-${{ env.ONNXRUNTIME_VERSION }}" >> "$GITHUB_ENV" + RELEASE_NAME=onnxruntime-ios-xcframework-${{ env.ONNXRUNTIME_VERSION }} + echo "release-name=$RELEASE_NAME" >> "$GITHUB_OUTPUT" + echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV" echo "ONNXRUNTIME_BASENAME=libonnxruntime.${{ env.ONNXRUNTIME_VERSION }}.dylib" >> "$GITHUB_ENV" - uses: actions/checkout@v3 @@ -441,3 +491,80 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ env.ONNXRUNTIME_VERSION }} # ==> github.event.release.tag_name file: ${{ env.RELEASE_NAME }}.zip + + build-spec-table: + needs: [build-onnxruntime, build-xcframework] + runs-on: ubuntu-22.04 + steps: + - name: Download specifications + uses: actions/download-artifact@v4 + with: + path: specs + pattern: specs-* + merge-multiple: true + + - name: Construct release notes + run: | + release_notes=$( + cat < + + + + + + + + + + EOF + ) + release_notes+=$'\n' + for specs_file in specs/*.json; do + specs=$(< "$specs_file") + release_name=$(basename "${specs_file%.json}") + release_notes+=$' \n' + release_notes+=" "$'\n' + release_notes+=" "$'\n' + release_notes+=" "$'\n' + release_notes+=" "$'\n' + release_notes+=$' \n' + done + release_notes+=$( + cat < +
OSアーキテクチャデバイス名前
$(jq .os -r <<< "$specs")$(jq .arch -r <<< "$specs")$(jq .devices -r <<< "$specs")$release_name.tgz
+ + ## XCFramework + + + + + + + + + + + + + + + + + + +
OSアーキテクチャデバイス名前
iOSAArch64/x86_64CPU${{ needs.build-xcframework.outputs.release-name }}.zip
+ EOF + ) + tee release-notes.md >&2 <<< "$release_notes" + + - name: Update release notes + if: env.RELEASE == 'true' + uses: softprops/action-gh-release@v2 + with: + body_path: release-notes.md + prerelease: true + tag_name: ${{ env.ONNXRUNTIME_VERSION }}