From b408311687215b1b71e39295331d2a5ab0776532 Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Sun, 22 Dec 2024 02:25:58 +0900 Subject: [PATCH] --- .github/workflows/build.yml | 403 ++++++++++++++++++------------------ 1 file changed, 203 insertions(+), 200 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index abb0691..6a0f3c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -244,7 +244,7 @@ jobs: ARCH_SUFFIX: "${{ (matrix.linux_cross_arch != '' && '-') || '' }}${{ (matrix.linux_cross_arch != '' && matrix.linux_cross_arch) || '' }}" runs-on: ${{ matrix.os }} - environment: ${{ inputs.code_signing && 'production' || '' }} # コード署名用のenvironment + environment: ${{ inputs.target == 'voicevox_onnxruntime' && 'production' || '' }} # コード署名用のenvironment steps: - uses: actions/setup-python@v5 @@ -551,11 +551,11 @@ jobs: ESIGNERCKA_PASSWORD: ${{ secrets.ESIGNERCKA_PASSWORD }} ESIGNERCKA_TOTP_SECRET: ${{ secrets.ESIGNERCKA_TOTP_SECRET }} - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.artifact_name }} - path: artifact/* + #- name: Upload artifact + # uses: actions/upload-artifact@v4 + # with: + # name: ${{ matrix.artifact_name }} + # path: artifact/* - name: Generate RELEASE_NAME run: | @@ -603,197 +603,200 @@ jobs: --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: | - mv artifact/ "$RELEASE_NAME" - tar cfz "$RELEASE_NAME.tgz" "$RELEASE_NAME/" - - - name: Upload to Release - if: env.RELEASE == 'true' - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ env.TARGET_LIBRARY }}-${{ env.ONNXRUNTIME_VERSION }} - file: ${{ env.RELEASE_NAME }}.tgz - - build-xcframework: - needs: build-onnxruntime - runs-on: macos-13 - outputs: - release-name: ${{ steps.gen-envs.outputs.release-name }} - steps: - - name: Generate RELEASE_NAME and ONNXRUNTIME_BASENAME - id: gen-envs - run: | - RELEASE_NAME=$TARGET_LIBRARY-ios-xcframework-$ONNXRUNTIME_VERSION - echo "release-name=$RELEASE_NAME" >> "$GITHUB_OUTPUT" - echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV" - echo "ONNXRUNTIME_BASENAME=lib$TARGET_LIBRARY.$ONNXRUNTIME_VERSION.dylib" >> "$GITHUB_ENV" - - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - name: ${{ env.TARGET_LIBRARY }}-ios-arm64 - path: artifact/${{ env.TARGET_LIBRARY }}-aarch64-apple-ios - - - uses: actions/download-artifact@v4 - with: - name: ${{ env.TARGET_LIBRARY }}-ios-sim-arm64 - path: artifact/${{ env.TARGET_LIBRARY }}-aarch64-apple-ios-sim - - - uses: actions/download-artifact@v4 - with: - name: ${{ env.TARGET_LIBRARY }}-ios-sim-x86_64 - path: artifact/${{ env.TARGET_LIBRARY }}-x86_64-apple-ios - - - name: Remove no version notation dylib - run: | - rm -f artifact/"$TARGET_LIBRARY"-x86_64-apple-ios/lib/*"$TARGET_LIBRARY".dylib - rm -f artifact/"$TARGET_LIBRARY"-aarch64-apple-ios-sim/lib/*"$TARGET_LIBRARY".dylib - rm -f artifact/"$TARGET_LIBRARY"-aarch64-apple-ios/lib/*"$TARGET_LIBRARY".dylib - - - name: '"onnxruntime" → "voicevox_onnxruntime"' - if: env.TARGET_LIBRARY == 'voicevox_onnxruntime' - run: | - for arch in aarch64 sim; do - mv xcframework/Frameworks/$arch/{,voicevox_}onnxruntime.framework - done - find ./xcframework -type f -exec sed -i '' s/onnxruntime/voicevox_onnxruntime/ {} + - - - name: Create aarch64 Framework - run: | - mkdir -p "Framework-aarch64" - cp -vr xcframework/Frameworks/aarch64/ Framework-aarch64/ - - lipo -create "artifact/$TARGET_LIBRARY-aarch64-apple-ios/lib/$ONNXRUNTIME_BASENAME" \ - -output "Framework-aarch64/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" - - - name: Change aarch64 @rpath - run: | - install_name_tool -id "@rpath/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" \ - "Framework-aarch64/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" - - - name: Create fat binary - run: | - mkdir -p "artifact/$TARGET_LIBRARY-sim" - lipo -create "artifact/$TARGET_LIBRARY-x86_64-apple-ios/lib/$ONNXRUNTIME_BASENAME" \ - "artifact/$TARGET_LIBRARY-aarch64-apple-ios-sim/lib/$ONNXRUNTIME_BASENAME" \ - -output "artifact/$TARGET_LIBRARY-sim/$TARGET_LIBRARY" - - - name: Create sim Framework - run: | - mkdir -p "Framework-sim" - cp -vr xcframework/Frameworks/sim/ Framework-sim/ - cp -v "artifact/$TARGET_LIBRARY-sim/$TARGET_LIBRARY" \ - "Framework-sim/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" - - - name: Change sim @rpath - run: | - install_name_tool -id "@rpath/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" \ - "Framework-sim/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" - - - name: Create XCFramework - run: | - mkdir -p "artifact/$ONNXRUNTIME_BASENAME" - xcodebuild -create-xcframework \ - -framework "Framework-sim/$TARGET_LIBRARY.framework" \ - -framework "Framework-aarch64/$TARGET_LIBRARY.framework" \ - -output "artifact/$ONNXRUNTIME_BASENAME/$TARGET_LIBRARY.xcframework" - - - name: Archive artifact - run: | - cd "artifact/$ONNXRUNTIME_BASENAME" - 7z a "../../$RELEASE_NAME.zip" "$TARGET_LIBRARY.xcframework" - - - name: Upload to Release - if: env.RELEASE == 'true' - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ env.TARGET_LIBRARY }}-${{ env.ONNXRUNTIME_VERSION }} - 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 < - - - OS - アーキテクチャ - デバイス - 名前 - - - - 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+=" $(jq .os -r <<< "$specs")"$'\n' - release_notes+=" $(jq .arch -r <<< "$specs")"$'\n' - release_notes+=" $(jq .devices -r <<< "$specs")"$'\n' - release_notes+=" $release_name.tgz"$'\n' - release_notes+=$' \n' - done - release_notes+=$( - cat < - - - ## 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.TARGET_LIBRARY }}-${{ env.ONNXRUNTIME_VERSION }} + #- 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: | + # mv artifact/ "$RELEASE_NAME" + # tar cfz "$RELEASE_NAME.tgz" "$RELEASE_NAME/" + + #- name: Upload to Release + # if: env.RELEASE == 'true' + # uses: svenstaro/upload-release-action@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # tag: ${{ env.TARGET_LIBRARY }}-${{ env.ONNXRUNTIME_VERSION }} + # file: ${{ env.RELEASE_NAME }}.tgz + + - name: Fail + run: false + + #build-xcframework: + # needs: build-onnxruntime + # runs-on: macos-13 + # outputs: + # release-name: ${{ steps.gen-envs.outputs.release-name }} + # steps: + # - name: Generate RELEASE_NAME and ONNXRUNTIME_BASENAME + # id: gen-envs + # run: | + # RELEASE_NAME=$TARGET_LIBRARY-ios-xcframework-$ONNXRUNTIME_VERSION + # echo "release-name=$RELEASE_NAME" >> "$GITHUB_OUTPUT" + # echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV" + # echo "ONNXRUNTIME_BASENAME=lib$TARGET_LIBRARY.$ONNXRUNTIME_VERSION.dylib" >> "$GITHUB_ENV" + + # - uses: actions/checkout@v4 + + # - uses: actions/download-artifact@v4 + # with: + # name: ${{ env.TARGET_LIBRARY }}-ios-arm64 + # path: artifact/${{ env.TARGET_LIBRARY }}-aarch64-apple-ios + + # - uses: actions/download-artifact@v4 + # with: + # name: ${{ env.TARGET_LIBRARY }}-ios-sim-arm64 + # path: artifact/${{ env.TARGET_LIBRARY }}-aarch64-apple-ios-sim + + # - uses: actions/download-artifact@v4 + # with: + # name: ${{ env.TARGET_LIBRARY }}-ios-sim-x86_64 + # path: artifact/${{ env.TARGET_LIBRARY }}-x86_64-apple-ios + + # - name: Remove no version notation dylib + # run: | + # rm -f artifact/"$TARGET_LIBRARY"-x86_64-apple-ios/lib/*"$TARGET_LIBRARY".dylib + # rm -f artifact/"$TARGET_LIBRARY"-aarch64-apple-ios-sim/lib/*"$TARGET_LIBRARY".dylib + # rm -f artifact/"$TARGET_LIBRARY"-aarch64-apple-ios/lib/*"$TARGET_LIBRARY".dylib + + # - name: '"onnxruntime" → "voicevox_onnxruntime"' + # if: env.TARGET_LIBRARY == 'voicevox_onnxruntime' + # run: | + # for arch in aarch64 sim; do + # mv xcframework/Frameworks/$arch/{,voicevox_}onnxruntime.framework + # done + # find ./xcframework -type f -exec sed -i '' s/onnxruntime/voicevox_onnxruntime/ {} + + + # - name: Create aarch64 Framework + # run: | + # mkdir -p "Framework-aarch64" + # cp -vr xcframework/Frameworks/aarch64/ Framework-aarch64/ + + # lipo -create "artifact/$TARGET_LIBRARY-aarch64-apple-ios/lib/$ONNXRUNTIME_BASENAME" \ + # -output "Framework-aarch64/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" + + # - name: Change aarch64 @rpath + # run: | + # install_name_tool -id "@rpath/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" \ + # "Framework-aarch64/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" + + # - name: Create fat binary + # run: | + # mkdir -p "artifact/$TARGET_LIBRARY-sim" + # lipo -create "artifact/$TARGET_LIBRARY-x86_64-apple-ios/lib/$ONNXRUNTIME_BASENAME" \ + # "artifact/$TARGET_LIBRARY-aarch64-apple-ios-sim/lib/$ONNXRUNTIME_BASENAME" \ + # -output "artifact/$TARGET_LIBRARY-sim/$TARGET_LIBRARY" + + # - name: Create sim Framework + # run: | + # mkdir -p "Framework-sim" + # cp -vr xcframework/Frameworks/sim/ Framework-sim/ + # cp -v "artifact/$TARGET_LIBRARY-sim/$TARGET_LIBRARY" \ + # "Framework-sim/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" + + # - name: Change sim @rpath + # run: | + # install_name_tool -id "@rpath/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" \ + # "Framework-sim/$TARGET_LIBRARY.framework/$TARGET_LIBRARY" + + # - name: Create XCFramework + # run: | + # mkdir -p "artifact/$ONNXRUNTIME_BASENAME" + # xcodebuild -create-xcframework \ + # -framework "Framework-sim/$TARGET_LIBRARY.framework" \ + # -framework "Framework-aarch64/$TARGET_LIBRARY.framework" \ + # -output "artifact/$ONNXRUNTIME_BASENAME/$TARGET_LIBRARY.xcframework" + + # - name: Archive artifact + # run: | + # cd "artifact/$ONNXRUNTIME_BASENAME" + # 7z a "../../$RELEASE_NAME.zip" "$TARGET_LIBRARY.xcframework" + + # - name: Upload to Release + # if: env.RELEASE == 'true' + # uses: svenstaro/upload-release-action@v2 + # with: + # repo_token: ${{ secrets.GITHUB_TOKEN }} + # tag: ${{ env.TARGET_LIBRARY }}-${{ env.ONNXRUNTIME_VERSION }} + # 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 < + # + # + # OS + # アーキテクチャ + # デバイス + # 名前 + # + # + # + # 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+=" $(jq .os -r <<< "$specs")"$'\n' + # release_notes+=" $(jq .arch -r <<< "$specs")"$'\n' + # release_notes+=" $(jq .devices -r <<< "$specs")"$'\n' + # release_notes+=" $release_name.tgz"$'\n' + # release_notes+=$' \n' + # done + # release_notes+=$( + # cat < + # + + # ## 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.TARGET_LIBRARY }}-${{ env.ONNXRUNTIME_VERSION }}