Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU版自動ビルドを有効化 #306

Merged
merged 29 commits into from
Oct 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3466ad1
replace package name step
aoirint Oct 6, 2021
7d923f5
enable cpu matrix for upload to release job
aoirint Oct 6, 2021
466a2cf
fix comment
aoirint Oct 6, 2021
c8361bd
fix sed
aoirint Oct 6, 2021
4a4b069
use package name to split 7z
aoirint Oct 6, 2021
2212bd8
hyphen
aoirint Oct 6, 2021
eb1f286
replace product name
aoirint Oct 6, 2021
b0ccee6
rename prepackage name
aoirint Oct 6, 2021
58afb96
permission filename
aoirint Oct 6, 2021
dad9064
fix space
aoirint Oct 6, 2021
a60f9ee
hyphen
aoirint Oct 7, 2021
8819ecf
exe name
aoirint Oct 8, 2021
bb9d2fb
fix var ref
aoirint Oct 9, 2021
0d3ac23
fix var ref
aoirint Oct 9, 2021
6bd6717
comment
aoirint Oct 9, 2021
f7e9c16
fix chmod target
aoirint Oct 9, 2021
455e670
swap matrix order
aoirint Oct 9, 2021
165f835
comment
aoirint Oct 9, 2021
11d95fd
comment
aoirint Oct 9, 2021
54bc1eb
rename AppImage: VOICEVOX.AppImage for GPU/CPU
aoirint Oct 9, 2021
ab0ab87
rename tar.gz: {voicevox,voicevox-cpu}-version.tar.gz
aoirint Oct 9, 2021
8b7017d
rename AppImage.7z: {VOICEVOX,VOICEVOX-CPU}.AppImage.7z
aoirint Oct 9, 2021
b0dc28b
rename tar.gz: {VOICEVOX,VOICEVOX-CPU}-version.tar.gz
aoirint Oct 9, 2021
cdd9df6
linux installer: use file list in 7z to find AppImage filename
aoirint Oct 9, 2021
0b0653d
quote
aoirint Oct 9, 2021
46e10b8
Merge remote-tracking branch 'origin/main' into patch-cpu-build
aoirint Oct 9, 2021
f463c03
fix tar.gz executable permission
aoirint Oct 9, 2021
52ba6af
quote
aoirint Oct 9, 2021
fec7e09
make nsis-web artifact flat
aoirint Oct 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 116 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,50 @@ jobs:
matrix:
artifact_name:
- linux-noengine-prepackage
- linux-noengine-cpu-prepackage
- windows-noengine-prepackage
- windows-noengine-cpu-prepackage
include:
# Linux NVIDIA GPU
- artifact_name: linux-noengine-prepackage
artifact_path: dist_electron/linux-unpacked
package_name: voicevox
linux_artifact_name: 'VOICEVOX.${ext}'
linux_executable_name: voicevox
os: ubuntu-18.04
# Linux CPU
- artifact_name: linux-noengine-cpu-prepackage
artifact_path: dist_electron/linux-unpacked
package_name: voicevox-cpu
linux_artifact_name: 'VOICEVOX.${ext}'
linux_executable_name: voicevox
os: ubuntu-18.04
# Windows NVIDIA GPU
- artifact_name: windows-noengine-prepackage
artifact_path: dist_electron/win-unpacked
package_name: voicevox
nsis_web_artifact_name: 'VOICEVOX Web Setup ${version}.${ext}'
os: windows-2019
# Windows CPU
- artifact_name: windows-noengine-cpu-prepackage
artifact_path: dist_electron/win-unpacked
package_name: voicevox-cpu
nsis_web_artifact_name: 'VOICEVOX-CPU Web Setup ${version}.${ext}'
os: windows-2019

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master

# Rename executable file
- name: Replace package name
shell: bash
run: |
# GPU: "name": "voicevox" => "name": "voicevox"
# CPU: "name": "voicevox" => "name": "voicevox-cpu"
sed -i 's/"name": "voicevox"/"name": "${{ matrix.package_name }}"/' package.json
# sed -i 's/productName: "VOICEVOX"/productName: "${{ matrix.product_name }}"/' vue.config.js

