Skip to content

Commit

Permalink
darwin-arm64プラットフォーム対応 (#2112)
Browse files Browse the repository at this point in the history
* darwin-arm64プラットフォーム対応

* アクションのmacOSビルドでアドホック署名

* macOSの`.app`ファイルが正しい構造を持つように修正

Contents/MacOSフォルダには実行ファイルのみが存在するべきですが、
その他のファイルも含まれていたため、正しい構造ではなく、
コード署名が失敗しました。

* テストからmacOS arm64を一時的に除外

Co-Authored-By: Hiroshiba <hihokaruta@gmail.com>

---------

Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
  • Loading branch information
nix6839 and Hiroshiba authored Jun 4, 2024
1 parent b0c800e commit ebdb854
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
44 changes: 32 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:

env:
VOICEVOX_ENGINE_REPO_URL: "https://github.com/VOICEVOX/voicevox_engine"
VOICEVOX_ENGINE_VERSION: 0.19.1
VOICEVOX_ENGINE_VERSION: 0.20-preview.0
VOICEVOX_RESOURCE_VERSION: 0.19.1
VOICEVOX_EDITOR_VERSION:
|- # releaseタグ名か、workflow_dispatchでのバージョン名か、999.999.999-developが入る
Expand Down Expand Up @@ -55,7 +55,8 @@ jobs:
- windows-nvidia-prepackage
- windows-cpu-prepackage
- windows-directml-prepackage
- macos-cpu-prepackage
- macos-x64-cpu-prepackage
- macos-arm64-cpu-prepackage
include:
# Linux NVIDIA GPU
- artifact_name: linux-nvidia-prepackage
Expand Down Expand Up @@ -111,16 +112,26 @@ jobs:
installer_artifact_name: windows-directml-nsis-web
nsis_web_artifact_name: "VOICEVOX.Web.Setup.${version}.${ext}"
os: windows-2019
# macOS CPU
- artifact_name: macos-cpu-prepackage
# macOS CPU (x64)
- artifact_name: macos-x64-cpu-prepackage
artifact_path: dist_electron/mac
voicevox_engine_asset_name: macos-x64
package_name: voicevox-cpu
compressed_artifact_name: voicevox-macos-cpu
compressed_artifact_name: voicevox-macos-x64-cpu
app_asar_dir: prepackage/VOICEVOX.app/Contents/Resources
installer_artifact_name: macos-cpu-dmg
macos_artifact_name: "VOICEVOX.${version}.${ext}"
installer_artifact_name: macos-x64-cpu-dmg
macos_artifact_name: "VOICEVOX.${version}-x64.${ext}"
os: macos-12
# macOS CPU (arm64)
- artifact_name: macos-arm64-cpu-prepackage
artifact_path: dist_electron/mac-arm64
voicevox_engine_asset_name: macos-arm64
package_name: voicevox-cpu
compressed_artifact_name: voicevox-macos-arm64-cpu
app_asar_dir: prepackage/VOICEVOX.app/Contents/Resources
installer_artifact_name: macos-arm64-cpu-dmg
macos_artifact_name: "VOICEVOX.${version}-arm64.${ext}"
os: macos-14

runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -194,11 +205,16 @@ jobs:
cp resource/editor/PRIVACYPOLICY.md public/privacyPolicy.md
- name: Overwrite .env.production for Linux and macOS
if: startsWith(matrix.os, 'ubuntu-') || startsWith(matrix.os, 'macos-')
- name: Overwrite .env.production for Linux
if: startsWith(matrix.os, 'ubuntu-')
run: |
$sed -i 's|run.exe|./run|g' .env.production
- name: Overwrite .env.production for macOS
if: startsWith(matrix.os, 'macos-')
run: |
$sed -i 's|vv-engine/run.exe|../Resources/vv-engine/run|g' .env.production
- name: Replace .env.production infomations
run: |
# GTM ID
Expand Down Expand Up @@ -280,10 +296,10 @@ jobs:
run: |
mv voicevox_engine/ prepackage/vv-engine/
- name: Merge VOICEVOX ENGINE into prepackage/VOICEVOX.app/Contents/MacOS/
- name: Merge VOICEVOX ENGINE into prepackage/VOICEVOX.app/Contents/Resources/
if: startsWith(matrix.artifact_name, 'macos-')
run: |
mv voicevox_engine/ prepackage/VOICEVOX.app/Contents/MacOS/vv-engine/
mv voicevox_engine/ prepackage/VOICEVOX.app/Contents/Resources/vv-engine/
- name: Recover file permissions
if: startsWith(matrix.artifact_name, 'linux-') # linux
Expand All @@ -294,7 +310,7 @@ jobs:
- name: Recover file permissions for macOS build
if: startsWith(matrix.artifact_name, 'macos-') # macOS
run: |
chmod +x "prepackage/VOICEVOX.app/Contents/MacOS/vv-engine/run"
chmod +x "prepackage/VOICEVOX.app/Contents/Resources/vv-engine/run"
chmod +x "prepackage/VOICEVOX.app/Contents/Frameworks/VOICEVOX Helper (GPU).app/Contents/MacOS/VOICEVOX Helper (GPU)"
chmod +x "prepackage/VOICEVOX.app/Contents/Frameworks/VOICEVOX Helper (Plugin).app/Contents/MacOS/VOICEVOX Helper (Plugin)"
chmod +x "prepackage/VOICEVOX.app/Contents/Frameworks/VOICEVOX Helper (Renderer).app/Contents/MacOS/VOICEVOX Helper (Renderer)"
Expand All @@ -306,6 +322,10 @@ jobs:
if: startsWith(matrix.artifact_name, 'macos-')
run: mkdir -p prepackage/VOICEVOX.app/Contents/Resources/ja.lproj prepackage/VOICEVOX.app/Contents/Resources/en.lproj

- name: Ad hoc code signing
if: endsWith(matrix.installer_artifact_name, '-dmg') # macOS
run: codesign --force --deep -s - prepackage/VOICEVOX.app

- name: Create Linux tar.gz (without nvidia)
if: startsWith(matrix.artifact_name, 'linux-') && !contains(matrix.artifact_name, 'nvidia')
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ jobs:
voicevox_engine_asset_name: linux-cpu
- os: macos-latest
voicevox_engine_asset_name: macos-x64
# TODO: voicevox_nemo_negineがarm64に対応したら変更する
# - os: macos-latest
# voicevox_engine_asset_name: macos-arm64
- os: windows-latest
voicevox_engine_asset_name: windows-cpu
steps:
Expand Down
4 changes: 3 additions & 1 deletion electron-builder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const WIN_SIGNING_HASH_ALGORITHMS = process.env.WIN_SIGNING_HASH_ALGORITHMS

const isMac = process.platform === "darwin";

const isArm64 = process.arch === "arm64";

// electron-builderのextraFilesは、ファイルのコピー先としてVOICEVOX.app/Contents/を使用する。
// しかし、実行ファイルはVOICEVOX.app/Contents/MacOS/にあるため、extraFilesをVOICEVOX.app/Contents/ディレクトリにコピーするのは正しくない。
// VOICEVOX.app/Contents/MacOS/ディレクトリにコピーされるように修正する。
Expand Down Expand Up @@ -154,7 +156,7 @@ const builderOptions = {
target: [
{
target: "dmg",
arch: ["x64"],
arch: [isArm64 ? "arm64" : "x64"],
},
],
},
Expand Down

0 comments on commit ebdb854

Please sign in to comment.