Skip to content

Commit

Permalink
整理: シェルスクリプトに lint を適用 (#1122)
Browse files Browse the repository at this point in the history
* fix: shellcheck

* fix: actionlint と ShellCheck の衝突

* fix: シェルチェッカー false alert の変数化による回避

* fix: ワークアラウンド意図をリンク化して簡略化
  • Loading branch information
tarepan authored Apr 7, 2024
1 parent aec2e2d commit a4749af
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/build-engine-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand All @@ -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
Expand Down Expand Up @@ -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/
Expand Down
2 changes: 2 additions & 0 deletions build_util/create_venv_and_generate_licenses.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion build_util/process_voicevox_resource.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a4749af

Please sign in to comment.