- name: Set output Node version
id: node-version
shell: bash
Expand Down Expand Up @@ -103,6 +134,10 @@ jobs:
# Build result will be exported to ${{ matrix.artifact_path }}
- name: Build Electron
shell: bash
env:
NSIS_WEB_ARTIFACT_NAME: ${{ matrix.nsis_web_artifact_name }}
LINUX_ARTIFACT_NAME: ${{ matrix.linux_artifact_name }}
LINUX_EXECUTABLE_NAME: ${{ matrix.linux_executable_name }}
run: npm run electron:build_pnever -- --dir

- name: Upload NoEngine Prepackage
Expand All @@ -128,25 +163,31 @@ jobs:
# - ${{ env.VOICEVOX_ENGINE_VERSION }}
os: [ubuntu-18.04]
artifact_name:
- linux-cpu-prepackage
- linux-nvidia-prepackage
- windows-cpu-prepackage
- linux-cpu-prepackage
- windows-nvidia-prepackage
- windows-cpu-prepackage
include:
- artifact_name: linux-cpu-prepackage
noengine_artifact_name: linux-noengine-prepackage
voicevox_engine_asset_name: linux-cpu
os: ubuntu-18.04
# Linux NVIDIA GPU
- artifact_name: linux-nvidia-prepackage
noengine_artifact_name: linux-noengine-prepackage
voicevox_engine_asset_name: linux-nvidia
os: ubuntu-18.04
- artifact_name: windows-cpu-prepackage
noengine_artifact_name: windows-noengine-prepackage
voicevox_engine_asset_name: windows-cpu
linux_executable_name: voicevox
targz_name: VOICEVOX
# Linux CPU
- artifact_name: linux-cpu-prepackage
noengine_artifact_name: linux-noengine-cpu-prepackage
voicevox_engine_asset_name: linux-cpu
linux_executable_name: voicevox
targz_name: VOICEVOX-CPU
# Windows NVIDIA GPU
- artifact_name: windows-nvidia-prepackage
noengine_artifact_name: windows-noengine-prepackage
voicevox_engine_asset_name: windows-nvidia
# Windows CPU
- artifact_name: windows-cpu-prepackage
noengine_artifact_name: windows-noengine-cpu-prepackage
voicevox_engine_asset_name: windows-cpu

runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -269,8 +310,8 @@ jobs:
if: startsWith(matrix.artifact_name, 'linux-') # linux
shell: bash
run: |
chmod +x prepackage/voicevox
chmod +x prepackage/run
chmod +x "prepackage/${{ matrix.linux_executable_name }}"
chmod +x "prepackage/run"

- name: Set BUILD_IDENTIFIER env var
if: startsWith(matrix.artifact_name, 'linux-') # linux
Expand All @@ -296,7 +337,7 @@ jobs:
shell: bash
run: |
mv prepackage VOICEVOX
tar cf voicevox-${{ env.BUILD_IDENTIFIER }}.tar.gz VOICEVOX/
tar cf "${{ matrix.targz_name }}-${{ env.BUILD_IDENTIFIER }}.tar.gz" VOICEVOX/

- name: Show disk space (debug info)
if: startsWith(matrix.artifact_name, 'linux-') # linux
Expand All @@ -309,7 +350,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact_name }}-targz
path: voicevox-${{ env.BUILD_IDENTIFIER }}.tar.gz
path: "${{ matrix.targz_name }}-${{ env.BUILD_IDENTIFIER }}.tar.gz"


build-distributable:
Expand All @@ -324,28 +365,56 @@ jobs:
fail-fast: false
matrix:
artifact_name:
# - linux-cpu-appimage
- linux-nvidia-appimage
# - windows-cpu-nsis-web
- linux-cpu-appimage
- windows-nvidia-nsis-web
- windows-cpu-nsis-web
include:
# - artifact_name: linux-cpu-appimage
# engine_artifact_name: linux-cpu-prepackage
# os: ubuntu-18.04
# Linux NVIDIA GPU
- artifact_name: linux-nvidia-appimage
engine_artifact_name: linux-nvidia-prepackage
package_name: voicevox
linux_artifact_name: 'VOICEVOX.${ext}'
linux_executable_name: voicevox
os: ubuntu-18.04
# - artifact_name: windows-cpu-nsis-web
# engine_artifact_name: windows-cpu-prepackage
# os: windows-2019
# Linux CPU
- artifact_name: linux-cpu-appimage
engine_artifact_name: linux-cpu-prepackage
package_name: voicevox-cpu
linux_artifact_name: 'VOICEVOX.${ext}'
linux_executable_name: voicevox
os: ubuntu-18.04
# Windows NVIDIA GPU
- artifact_name: windows-nvidia-nsis-web
engine_artifact_name: windows-nvidia-prepackage
package_name: voicevox
nsis_web_artifact_name: 'VOICEVOX Web Setup ${version}.${ext}'
os: windows-2019
# Windows CPU
- artifact_name: windows-cpu-nsis-web
engine_artifact_name: windows-cpu-prepackage
package_name: voicevox-cpu
nsis_web_artifact_name: 'VOICEVOX-CPU Web Setup ${version}.${ext}'
os: windows-2019

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master

