From 0ef03a65052e014cce38025b15a9b2694b34ec3d Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Sat, 9 Sep 2023 23:21:00 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88?= =?UTF-8?q?=E7=89=88=E3=81=AE=E3=83=80=E3=82=A6=E3=83=B3=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=83=80=E3=82=92=E6=B6=88=E5=8E=BB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_deploy.yml | 14 -- .github/workflows/download_test.yml | 115 ------------- .github/workflows/psscriptanalyzer.yml | 25 --- scripts/downloads/download.ps1 | 156 ------------------ scripts/downloads/download.sh | 214 ------------------------- 5 files changed, 524 deletions(-) delete mode 100644 .github/workflows/psscriptanalyzer.yml delete mode 100755 scripts/downloads/download.ps1 delete mode 100755 scripts/downloads/download.sh diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index b315335e1..cdc2d1c7a 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -389,17 +389,3 @@ jobs: files: |- ${{ env.ASSET_NAME }}.zip target_commitish: ${{ github.sha }} - - deploy_downloader: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Upload to Release - if: env.VERSION != '0.0.0' - uses: softprops/action-gh-release@v1 - with: - prerelease: true - tag_name: ${{ env.VERSION }} - files: |- - scripts/downloads/* - target_commitish: ${{ github.sha }} diff --git a/.github/workflows/download_test.yml b/.github/workflows/download_test.yml index 4ae0f972d..86f728d20 100644 --- a/.github/workflows/download_test.yml +++ b/.github/workflows/download_test.yml @@ -7,7 +7,6 @@ on: paths: - "Cargo.*" - "crates/download/**" - - "scripts/downloads/*" - ".github/workflows/download_test.yml" defaults: run: @@ -168,120 +167,6 @@ jobs: cufft64_*.dll curand64_*.dll open_jtalk_dic_utf_8-1.11 - - name: 通常ダウンロード - os: ubuntu-latest - download_command: ./scripts/downloads/download.sh - download_dir: voicevox_core - check_items: | - libvoicevox_core.so - model/metas.json - open_jtalk_dic_utf_8-1.11 - README.txt - check_not_exists_items: | - *directml* - *cuda* - *cudnn* - *onnxruntime*providers* - *eula* - *nvidia* - *cufft* - *curand* - - name: CPUArch指定 - os: ubuntu-latest - download_command: ./scripts/downloads/download.sh --cpu-arch x64 - download_dir: voicevox_core - check_items: | - libvoicevox_core.so - model/metas.json - open_jtalk_dic_utf_8-1.11 - README.txt - check_not_exists_items: | - *directml* - *cuda* - *cudnn* - *onnxruntime*providers* - *eula* - *nvidia* - *cufft* - *curand* - - name: output先指定ダウンロード - os: ubuntu-latest - download_command: ./scripts/downloads/download.sh --output other_output - download_dir: other_output - check_items: | - libvoicevox_core.so - model/metas.json - open_jtalk_dic_utf_8-1.11 - README.txt - check_not_exists_items: | - *directml* - *cuda* - *cudnn* - *onnxruntime*providers* - *eula* - *nvidia* - *cufft* - *curand* - - name: min option確認 - os: ubuntu-latest - download_command: ./scripts/downloads/download.sh --min - download_dir: voicevox_core - check_items: | - libvoicevox_core.so - model/metas.json - README.txt - check_not_exists_items: | - *directml* - *cuda* - *cudnn* - *onnxruntime*providers* - *eula* - *nvidia* - *cufft* - *curand* - open_jtalk_dic_utf_8-1.11 - - name: cuda option確認 - os: ubuntu-latest - download_command: ./scripts/downloads/download.sh --device cuda - download_dir: voicevox_core - check_items: | - libvoicevox_core.so - model/metas.json - open_jtalk_dic_utf_8-1.11 - README.txt - EULA.txt - NVIDIA_SLA_cuDNN_Support.txt - libcublas.so.* - libcublasLt.so.* - libcudnn.so.* - libcudnn_adv_infer.so.* - libcudnn_cnn_infer.so.* - libcudnn_ops_infer.so.* - libcufft.so.* - libcurand.so.* - check_not_exists_items: | - *directml* - - name: cudaかつmin option確認 - os: ubuntu-latest - download_command: ./scripts/downloads/download.sh --device cuda --min - download_dir: voicevox_core - check_items: | - libvoicevox_core.so - model/metas.json - README.txt - check_not_exists_items: | - *directml* - EULA.txt - NVIDIA_SLA_cuDNN_Support.txt - libcublas.so.* - libcublasLt.so.* - libcudnn.so.* - libcudnn_adv_infer.so.* - libcudnn_cnn_infer.so.* - libcudnn_ops_infer.so.* - libcufft.so.* - libcurand.so.* - open_jtalk_dic_utf_8-1.11 runs-on: ${{ matrix.os }} name: ${{ matrix.name }}-${{ matrix.os }} env: diff --git a/.github/workflows/psscriptanalyzer.yml b/.github/workflows/psscriptanalyzer.yml deleted file mode 100644 index 148efcb43..000000000 --- a/.github/workflows/psscriptanalyzer.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: PSScriptAnalyzer -on: - push: - branches: - - main - paths: - - '**.ps1' - - '.github/workflows/psscriptanalyzer.yml' -defaults: - run: - shell: bash -jobs: - psscriptanalyzer: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: PSScriptAnalyzer - uses: microsoft/psscriptanalyzer-action@v1.1 - with: - recurse: true - - name: Upload the SARIF file - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: results.sarif - category: psscriptanalyzer diff --git a/scripts/downloads/download.ps1 b/scripts/downloads/download.ps1 deleted file mode 100755 index 10d0310ac..000000000 --- a/scripts/downloads/download.ps1 +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env pwsh - -<# - .DESCRIPTION - voicevox_coreをダウンロードするためのスクリプト -#> - - -Param( - [Parameter()] - [String] - [Alias("o")] - # 出力先の指定 - $Output = "./voicevox_core", - [Parameter()] - [String] - [Alias("v")] - # ダウンロードするvoicevox_coreのバージョンの指定 - $Version = "latest", - [Parameter()] - [String] - # 追加ダウンロードするライブラリのバージョンの指定 - $AdditionalLibrariesVersion = "latest", - [Parameter()] - [ValidateSet("cpu","cuda","directml")] - [string] - # ダウンロードするデバイスを指定する(cpu,cuda,directmlを指定可能) - $Device = "cpu", - [Parameter()] - [bool] - # ダウンロードするライブラリを最小限にするように指定 - $Min = $False, - [Parameter()] - [ValidateSet("x86","x64")] - [String] - # CPUアーキテクチャの指定 - $CpuArch = "" -) -mkdir -p $Output -If (-Not(Split-Path $Output -IsAbsolute)){ - $Output=Resolve-Path $Output -} - -$VoicevoxCoreRepositoryBaseUrl="https://github.com/VOICEVOX/voicevox_core" -$VoicevoxAdditionalLibrariesBaseUrl="https://github.com/VOICEVOX/voicevox_additional_libraries" -$OpenJtalkDictUrl="https://jaist.dl.sourceforge.net/project/open-jtalk/Dictionary/open_jtalk_dic-1.11/open_jtalk_dic_utf_8-1.11.tar.gz" -$OpenJtalkDictDirName="open_jtalk_dic_utf_8-1.11" - -Function Voicevox-Core-Releases-Url($Os,$CpuArch,$Device,$Version){ - "${VoicevoxCoreRepositoryBaseUrl}/releases/download/${Version}/voicevox_core-${Os}-${CpuArch}-${Device}-${Version}.zip" -} - -Function Voicevox-Additional-Libraries-Releases-Url($Os,$CpuArch,$Device,$Version){ - If ( $Device -eq "cuda" ){ - $Device="CUDA" - } ElseIf ( $Device -eq "directml" ){ - $Device="DirectML" - } - - "${VoicevoxAdditionalLibrariesBaseUrl}/releases/download/${Version}/${Device}-${Os}-${CpuArch}.zip" -} - -Function Latest-Version($BaseUrl){ - $GetLatestUrl = "${BaseUrl}/releases/tag" - try{Invoke-WebRequest "${BaseUrl}/releases/latest" -Method "Get" -MaximumRedirection 0 }catch{$_.Exception.Response.Headers.Location -replace "${GetLatestUrl}/","" } -} - -Function Latest-Voicevox-Core-Version(){ - Latest-Version $VoicevoxCoreRepositoryBaseUrl -} - -Function Latest-Voicevox-Additional-Libraries-Version(){ - Latest-Version $VoicevoxAdditionalLibrariesBaseUrl -} - - -Function Target-Os(){ - "windows" -} - -Function Target-Arch(){ - # TODO: cpu architectureの判定を実装する - "x64" -} - -Function Download-and-Extract($Target,$Url,$ExtractDir,$ArchiveFormat){ - $TmpPath=New-TemporaryFile - - if ( [string]::IsNullOrEmpty($ArchiveFormat) ){ - if ( $Url.EndsWith(".tar.gz") ){ - $ArchiveFormat="tar.gz" - } else { - $ArchiveFormat="zip" - } - } - - echo "${Target}を${Url}からファイルをダウンロードします..." - Invoke-WebRequest "${Url}" -OutFile "${TmpPath}" - echo "${Target}をダウンロード完了,${ArchiveFormat}形式で${ExtractDir}に解凍します..." - If( $ArchiveFormat -eq "zip" ){ - $Zip=[System.IO.Compression.ZipFile]::OpenRead("${TmpPath}") - $Zip.Entries.ForEach{ - if ([string]::IsNullOrEmpty($_.Name)){ - return - } - $FixedName=$_.FullName.Replace('\', '/') - $NewFile=[IO.FileInfo]([IO.Path]::Combine($ExtractDir,$FixedName.SubString($FixedName.IndexOf('/') + 1))) - $NewFile.Directory.Create() - [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_,$NewFile) - } - $Zip.Dispose() - }ElseIf( $ArchiveFormat -eq "tar.gz" ){ - mkdir -p "$ExtractDir" - tar --strip-components 1 -xvzf "$TmpPath" -C "$ExtractDir" - } - echo "${Target}のファイルを展開完了しました" -} - -$Os=Target-Os -$OpenJtalkOutput= Join-Path $Output $OpenJtalkDictDirName - -If ( [string]::IsNullOrEmpty($CpuArch) ){ - $CpuArch=Target-Arch -} - -If ( $Device -eq "cpu" ){ - $AdditionalLibrariesVersion="" -} - -If ( $Version -eq "latest" ){ - $Version=Latest-Voicevox-Core-Version -} - -If ( $AdditionalLibrariesVersion -eq "latest" ){ - $AdditionalLibrariesVersion=Latest-Voicevox-Additional-Libraries-Version -} - -echo "対象OS:$Os" -echo "対象CPUアーキテクチャ:$cpu_arch" -echo "ダウンロードvoicevox_coreバージョン:$version" -echo "ダウンロードアーティファクトタイプ:$Device" -echo "出力先:$Output" - -$VoicevoxCoreUrl=Voicevox-Core-Releases-Url "$Os" "$CpuArch" "$Device" "$Version" -$VoicevoxAdditionalLibrariesUrl=Voicevox-Additional-Libraries-Releases-Url "$Os" "$CpuArch" "$Device" "$AdditionalLibrariesVersion" - -Download-and-Extract "voicevox_core" "$VoicevoxCoreUrl" "$Output" - -if ( -not $Min ){ - Download-and-Extract "open_jtalk" "$OpenJtalkDictUrl" "$OpenJtalkOutput" - if ( -not $AdditionalLibrariesVersion -eq "" ){ - Download-and-Extract "voicevox_additional_libraries" "$VoicevoxAdditionalLibrariesUrl" "$Output" - } -} - -echo "全ての必要なファイルダウンロードが完了しました" diff --git a/scripts/downloads/download.sh b/scripts/downloads/download.sh deleted file mode 100755 index c3093f402..000000000 --- a/scripts/downloads/download.sh +++ /dev/null @@ -1,214 +0,0 @@ -#!/usr/bin/env bash -set -eu -help(){ - cat <&2 - exit 1 - fi -} - -target_arch(){ - cpu_arch=$(uname -m) - case "$cpu_arch" in - "x86_64") echo "x64";; - "arm64") echo "arm64";; - *) - echo "$cpu_archはサポートされていない環境です" >&2 - exit 1;; - esac -} - -download_and_extract(){ - target=$1 - url=$2 - extract_dir=$3 - archive_format="${4+x}" - if [[ "$archive_format" == "" ]]; then - if [[ "$url" == *.tar.gz ]]; then - archive_format="tar.gz" - else - archive_format="zip" - fi - fi - - echo "${target}を${url}からファイルをダウンロードします..." - tmp_path=$(mktemp) - curl -sSLfo "$tmp_path" "$url" - echo "${target}をダウンロード完了,${archive_format}形式で${extract_dir}に解凍します..." - if [ "$archive_format" = "zip" ];then - top_dir=$(unzip -Z1 "$tmp_path" | head -n 1) - unzip "$tmp_path" -d "$extract_dir" - mv "$extract_dir/$top_dir"/* "$extract_dir" - rmdir "$extract_dir/$top_dir" - elif [ "$archive_format" = "tar.gz" ];then - mkdir -p "$extract_dir" - tar --strip-components 1 -xvzf "$tmp_path" -C "$extract_dir" - fi - echo "${target}のファイルを展開完了しました。後続のファイルダウンロード処理を待ってください" -} - -os="" -cpu_arch="" -version="latest" -additional_libraries_version="latest" -device="" -output="./voicevox_core" -min="" - - - - -while [ $# -gt 0 ]; -do - case $1 in - -h|--help ) help;; - -o|--output) - output="$2" - shift;; - -v|--version) - version="$2" - shift;; - --additional-libraries-version) - additional_libraries_version="$2" - shift;; - --device) - device="$2" - shift;; - --cpu-arch) - cpu_arch="$2" - shift;; - --min) - min=true - ;; - --os) - os="$2" - shift;; - *) - echo "サポートされていないオプションです" >&2 - exit 1;; - esac - shift -done - -open_jtalk_output="${output%/}/$open_jtalk_dict_dir_name" - -if [ -z "$os" ];then - os=$(target_os) -fi - -if [ -z "$cpu_arch" ];then - cpu_arch=$(target_arch) -fi - -if [ "$device" = "" ];then - device="cpu" -fi - -if [ "$device" = "cpu" ];then - additional_libraries_version="" -fi - -# zipファイルに厳格なバージョン番号が含まれるため、latestだった場合はバージョンを特定して設定する -if [ "$version" = "latest" ];then - version=$(latest_voicevox_core_version) -fi - -if [ "$additional_libraries_version" != "" ] && [ "$additional_libraries_version" = "latest" ];then - additional_libraries_version=$(latest_voicevox_additional_libraries_version) -fi - -echo "対象OS:$os" -echo "対象CPUアーキテクチャ:$cpu_arch" -echo "ダウンロードvoicevox_coreバージョン:$version" -echo "ダウンロードデバイスタイプ:$device" - -if [ "$additional_libraries_version" != "" ];then - echo "ダウンロード追加ライブラリバージョン:$additional_libraries_version" -fi - - -voicevox_core_url=$(voicevox_core_releases_url "$os" "$cpu_arch" "$device" "$version") -voicevox_additional_libraries_url=$(voicevox_additional_libraries_url "$os" "$cpu_arch" "$device" "$additional_libraries_version") - -download_and_extract "voicevox_core" "$voicevox_core_url" "$output" & -voicevox_core_download_task=$! -if [ "$min" != "true" ]; then - download_and_extract "open_jtalk" "$open_jtalk_dict_url" "$open_jtalk_output" & - open_jtalk_download_task=$! - - if [ "$additional_libraries_version" != "" ];then - download_and_extract "voicevox_additional_libraries" "$voicevox_additional_libraries_url" "$output" & - additional_libraries_download_task=$! - wait $additional_libraries_download_task - fi - - wait $open_jtalk_download_task -fi -wait $voicevox_core_download_task - -echo "全ての必要なファイルダウンロードが完了しました"