diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index cbb3ab2ec..cf65283f0 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -29,100 +29,166 @@ on: branches: - "*" - "**/*" + env: VOICEVOX_RESOURCE_VERSION: "0.15.0-preview.1" VOICEVOX_FAT_RESOURCE_VERSION: "0.15.0-preview.0" # releaseタグ名か、workflow_dispatchでのバージョン名か、'0.0.0'が入る VERSION: ${{ github.event.release.tag_name || github.event.inputs.version || '0.0.0' }} PRODUCTION_REPOSITORY_TAG: "0.15.0-preview.0" # 製品版のタグ名 + # 簡易テストとするかどうか。releaseとworkflow_dispatch以外は簡易テストとする + IS_SIMPLE_TEST: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }} + defaults: run: shell: bash + jobs: + build_and_deploy_strategy_matrix: # 実行対象の条件をフィルタリングする + runs-on: ubuntu-latest + outputs: + includes: ${{ steps.strategy_matrix.outputs.includes }} + steps: + - name: declare strategy matrix + id: strategy_matrix + run: | + includes='[ + { + "os": "windows-2019", + "features": "", + "target": "x86_64-pc-windows-msvc", + "artifact_name": "windows-x64-cpu", + "whl_local_version": "cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "windows-2019", + "features": "directml", + "target": "x86_64-pc-windows-msvc", + "artifact_name": "windows-x64-directml", + "whl_local_version": "directml", + "use_cuda": false, + "can_skip_in_simple_test": false + }, + { + "os": "windows-2019", + "features": "", + "target": "x86_64-pc-windows-msvc", + "artifact_name": "windows-x64-cuda", + "whl_local_version": "cuda", + "use_cuda": true, + "can_skip_in_simple_test": true + }, + { + "os": "windows-2019", + "features": "", + "target": "i686-pc-windows-msvc", + "artifact_name": "windows-x86-cpu", + "whl_local_version": "cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "ubuntu-20.04", + "features": "", + "target": "x86_64-unknown-linux-gnu", + "artifact_name": "linux-x64-cpu", + "whl_local_version": "cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "ubuntu-20.04", + "features": "", + "target": "x86_64-unknown-linux-gnu", + "artifact_name": "linux-x64-gpu", + "whl_local_version": "cuda", + "use_cuda": true, + "can_skip_in_simple_test": false + }, + { + "os": "ubuntu-20.04", + "features": "", + "target": "aarch64-unknown-linux-gnu", + "artifact_name": "linux-arm64-cpu", + "whl_local_version": "cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "ubuntu-20.04", + "features": "", + "target": "aarch64-linux-android", + "artifact_name": "android-arm64-cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "ubuntu-20.04", + "features": "", + "target": "x86_64-linux-android", + "artifact_name": "android-x86_64-cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "macos-11", + "features": "", + "target": "aarch64-apple-darwin", + "artifact_name": "osx-arm64-cpu", + "whl_local_version": "cpu", + "use_cuda": false, + "can_skip_in_simple_test": false + }, + { + "os": "macos-11", + "features": "", + "target": "x86_64-apple-darwin", + "artifact_name": "osx-x64-cpu", + "whl_local_version": "cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "macos-12", + "features": "", + "target": "aarch64-apple-ios", + "artifact_name": "ios-arm64-cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "macos-12", + "features": "", + "target": "aarch64-apple-ios-sim", + "artifact_name": "ios-arm64-cpu-sim", + "use_cuda": false, + "can_skip_in_simple_test": true + }, + { + "os": "macos-12", + "features": "", + "target": "x86_64-apple-ios", + "artifact_name": "ios-x64-cpu", + "use_cuda": false, + "can_skip_in_simple_test": true + } + ]' + + # FIXME: composite action に切り出す + if ${{ env.IS_SIMPLE_TEST }}; then + includes=$(echo "$includes" | jq -c '[.[] | select(.can_skip_in_simple_test == false)]') + fi + includes=$(echo "$includes" | jq -c '[.[] | del(.can_skip_in_simple_test)]') + echo "includes=${includes}" >> "$GITHUB_OUTPUT" + build_and_deploy: + needs: build_and_deploy_strategy_matrix environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # 製品版のenvironment strategy: matrix: - include: - - os: windows-2019 - features: "" - target: x86_64-pc-windows-msvc - artifact_name: windows-x64-cpu - whl_local_version: cpu - use_cuda: false - - os: windows-2019 - features: directml - target: x86_64-pc-windows-msvc - artifact_name: windows-x64-directml - whl_local_version: directml - use_cuda: false - - os: windows-2019 - features: "" - target: x86_64-pc-windows-msvc - artifact_name: windows-x64-cuda - whl_local_version: cuda - use_cuda: true - - os: windows-2019 - features: "" - target: i686-pc-windows-msvc - artifact_name: windows-x86-cpu - whl_local_version: cpu - use_cuda: false - - os: ubuntu-20.04 - features: "" - target: x86_64-unknown-linux-gnu - artifact_name: linux-x64-cpu - whl_local_version: cpu - use_cuda: false - - os: ubuntu-20.04 - features: "" - target: x86_64-unknown-linux-gnu - artifact_name: linux-x64-gpu - whl_local_version: cuda - use_cuda: true - - os: ubuntu-20.04 - features: "" - target: aarch64-unknown-linux-gnu - artifact_name: linux-arm64-cpu - whl_local_version: cpu - use_cuda: false - - os: ubuntu-20.04 - features: "" - target: aarch64-linux-android - artifact_name: android-arm64-cpu - use_cuda: false - - os: ubuntu-20.04 - features: "" - target: x86_64-linux-android - artifact_name: android-x86_64-cpu - use_cuda: false - - os: macos-11 - features: "" - target: aarch64-apple-darwin - artifact_name: osx-arm64-cpu - whl_local_version: cpu - use_cuda: false - - os: macos-11 - features: "" - target: x86_64-apple-darwin - artifact_name: osx-x64-cpu - whl_local_version: cpu - use_cuda: false - - os: macos-12 - features: "" - target: aarch64-apple-ios - artifact_name: ios-arm64-cpu - use_cuda: false - - os: macos-12 - features: "" - target: aarch64-apple-ios-sim - artifact_name: ios-arm64-cpu-sim - use_cuda: false - - os: macos-12 - features: "" - target: x86_64-apple-ios - artifact_name: ios-x64-cpu - use_cuda: false + include: ${{ fromJson(needs.build_and_deploy_strategy_matrix.outputs.includes) }} runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 # 製品版ではない場合 @@ -272,7 +338,9 @@ jobs: files: |- ${{ steps.build-voicevox-core-python-api.outputs.whl }} target_commitish: ${{ github.sha }} + build_xcframework: + if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ needs: build_and_deploy runs-on: macos-12 steps: @@ -316,6 +384,7 @@ jobs: files: |- ${{ env.ASSET_NAME }}.zip target_commitish: ${{ github.sha }} + deploy_downloader: runs-on: ubuntu-latest steps: @@ -329,6 +398,7 @@ jobs: files: |- scripts/downloads/* target_commitish: ${{ github.sha }} + deploy_precompiled_downloader: environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # コード署名用のenvironment strategy: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f788c828..bb609b0b7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,13 +1,22 @@ name: test workflow + on: push: branches: - "*" - "**/*" pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + # 簡易テストとするかどうか。workflow_dispatch以外は簡易テストとする + IS_SIMPLE_TEST: ${{ github.event_name != 'workflow_dispatch' }} + defaults: run: shell: bash + jobs: shellcheck: runs-on: ubuntu-22.04 @@ -82,27 +91,38 @@ jobs: - name: Run cargo unit test run: RUST_BACKTRACE=full cargo test --lib --bins -vv --features , -- --include-ignored + rust-integration-test-strategy-matrix: # 実行対象の条件をフィルタリングする + runs-on: ubuntu-latest + outputs: + includes: ${{ steps.strategy-matrix.outputs.includes }} + steps: + - name: declare strategy matrix + id: strategy-matrix + run: | + includes='[ + { "os": "windows-2019", "features": "", "can_skip_in_simple_test": true }, + { "os": "windows-2022", "features": "", "can_skip_in_simple_test": true }, + { "os": "windows-2019", "features": "directml", "can_skip_in_simple_test": false }, + { "os": "windows-2022", "features": "directml", "can_skip_in_simple_test": true }, + { "os": "macos-11", "features": "", "can_skip_in_simple_test": false }, + { "os": "macos-12", "features": "", "can_skip_in_simple_test": true }, + { "os": "ubuntu-20.04", "features": "", "can_skip_in_simple_test": false }, + { "os": "ubuntu-22.04", "features": "", "can_skip_in_simple_test": true } + ]' + + # FIXME: composite action に切り出す + if ${{ env.IS_SIMPLE_TEST }}; then + includes=$(echo "$includes" | jq -c '[.[] | select(.can_skip_in_simple_test == false)]') + fi + includes=$(echo "$includes" | jq -c '[.[] | del(.can_skip_in_simple_test)]') + echo "includes=${includes}" >> "$GITHUB_OUTPUT" + rust-integration-test: + needs: rust-integration-test-strategy-matrix strategy: fail-fast: false matrix: - include: - - os: windows-2019 - features: "" - - os: windows-2022 - features: "" - - os: windows-2019 - features: directml - - os: windows-2022 - features: directml - - os: macos-11 - features: "" - - os: macos-12 - features: "" - - os: ubuntu-20.04 - features: "" - - os: ubuntu-22.04 - features: "" + include: ${{ fromJson(needs.rust-integration-test-strategy-matrix.outputs.includes) }} runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -232,7 +252,7 @@ jobs: working-directory: ${{env.GITHUB_WORKSPACE}} run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} - build-python-api: + build-and-test-python-api: strategy: fail-fast: false matrix: @@ -264,6 +284,3 @@ jobs: pip install -r requirements-test.txt pytest - -env: - CARGO_TERM_COLOR: always