# NOTE: If the CPU/GPU builds have the same package name,
# the NSIS installers and the 7z files have duplicate names.
# For Linux, If they have the same product name,
# the AppImages have duplicate names.
# Files with the same name cannot be uploaded to a single GitHub Release,
# so different package/product names should be used for CPU/GPU builds.
- name: Replace package name
shell: bash
run: |
# GPU: "name": "voicevox" => "name": "voicevox"
# CPU: "name": "voicevox" => "name": "voicevox-cpu"
sed -i 's/"name": "voicevox"/"name": "${{ matrix.package_name }}"/' package.json
# sed -i 's/productName: "VOICEVOX"/productName: "${{ matrix.product_name }}"/' vue.config.js

- name: Download and extract engine-prepackage artifact
uses: actions/download-artifact@v2
with:
Expand All @@ -356,8 +425,8 @@ jobs:
if: endsWith(matrix.artifact_name, '-appimage') # linux
shell: bash
run: |
chmod +x prepackage/voicevox
chmod +x prepackage/run
chmod +x "prepackage/${{ matrix.linux_executable_name }}"
chmod +x "prepackage/run"

- name: Show disk space (debug info)
shell: bash
Expand Down Expand Up @@ -410,6 +479,10 @@ jobs:
# NOTE: prepackage can be removed before splitting nsis-web archive
- name: Build Electron
shell: bash
env:
NSIS_WEB_ARTIFACT_NAME: ${{ matrix.nsis_web_artifact_name }}
LINUX_ARTIFACT_NAME: ${{ matrix.linux_artifact_name }}
LINUX_EXECUTABLE_NAME: ${{ matrix.linux_executable_name }}
run: npm run electron:build_pnever -- --prepackaged "prepackage/"

- name: Show disk space (debug info)
Expand All @@ -425,14 +498,21 @@ jobs:
path: |
dist_electron/*.AppImage

- name: Create Windows NSIS Web artifact directory
if: endsWith(matrix.artifact_name, '-nsis-web')
shell: bash
run: |
mkdir -p nsis-web-artifact
mv dist_electron/nsis-web/out/*.7z.* nsis-web-artifact/
mv dist_electron/nsis-web/*.exe nsis-web-artifact/

- name: Upload Windows NSIS Web artifact
if: endsWith(matrix.artifact_name, '-nsis-web')
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact_name }}
path: |
dist_electron/nsis-web/out/*.7z.*
dist_electron/nsis-web/*.exe
nsis-web-artifact/*


upload-distributable-to-release:
Expand All @@ -443,15 +523,17 @@ jobs:
matrix:
os: [ubuntu-18.04]
artifact_name:
# - linux-cpu-appimage
- linux-nvidia-appimage
# - windows-cpu-nsis-web
- linux-cpu-appimage
- windows-nvidia-nsis-web
- windows-cpu-nsis-web
include:
# - artifact_name: linux-cpu-appimage
- artifact_name: linux-nvidia-appimage
# - artifact_name: windows-cpu-nsis-web
appimage_7z_name: VOICEVOX.AppImage
- artifact_name: linux-cpu-appimage
appimage_7z_name: VOICEVOX-CPU.AppImage
- artifact_name: windows-nvidia-nsis-web
- artifact_name: windows-cpu-nsis-web

runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -486,12 +568,12 @@ jobs:
echo "Splitting ${appImageFile}"

# compressed to MyArtifact.AppImage.7z.001, MyArtifact.AppImage.7z.002, ...
7z -v1g a "${appImageFile}.7z" "${appImageFile}"
7z -v1g a "${{ matrix.appimage_7z_name }}.7z" "${appImageFile}"

# Output splitted archive name<TAB>size<TAB>hash list to myartifact.7z.txt
ls ${appImageFile}.7z.* > archives_name.txt
stat --printf="%s\n" *.7z.* > archives_size.txt
md5sum *.7z.* | awk '{print $1}' | tr a-z A-Z > archives_hash.txt
ls "${{ matrix.appimage_7z_name }}.7z".* > archives_name.txt
stat --printf="%s\n" "${{ matrix.appimage_7z_name }}.7z".* > archives_size.txt
md5sum "${{ matrix.appimage_7z_name }}.7z".* | awk '{print $1}' | tr a-z A-Z > archives_hash.txt

paste -d '\t' archives_name.txt archives_size.txt archives_hash.txt > archives.txt

Expand Down
8 changes: 4 additions & 4 deletions build/installer_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ rm -f "list.txt"
# Extract desktop entry
echo "Extacting desktop entry"

APPIMAGE=$(echo "${FIRST_ARCHIVE}" | sed 's/\(.*.AppImage\).*/\1/')
APPIMAGE=$(7z l -slt -ba "${FIRST_ARCHIVE}" | grep 'Path = ' | head -n1 | sed 's/Path = \(.*\)/\1/')
chmod +x "${APPIMAGE}"

