Skip to content

Commit

Permalink
ビルドを全通り試さない簡易テストモードを追加する (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Jul 31, 2023
1 parent f1dd63b commit 4073435
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 101 deletions.
230 changes: 150 additions & 80 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 # 製品版ではない場合
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -316,6 +384,7 @@ jobs:
files: |-
${{ env.ASSET_NAME }}.zip
target_commitish: ${{ github.sha }}

deploy_downloader:
runs-on: ubuntu-latest
steps:
Expand All @@ -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:
Expand Down
59 changes: 38 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,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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -264,6 +284,3 @@ jobs:
pip install -r requirements-test.txt
pytest
env:
CARGO_TERM_COLOR: always

0 comments on commit 4073435

Please sign in to comment.