From a4749af418a0e9aa277c86e0c987ac2a42d336a9 Mon Sep 17 00:00:00 2001 From: tarepan Date: Mon, 8 Apr 2024 00:26:23 +0900 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86:=20=E3=82=B7=E3=82=A7?= =?UTF-8?q?=E3=83=AB=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88=E3=81=AB?= =?UTF-8?q?=20lint=20=E3=82=92=E9=81=A9=E7=94=A8=20(#1122)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: shellcheck * fix: actionlint と ShellCheck の衝突 * fix: シェルチェッカー false alert の変数化による回避 * fix: ワークアラウンド意図をリンク化して簡略化 --- .github/workflows/build-engine-package.yml | 27 ++++++++++++++----- .../create_venv_and_generate_licenses.bash | 2 ++ build_util/process_voicevox_resource.bash | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-engine-package.yml b/.github/workflows/build-engine-package.yml index 46b48c424..e318f2c90 100644 --- a/.github/workflows/build-engine-package.yml +++ b/.github/workflows/build-engine-package.yml @@ -153,7 +153,10 @@ jobs: CUDA_ROOT=$( echo "${{ steps.cuda-toolkit.outputs.CUDA_PATH }}" | tr '\\' '/' ) mkdir -p download/cuda/bin - if [[ ${{ matrix.os }} == windows-* ]]; then + # NOTE 1: actionlint による GitHub Actions 文法の暗示的 `________________` 置換が SchellCheck の `never be equal` エラーを起こさないように、変数代入する + # 一度代入して actionlint のエラー回避 (詳細: NOTE 1) + OS=${{ matrix.os }} + if [[ $OS == windows-* ]]; then mv "${CUDA_ROOT}/bin/"*.dll download/cuda/bin/ # remove CUDA to reduce disk usage @@ -202,7 +205,9 @@ jobs: run: | set -eux - if [[ ${{ matrix.os }} == windows-* ]]; then + # 一度代入して actionlint のエラー回避 (詳細: NOTE 1) + OS=${{ matrix.os }} + if [[ $OS == windows-* ]]; then curl -L "${{ matrix.cudnn_url }}" > download/cudnn.zip unzip download/cudnn.zip cudnn-*/bin/*.dll -d download/cudnn_tmp @@ -358,7 +363,9 @@ jobs: curl -L "${{ matrix.onnxruntime_url }}" > download/onnxruntime.zip # extract only dlls - if [[ ${{ matrix.target }} != *-directml ]]; then + # 一度代入して actionlint のエラー回避 (詳細: NOTE 1) + TARGET=${{ matrix.target }} + if [[ $TARGET != *-directml ]]; then unzip download/onnxruntime.zip onnxruntime-*/lib/*.dll -d download/ mv download/onnxruntime-* download/onnxruntime else @@ -420,7 +427,9 @@ jobs: VOICEVOX_CORE_ASSET_NAME: ${{ matrix.voicevox_core_asset_prefix }}-${{ env.VOICEVOX_CORE_VERSION }} run: | curl -L "https://github.com/VOICEVOX/voicevox_core/releases/download/${{ env.VOICEVOX_CORE_VERSION }}/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip" > download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip - if [[ ${{ matrix.os }} == mac-* ]]; then + # 一度代入して actionlint のエラー回避 (詳細: NOTE 1) + OS=${{ matrix.os }} + if [[ $OS == mac-* ]]; then ditto -x -k --sequesterRsrc --rsrc download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip download/ else unzip download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip -d download/ @@ -446,10 +455,12 @@ jobs: # Replace version & specify dynamic libraries $sed -i "s/__version__ = \"latest\"/__version__ = \"${{ needs.config.outputs.version_or_latest }}\"/" voicevox_engine/__init__.py - if [[ ${{ matrix.os }} == windows-* ]]; then + # 一度代入して actionlint のエラー回避 (詳細: NOTE 1) + OS=${{ matrix.os }} + if [[ $OS == windows-* ]]; then LIBCORE_PATH=download/core/voicevox_core.dll LIBONNXRUNTIME_PATH=download/onnxruntime/lib/onnxruntime.dll - elif [[ ${{ matrix.os }} == macos-* ]]; then + elif [[ $OS == macos-* ]]; then LIBCORE_PATH=download/core/libvoicevox_core.dylib LIBONNXRUNTIME_PATH=download/onnxruntime/lib/libonnxruntime.dylib else @@ -494,7 +505,9 @@ jobs: rm -rf download/zlib fi - if [[ ${{ matrix.target }} == *-directml ]]; then + # 一度代入して actionlint のエラー回避 (詳細: NOTE 1) + TARGET=${{ matrix.target }} + if [[ $TARGET == *-directml ]]; then # DirectML mv download/directml/DirectML.dll dist/run/ diff --git a/build_util/create_venv_and_generate_licenses.bash b/build_util/create_venv_and_generate_licenses.bash index fc9dd0dc5..29f8af57b 100644 --- a/build_util/create_venv_and_generate_licenses.bash +++ b/build_util/create_venv_and_generate_licenses.bash @@ -11,8 +11,10 @@ VENV_PATH="licenses_venv" python -m venv $VENV_PATH if [ -d "$VENV_PATH/Scripts" ]; then + # shellcheck disable=SC1091 source $VENV_PATH/Scripts/activate else + # shellcheck disable=SC1091 source $VENV_PATH/bin/activate fi diff --git a/build_util/process_voicevox_resource.bash b/build_util/process_voicevox_resource.bash index c085dfeee..410ca1b7e 100644 --- a/build_util/process_voicevox_resource.bash +++ b/build_util/process_voicevox_resource.bash @@ -22,6 +22,6 @@ python build_util/merge_update_infos.py \ "${DOWNLOAD_RESOURCE_PATH}/engine/engine_manifest_assets/update_infos.json" \ engine_manifest_assets/update_infos.json -for f in $(ls $DOWNLOAD_RESOURCE_PATH/engine/engine_manifest_assets/* | grep -v update_infos.json); do +for f in $(ls "${DOWNLOAD_RESOURCE_PATH}"/engine/engine_manifest_assets/* | grep -v update_infos.json); do cp "${f}" ./engine_manifest_assets/ done