./${APPIMAGE} --appimage-extract '*.desktop'
./${APPIMAGE} --appimage-extract 'usr/share/icons/**'
./${APPIMAGE} --appimage-extract '*.png' # symbolic link to icon
"./${APPIMAGE}" --appimage-extract '*.desktop'
"./${APPIMAGE}" --appimage-extract 'usr/share/icons/**'
"./${APPIMAGE}" --appimage-extract '*.png' # symbolic link to icon

# Install desktop entry
echo "Installing desktop entry"
Expand Down
8 changes: 7 additions & 1 deletion build/splitNsisArchive.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ const createIni = (sizes, hashes) => {

// target: electron-builder.Target
exports.default = async function (target) {
const projectName = process.env.npm_package_name;
if (projectName === undefined) {
const ErrorMessage = "Project name is undefined.";
console.error(ErrorMessage);
throw ErrorMessage;
}
const projectVersion = process.env.npm_package_version;
if (projectVersion === undefined) {
const ErrorMessage = "Project version is undefined.";
console.error(ErrorMessage);
throw ErrorMessage;
}
const segmentSize = 1 * 1024 ** 3; // 1GB
const fileName = `voicevox-${projectVersion}-x64.nsis.7z`; // target file name
const fileName = `${projectName}-${projectVersion}-x64.nsis.7z`; // target file name
const targetDirectory = target.outDir; // for nsis-web
const outputDirectory = path.resolve(targetDirectory, "out");
const inputFile = path.resolve(targetDirectory, fileName);
Expand Down
15 changes: 15 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ const process = require("process");
const VOICEVOX_ENGINE_DIR =
process.env.VOICEVOX_ENGINE_DIR ?? "../voicevox_engine/run.dist/";

// ${productName} Web Setup ${version}.${ext}
const NSIS_WEB_ARTIFACT_NAME = process.env.NSIS_WEB_ARTIFACT_NAME;

// ${productName}-${version}.${ext}
const LINUX_ARTIFACT_NAME = process.env.LINUX_ARTIFACT_NAME;

// ${packageName}
const LINUX_EXECUTABLE_NAME = process.env.LINUX_EXECUTABLE_NAME;

module.exports = {
configureWebpack: {
devtool: "source-map",
Expand Down Expand Up @@ -50,6 +59,8 @@ module.exports = {
buildResources: "build",
},
nsisWeb: {
artifactName:
NSIS_WEB_ARTIFACT_NAME !== "" ? NSIS_WEB_ARTIFACT_NAME : undefined,
include: "build/installer.nsh",
oneClick: false,
allowToChangeInstallationDirectory: true,
Expand All @@ -60,6 +71,10 @@ module.exports = {
vPrefixedTagName: false,
},
linux: {
artifactName:
LINUX_ARTIFACT_NAME !== "" ? LINUX_ARTIFACT_NAME : undefined,
executableName:
LINUX_EXECUTABLE_NAME !== "" ? LINUX_EXECUTABLE_NAME : undefined,
icon: "public/icon.png",
category: "AudioVideo",
target: [
Expand Down