Skip to content

Release版Core互換性チェック #169

Release版Core互換性チェック

Release版Core互換性チェック #169

name: Release版Core互換性チェック
on:
issue_comment:
types: [created]
workflow_dispatch:
inputs:
release-tag:
description: VOICEVOX CORE release tag
type: string
required: true
jobs:
# PRのコメントに /test_release 0.15.0 と書くと、当該PRをmergeした状態で 0.15.0 のリリース版を使ってテスト出来る
# workflow_dispatch で release-tag を指定すると、指定したリリース版を指定したブランチのHEADを使ってテストする
parse-tag:
if: github.event_name == 'workflow_dispatch' || (contains(github.event.comment.body, '/test_release') && github.event.issue.pull_request != null)
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.get_tag.outputs.tag }}
release-tag: ${{ steps.get_tag_from_input.outputs.tag }}
steps:
- if: contains(github.event.comment.body, '/test_release') && github.event.issue.pull_request != null
id: get_tag
run: echo tag="${BODY#/test_release }" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
- if: github.event_name == 'workflow_dispatch'
id: get_tag_from_input
run: echo tag="${{ github.event.inputs.release-tag }}" >> $GITHUB_OUTPUT
test_release:
needs: parse-tag
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
steps:
# is PR
- if: needs.parse-tag.outputs.tag != null
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/merge
# is workflow_dispatch
- if: needs.parse-tag.outputs.release-tag != null
uses: actions/checkout@v4
- if: ${{ github.event.issue.pull_request != null }}
run: gh pr comment ${PR_NUMBER} -b "Running ${ACTION_URL}"
env:
PR_NUMBER: ${{ github.event.issue.number }}
ACTION_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_TOKEN: ${{ github.token }}
- id: download-voicevox_core
uses: sevenc-nanashi/[email protected]
with:
download-item: "core"
path: voicevox_core_resources
version: ${{format('{0}{1}', needs.parse-tag.outputs.tag, needs.parse-tag.outputs.release-tag)}} # どちらかしかないので結合してよい
- run: cp ${{ steps.download-voicevox_core.outputs.entrypoint }} tests/VoicevoxCoreSharp.Core.Tests/resources/libvoicevox_core.so
# voicevox_coreのdownloaderの最新が出て、models単体をダウンロードできるようになったら setup-voicevox とかも対応するんじゃないかなーと思うので、そのタイミングで対応する
- run: curl -L https://github.com/VOICEVOX/voicevox_core/releases/download/${{format('{0}{1}', needs.parse-tag.outputs.tag, needs.parse-tag.outputs.release-tag)}}/model-${{format('{0}{1}', needs.parse-tag.outputs.tag, needs.parse-tag.outputs.release-tag)}}.zip -O
- run: unzip model-${{format('{0}{1}', needs.parse-tag.outputs.tag, needs.parse-tag.outputs.release-tag)}}.zip
- run: mkdir -p tests/VoicevoxCoreSharp.Core.Tests/resources/model; cp -r model-${{format('{0}{1}', needs.parse-tag.outputs.tag, needs.parse-tag.outputs.release-tag)}}/0.vvm tests/VoicevoxCoreSharp.Core.Tests/resources/model/sample.vvm
- uses: ./.github/composite/download-openjtalk-dict
with:
cache-path: open_jtalk_dic_utf_8-1.11.tar.gz
cache-key: open_jtalk_dic_utf_8-1.11
- run: |
cp open_jtalk_dic_utf_8-1.11.tar.gz ./tests/VoicevoxCoreSharp.Core.Tests/resources
tar zxf ./tests/VoicevoxCoreSharp.Core.Tests/resources/open_jtalk_dic_utf_8-1.11.tar.gz -C tests/VoicevoxCoreSharp.Core.Tests/resources/
- id: test_dotnet
run: dotnet test VoicevoxCoreSharp-without-exmaples.slnf
continue-on-error: true
- if: ${{ github.event.issue.pull_request != null }}
run: |
BODY=$([[ ${TEST_STATUS} == "failure" ]] && echo "❌ ${ACTION_URL}" || echo "✅ ${ACTION_URL}")
gh pr comment ${PR_NUMBER} --edit-last -b "${BODY}"
[[ ${TEST_STATUS} == "failure" ]] && exit 1 || exit 0
env:
TEST_STATUS: ${{ steps.test_dotnet.outcome }}
PR_NUMBER: ${{ github.event.issue.number }}
ACTION_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_TOKEN: ${{ github.token }}