Skip to content

Commit

Permalink
[project-sequencer-statemachine] mainブランチをマージ (#2525)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Feb 9, 2025
2 parents 8cad767 + 6fa9024 commit 69e9026
Show file tree
Hide file tree
Showing 231 changed files with 19,373 additions and 20,737 deletions.
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ VITE_DEFAULT_ENGINE_INFOS=`[
}
]`
VITE_OFFICIAL_WEBSITE_URL=https://voicevox.hiroshiba.jp/
VITE_LATEST_UPDATE_INFOS_URL=https://raw.githubusercontent.com/VOICEVOX/voicevox_blog/master/src/data/updateInfos.json
VITE_LATEST_UPDATE_INFOS_URL=https://voicevox.hiroshiba.jp/updateInfos.json
VITE_GTM_CONTAINER_ID=GTM-DUMMY
14 changes: 8 additions & 6 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# テスト用の.envファイル。モックを使う。

VITE_APP_NAME=voicevox
VITE_DEFAULT_ENGINE_INFOS=`[
{
"uuid": "074fc39e-678b-4c13-8916-ffca8d505d1d",
"name": "VOICEVOX Engine",
"executionEnabled": true,
"executionFilePath": "../voicevox_engine/run.exe",
"name": "Mock Engine",
"uuid": "00000000-0000-0000-0000-000000000000",
"executionEnabled": false,
"executionFilePath": "dummy/path",
"executionArgs": [],
"host": "http://127.0.0.1:50021"
"host": "mock://mock"
}
]`
VITE_OFFICIAL_WEBSITE_URL=https://voicevox.hiroshiba.jp/
VITE_LATEST_UPDATE_INFOS_URL=https://raw.githubusercontent.com/VOICEVOX/voicevox_blog/master/src/data/updateInfos.json
VITE_LATEST_UPDATE_INFOS_URL=https://voicevox.hiroshiba.jp/updateInfos.json
VITE_GTM_CONTAINER_ID=GTM-DUMMY
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const tsEslintRules = {
// TODO: いずれは有効化する
"@typescript-eslint/require-await": "off",

// 比較関数無しでのsortは文字列での比較になり、ミスが起こりやすいため有効化
"@typescript-eslint/require-array-sort-compare": "error",

"@typescript-eslint/no-misused-promises": [
"error",
{
Expand Down
7 changes: 7 additions & 0 deletions .github/actions/download-engine/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ runs:
mkdir -p $DEST
mv $TEMPDIR/tmp-extract/$TARGET/* $DEST
# 実行ファイルのパーミッションを変更
if [ "${{ runner.os }}" = "Windows" ]; then
chmod +x $DEST/run.exe
else
chmod +x $DEST/run
fi
echo "::group::ll $DEST"
ls -al $DEST
echo "::endgroup::"
Expand Down
15 changes: 5 additions & 10 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ runs:
echo "ELECTRON_BUILDER_CACHE=${{ runner.temp }}/electron-builder-cache" >> $GITHUB_ENV
echo "cache-version=1" >> $GITHUB_ENV
- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"
cache: "pnpm"

- name: Cache Electron
uses: actions/cache@v4
Expand All @@ -33,13 +36,5 @@ runs:
restore-keys: |
${{ env.cache-version }}-${{ runner.os }}--electron-builder-cache-
- name: Cache external dependencies
uses: actions/cache@v4
with:
path: ./build/vendored
key: ${{ env.cache-version }}-${{ runner.os }}--vendored-${{ hashFiles('build/*.js') }}
restore-keys: |
${{ env.cache-version }}-${{ runner.os }}--vendored-
- shell: bash
run: npm ci
run: pnpm install --frozen-lockfile
21 changes: 12 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ on:
default: false

env:
VOICEVOX_ENGINE_VERSION: 0.21.1
VOICEVOX_RESOURCE_VERSION: 0.21.1
VOICEVOX_ENGINE_VERSION: 0.22.2
VOICEVOX_RESOURCE_VERSION: 0.22.2
VOICEVOX_EDITOR_VERSION:
|- # releaseタグ名か、workflow_dispatchでのバージョン名か、999.999.999-developが入る
${{ github.event.release.tag_name || github.event.inputs.version || '999.999.999-develop' }}
Expand Down Expand Up @@ -158,11 +158,14 @@ jobs:
$sed -i 's/"version": "999.999.999"/"version": "${{ env.VOICEVOX_EDITOR_VERSION }}"/' package.json
- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"
cache: "pnpm"

- name: Cache Electron
uses: actions/cache@v4
Expand All @@ -181,7 +184,7 @@ jobs:
${{ env.cache-version }}-${{ runner.os }}--electron-builder-cache-
- name: Install dependencies
run: npm ci
run: pnpm i --frozen-lockfile

- name: Checkout Product Version Resource
uses: actions/checkout@v4
Expand Down Expand Up @@ -221,7 +224,7 @@ jobs:
$sed -i 's/VITE_GTM_CONTAINER_ID=.*/VITE_GTM_CONTAINER_ID='"$gtm_id"'/' .env.production
- name: Generate public/licenses.json
run: npm run license:generate -- -o public/licenses.json
run: pnpm run license:generate -o public/licenses.json

- name: Define Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
Expand Down Expand Up @@ -251,7 +254,7 @@ jobs:

# https://github.com/electron-userland/electron-builder/issues/3179
USE_HARD_LINKS: false
run: npm run electron:build -- --dir
run: pnpm run electron:build --dir

- name: Reset Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
Expand Down Expand Up @@ -284,7 +287,7 @@ jobs:
rm "${{ matrix.app_asar_dir }}/app.asar"
mv voicevox_engine/licenses.json engine_licenses.json
npm run license:merge -- -o "${{ matrix.app_asar_dir }}/app/dist/licenses.json" -i engine_licenses.json -i "${{ matrix.app_asar_dir }}/app/dist/licenses.json"
pnpm run license:merge -o "${{ matrix.app_asar_dir }}/app/dist/licenses.json" -i engine_licenses.json -i "${{ matrix.app_asar_dir }}/app/dist/licenses.json"
# Repack asar
npx asar pack "${{ matrix.app_asar_dir }}/app" "${{ matrix.app_asar_dir }}/app.asar"
Expand Down Expand Up @@ -413,14 +416,14 @@ jobs:
LINUX_ARTIFACT_NAME: ${{ matrix.linux_artifact_name }}
LINUX_EXECUTABLE_NAME: ${{ matrix.linux_executable_name }}
run: |
npm run electron:build -- --prepackaged prepackage/
pnpm run electron:build --prepackaged prepackage/
- name: Build Electron (for macOS)
if: endsWith(matrix.installer_artifact_name, '-dmg') # macOS
env:
MACOS_ARTIFACT_NAME: ${{ matrix.macos_artifact_name }}
run: |
npm run electron:build -- --prepackaged prepackage/VOICEVOX.app
pnpm run electron:build --prepackaged prepackage/VOICEVOX.app
- name: Reset Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_preview_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
fi
# Storybookのビルド
npm run storybook:build -- --output-dir $(pwd)/dist_preview/storybook
pnpm run storybook:build --output-dir $(pwd)/dist_preview/storybook
# ブラウザ版エディタのビルド
VITE_EXTRA_VERSION_INFO="${LOCATION} @ ${SHORT_SHA}" \
npm run browser:build -- --base ./ --outDir $(pwd)/dist_preview/editor
pnpm run browser:build --base ./ --outDir $(pwd)/dist_preview/editor
- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/merge_gatekeeper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Merge Gatekeeper"

# auto mergeとmerge queue用のチェッカー。
# Approve数が足りているか、すべてのテストが通っているかを確認します。
# 詳細: https://github.com/VOICEVOX/merge-gatekeeper

on:
pull_request_target:
types: [auto_merge_enabled]
merge_group:
types: [checks_requested]

jobs:
merge_gatekeeper:
runs-on: ubuntu-latest
steps:
- uses: voicevox/merge-gatekeeper@main
with:
token: ${{ secrets.GATEKEEPER_TOKEN }}
required_score: 2
score_rules: |
#maintainer: 2
#reviewer: 1
- uses: upsidr/merge-gatekeeper@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
self: merge_gatekeeper
# https://github.com/upsidr/merge-gatekeeper/issues/71#issuecomment-1660607977
ref: ${{ github.event.pull_request && github.event.pull_request.head.sha || github.ref }}
timeout: 18000 # 5 hours
52 changes: 24 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-environment
- run: npm run electron:build
- run: pnpm run electron:build

# unit テスト
unit-test:
Expand All @@ -57,7 +57,7 @@ jobs:

- name: Run test
run: |
npm run test:unit
pnpm run test:unit
# e2e テスト
e2e-test:
Expand Down Expand Up @@ -98,21 +98,7 @@ jobs:
dest: ${{ github.workspace }}/voicevox_engine
target: ${{ matrix.voicevox_engine_asset_name }}

- name: Setup
run: |
# run.exe
chmod +x ${{ steps.download-engine.outputs.run_path }}
# .env
sed -i -e 's|"074fc39e-678b-4c13-8916-ffca8d505d1d"|"208cf94d-43d2-4cf5-abc0-9783cac36d29"|' .env.test
sed -i -e 's|"../voicevox_engine/run.exe"|"${{ steps.download-engine.outputs.run_path }}"|' .env.test
# GitHub Actions 環境だとたまに50021が封じられていることがあるので、ランダムなポートを使うようにする
PORT=$(node -r net -e "server=net.createServer();server.listen(0,()=>{console.log(server.address().port);server.close()})")
sed -i -e 's|"host": "http://127.0.0.1:50021"|"host": "http://127.0.0.1:'$PORT'"|' .env.test
sed -i -e 's|"executionArgs": \[\],|"executionArgs": ["--port='$PORT'"],|' .env.test
cp .env.test .env
- name: Run npm run test:browser-e2e
- name: Run pnpm run test:browser-e2e
run: |
if [ -n "${{ runner.debug }}" ]; then
export DEBUG="pw:browser*"
Expand All @@ -121,20 +107,30 @@ jobs:
if [[ ${{ needs.config.outputs.shouldUpdateSnapshots }} == 'true' ]]; then
ARGS="--update-snapshots"
fi
npm run test:browser-e2e -- $ARGS
pnpm run test:browser-e2e $ARGS
- name: Run npm run test:electron-e2e
- name: Run pnpm run test:electron-e2e
run: |
# .env
cp tests/env/.env.test-electron .env
sed -i -e 's|"path/to/engine"|"${{ steps.download-engine.outputs.run_path }}"|' .env
# GitHub Actions 環境だとたまに50021が封じられていることがあるので、ランダムなポートを使うようにする
PORT=$(node -r net -e "server=net.createServer();server.listen(0,()=>{console.log(server.address().port);server.close()})")
sed -i -e 's|random_port|'$PORT'|' .env
cat .env # ログ用
if [ -n "${{ runner.debug }}" ]; then
export DEBUG="pw:browser*"
fi
if [[ ${{ matrix.os }} == ubuntu-* ]]; then
xvfb-run --auto-servernum npm run test:electron-e2e
xvfb-run --auto-servernum pnpm run test:electron-e2e
else
npm run test:electron-e2e
pnpm run test:electron-e2e
fi
- name: Run npm run test:storybook-vrt
rm .env
- name: Run pnpm run test:storybook-vrt
run: |
if [ -n "${{ runner.debug }}" ]; then
export DEBUG="pw:browser*"
Expand All @@ -143,7 +139,7 @@ jobs:
if [[ ${{ needs.config.outputs.shouldUpdateSnapshots }} == 'true' ]]; then
ARGS="--update-snapshots"
fi
npm run test:storybook-vrt -- $ARGS
pnpm run test:storybook-vrt $ARGS
- name: Upload playwright report to artifact
if: failure()
Expand Down Expand Up @@ -243,9 +239,9 @@ jobs:
uses: ./.github/actions/setup-environment

- name: Disallowed licenses check
run: npm run license:generate -- -o voicevox_licenses.json
run: pnpm run license:generate -o voicevox_licenses.json

- run: npm run typecheck
- run: npm run lint
- run: npm run markdownlint
- run: npm run typos
- run: pnpm run typecheck
- run: pnpm run lint
- run: pnpm run markdownlint
- run: pnpm run typos
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
engine-strict=true
save-exact=true
@jsr:registry=https://npm.jsr.io
manage-package-manager-versions=true
Loading

0 comments on commit 69e9026

Please sign in to comment.