Skip to content

Commit

Permalink
Rust版ダウンローダーを追加する (VOICEVOX#375)
Browse files Browse the repository at this point in the history
* open_jtalk_dicをダウンロードする

* `download`のバージョンはセットしない

* ZIPの内容を見るためファイルに吐き出していたのを消す

* `join_all`を使う

* コピペコードを排除

* リファクタ & bug fix

* バイナリ自体のarchを使う

* `default_value`の指定は`Default`からの`IntoStaticStr`にする

* `Accelerator`も同様

* `OptionFuture`を使う

* rayonを使う

* Fix Cargo.lock

* `build_and_deploy`でビルド

* Bashを修正

* Minor refactor

* `native-tls` → `rustls-tls`

* `ProgressStyle`を設定

* PowerShell版の代わりにRust版をテストする

* `secrets.GITHUB_TOKEN`を使う

* `ProgressStyle`を調整

* [wip] ダウンロード→解凍の手順をひとまとめにする

* 2,3段階目のspinnerを用意する

* octocrabへのPRはマージされたので切り替える

* `Aarch64` → `Arm64`

`osx-aarch64-cpu`は`osx-arm64-cpu`に改名される前提にしてしまう。 (VOICEVOX#397)

* `Vec`のcapacityをちゃんと設定

* `$GITHUB_TOKEN`を使っているところにコメント

* `new_pb` → `add_progress_bar`
  • Loading branch information
qryxip authored Jan 28, 2023
1 parent 490d628 commit dc53546
Show file tree
Hide file tree
Showing 9 changed files with 1,461 additions and 67 deletions.
52 changes: 51 additions & 1 deletion .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
if: ${{ env.VERSION != 'DEBUG' }}
shell: bash
run: |
cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude xtask
cargo set-version "$VERSION" --exclude voicevox_core_python_api --exclude download --exclude xtask
cargo set-version "$VERSION+"${{ matrix.whl_local_version }} -p voicevox_core_python_api
- name: generate voicevox_core.h
shell: bash
Expand Down Expand Up @@ -192,3 +192,53 @@ jobs:
files: |-
scripts/downloads/*
target_commitish: ${{ github.sha }}
deploy_precompiled_downloader:
strategy:
matrix:
include:
- name: download-windows-x64.exe
target: x86_64-pc-windows-msvc
os: windows-2019
- name: download-linux-x64
target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
- name: download-linux-aarch64
target: aarch64-unknown-linux-gnu
os: ubuntu-20.04
- name: download-osx-x64
target: x86_64-apple-darwin
os: macos-11
- name: download-osx-aarch64
target: aarch64-apple-darwin
os: macos-11
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install cross compiler for aarch64-unknown-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'
shell: bash
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Set up ${{ matrix.target }}
uses: ./.github/actions/rust-toolchain-from-file
with:
targets: ${{ matrix.target }}
- name: Build downloader
run: cargo build -vv --release -p download --target ${{ matrix.target }}
- name: Rename the binary
shell: bash
run: |
case "$OS" in
Windows) exe_suffix=.exe;;
Linux | macOS) exe_suffix=;;
esac
mv $"target/${{ matrix.target }}/release/download$exe_suffix" ./${{ matrix.name }}
- name: Upload to Release
if: env.VERSION != 'DEBUG' && env.SKIP_UPLOADING_RELEASE_ASSET == '0'
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.VERSION }}
files: ${{ matrix.name }}
target_commitish: ${{ github.sha }}
21 changes: 13 additions & 8 deletions .github/workflows/download_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
include:
- name: 通常ダウンロード
os: windows-latest
download_command: ./scripts/downloads/Download.ps1
download_command: cargo run -vv -p download
download_dir: voicevox_core
check_items: |
core.dll
Expand All @@ -32,7 +32,7 @@ jobs:
*curand*
- name: CpuArch指定
os: windows-latest
download_command: ./scripts/downloads/Download.ps1 -CpuArch x86
download_command: cargo run -vv -p download -- --cpu-arch x86
download_dir: voicevox_core
check_items: |
core.dll
Expand All @@ -49,7 +49,7 @@ jobs:
*curand*
- name: output先指定ダウンロード
os: windows-latest
download_command: ./scripts/downloads/Download.ps1 -Output other_output
download_command: cargo run -vv -p download -- -o other_output
download_dir: other_output
check_items: |
core.dll
Expand All @@ -66,7 +66,7 @@ jobs:
*curand*
- name: Min option確認
os: windows-latest
download_command: ./scripts/downloads/Download.ps1 -Min $True
download_command: cargo run -vv -p download -- --min
download_dir: voicevox_core
check_items: |
core.dll
Expand All @@ -83,7 +83,7 @@ jobs:
open_jtalk_dic_utf_8-1.11
- name: DirectML option確認
os: windows-latest
download_command: ./scripts/downloads/Download.ps1 -Accelerator directml
download_command: cargo run -vv -p download -- --accelerator directml
download_dir: voicevox_core
check_items: |
core.dll
Expand All @@ -101,7 +101,7 @@ jobs:
*curand*
- name: DirectMLかつMin option確認
os: windows-latest
download_command: ./scripts/downloads/Download.ps1 -Accelerator directml -Min $true
download_command: cargo run -vv -p download -- --accelerator directml --min
download_dir: voicevox_core
check_items: |
core.dll
Expand All @@ -118,7 +118,7 @@ jobs:
open_jtalk_dic_utf_8-1.11
- name: cuda option確認
os: windows-latest
download_command: ./scripts/downloads/Download.ps1 -Accelerator cuda
download_command: cargo run -vv -p download -- --accelerator cuda
download_dir: voicevox_core
check_items: |
core.dll
Expand All @@ -139,7 +139,7 @@ jobs:
*directml*
- name: cudaかつmin option確認
os: windows-latest
download_command: ./scripts/downloads/Download.ps1 -Accelerator cuda -Min $true
download_command: cargo run -vv -p download -- --accelerator cuda --min
download_dir: voicevox_core
check_items: |
core.dll
Expand Down Expand Up @@ -274,8 +274,13 @@ jobs:
#EXPECTED_VOICEVOX_CORE_VERSION: ${{ matrix.expected_version || 'latest' }}
steps:
- uses: actions/checkout@v3
- name: Set up Rust
if: ${{ startsWith(matrix.download_command, 'cargo ') }}
uses: ./.github/actions/rust-toolchain-from-file
- name: Execute download command
run: ${{ matrix.download_command }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest version
if: ${{ env.EXPECTED_VOICEVOX_CORE_VERSION == 'latest' }}
shell: bash
Expand Down
Loading

0 comments on commit dc53546

Please sign in to comment.