Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ビルドを全通り試さない簡易テストモードを追加する #554

Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 149 additions & 80 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,100 +29,165 @@ 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
}
]'

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"
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved

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 # 製品版ではない場合
Expand Down Expand Up @@ -272,7 +337,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 と同じ
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここではenvを使えないのでこういう風に書くしかない・・・。

needs: build_and_deploy
runs-on: macos-12
steps:
Expand Down Expand Up @@ -316,6 +383,7 @@ jobs:
files: |-
${{ env.ASSET_NAME }}.zip
target_commitish: ${{ github.sha }}

deploy_downloader:
runs-on: ubuntu-latest
steps:
Expand All @@ -329,6 +397,7 @@ jobs:
files: |-
scripts/downloads/*
target_commitish: ${{ github.sha }}

deploy_precompiled_downloader:
environment: ${{ github.event.inputs.is_production == 'true' && 'production' || '' }} # コード署名用のenvironment
strategy:
Expand Down
58 changes: 37 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -82,27 +91,37 @@ 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 }
]'

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
Expand Down Expand Up @@ -232,7 +251,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:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

テストもしていることに気づいたので名称変更

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -264,6 +283,3 @@ jobs:

pip install -r requirements-test.txt
pytest

env:
CARGO_TERM_COLOR: always
Comment on lines -268 to -269
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

他にenvを使うものが増えたので上に移動

Loading