Skip to content

Commit

Permalink
CPU版自動ビルドを有効化 (#306)
Browse files Browse the repository at this point in the history
* replace package name step

* enable cpu matrix for upload to release job

* fix comment

* fix sed

* use package name to split 7z

* hyphen

* replace product name

* rename prepackage name

* permission filename

* fix space

* hyphen

* exe name

* fix var ref

* fix var ref

* comment

* fix chmod target

* swap matrix order

* comment

* comment

* rename AppImage: VOICEVOX.AppImage for GPU/CPU

* rename tar.gz: {voicevox,voicevox-cpu}-version.tar.gz

* rename AppImage.7z: {VOICEVOX,VOICEVOX-CPU}.AppImage.7z

* rename tar.gz: {VOICEVOX,VOICEVOX-CPU}-version.tar.gz

* linux installer: use file list in 7z to find AppImage filename

* quote

* fix tar.gz executable permission

* quote

* make nsis-web artifact flat
  • Loading branch information
aoirint authored Oct 9, 2021
1 parent 28eb2b8 commit 6c55ef3
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 39 deletions.
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

0 comments on commit 6c55ef3

Please sign in to comment.