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

Fix: e2eテストが動かないのを修正 #1276

Merged
merged 75 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
47f9c5e
WIP
sevenc-nanashi Apr 1, 2023
ffc71e3
Fix: e2eテストが動かないのを修正
sevenc-nanashi Apr 2, 2023
0c63f72
Delete: 不要なデバッグ用の文を削除
sevenc-nanashi Apr 3, 2023
8fa364e
Revert: 謎の削除をrevert
sevenc-nanashi Apr 3, 2023
093efad
Fix: DevToolsを開かないように
sevenc-nanashi Apr 3, 2023
e92c54b
Change: rimrafの場所を変更
sevenc-nanashi Apr 3, 2023
422cc91
Code: 順番を修正
sevenc-nanashi Apr 3, 2023
b99f53d
PWTEST_WATCH=1を使うように
sevenc-nanashi Apr 5, 2023
e1419ca
Refactor: Viteの起動周りをリファクタ
sevenc-nanashi Apr 5, 2023
20d578d
Delete: 使われていないパッケージを削除
sevenc-nanashi Apr 5, 2023
1a77ae8
Add: 監視終了のメッセージを追加
sevenc-nanashi Apr 5, 2023
141bc91
Delete: 不要なパッケージを削除
sevenc-nanashi Apr 5, 2023
bb83b62
Add: e2eテストをWorkflowに追加
sevenc-nanashi Apr 5, 2023
1b7a20d
Improve: watchモードのテストをREADMEで案内
sevenc-nanashi Apr 5, 2023
a807461
Add: debug runでデバッグログを出すように
sevenc-nanashi Apr 5, 2023
2b4c2c8
Change: タイムアウトを120秒に
sevenc-nanashi Apr 6, 2023
9acd5d7
Change: タイムアウトを無効化
sevenc-nanashi Apr 6, 2023
5f0f789
Change: ubuntu-latestで動くように
sevenc-nanashi Apr 7, 2023
aeae371
Change: development判定を変更
sevenc-nanashi Apr 7, 2023
92bfcb2
Add: console.errorで出力するように
sevenc-nanashi Apr 7, 2023
568407c
Fix: Voicevox engineを追加
sevenc-nanashi Apr 7, 2023
3d77e9e
Fix: wget -> curl
sevenc-nanashi Apr 7, 2023
5866ddc
Revert: "Change: development判定を変更"
sevenc-nanashi Apr 7, 2023
9b6132e
Fix: バックスラッシュに
sevenc-nanashi Apr 7, 2023
d9bff90
Fix: パスをsedで置き換えるように
sevenc-nanashi Apr 7, 2023
335d872
Fix: sedの引数をクォート
sevenc-nanashi Apr 7, 2023
aa59da3
Change: タイムアウトの秒数を緩和
sevenc-nanashi Apr 7, 2023
8df8bd4
Add: 名前を追加
sevenc-nanashi Apr 7, 2023
84a29e3
Fix: 2回実行されるのを修正
sevenc-nanashi Apr 7, 2023
16c5e81
Change: 拡張正規表現モードを使うように
sevenc-nanashi Apr 7, 2023
5b66834
Update README.md
sevenc-nanashi Apr 8, 2023
7158690
Add: コメントを追加
sevenc-nanashi Apr 8, 2023
4fb4adb
Merge: main -> fix/e2e-small-fix
sevenc-nanashi Apr 8, 2023
d21c6f3
Merge: remote -> local
sevenc-nanashi Apr 8, 2023
ff8b8c7
Code: フォーマット
sevenc-nanashi Apr 8, 2023
0975535
Add: エンジンのダウンロードを分離
sevenc-nanashi Apr 8, 2023
7230e08
Fix: secrets.GITHUB_TOKEN -> github.token
sevenc-nanashi Apr 8, 2023
ac35f3b
Fix: tempdirを作るように
sevenc-nanashi Apr 9, 2023
a9b7bed
Fix: tempdirの変数周りを修正
sevenc-nanashi Apr 9, 2023
49f136b
Fix: jqに-eを追加
sevenc-nanashi Apr 9, 2023
ce179a5
Add: デバッグ用の分を追加
sevenc-nanashi Apr 9, 2023
895c54d
Fix: クォートを修正
sevenc-nanashi Apr 9, 2023
624c6d8
Fix: クォートを修正
sevenc-nanashi Apr 9, 2023
11d6f57
Add: デバッグ用の文を追加
sevenc-nanashi Apr 9, 2023
956e91d
Fix: 変数代入を修正
sevenc-nanashi Apr 9, 2023
2a8ed2b
Fix: パスを修正
sevenc-nanashi Apr 9, 2023
e4bc777
Change: GNU parallelを使わないように
sevenc-nanashi Apr 9, 2023
9a57e5a
Add: デバッグ文を追加
sevenc-nanashi Apr 9, 2023
d2503f5
Add: 出力先の表示を追加
sevenc-nanashi Apr 9, 2023
616267a
Fix: TEMPDIRの加工を修正
sevenc-nanashi Apr 9, 2023
f53d24b
Fix: パイプ忘れ
sevenc-nanashi Apr 9, 2023
6300210
Fix: パスを修正
sevenc-nanashi Apr 9, 2023
22997a3
Fix: 解凍を修正
sevenc-nanashi Apr 9, 2023
a79cb47
Fix: 出力パスのスラッシュを置き換えるように
sevenc-nanashi Apr 9, 2023
909c57c
Fix: 出力を修正
sevenc-nanashi Apr 9, 2023
9c59d8e
Change: outputを使うように
sevenc-nanashi Apr 9, 2023
bb7fdf3
Fix: outputを修正
sevenc-nanashi Apr 9, 2023
254dd48
Fix: destの設定を修正
sevenc-nanashi Apr 9, 2023
762e98f
Fix: mvの引数を修正
sevenc-nanashi Apr 9, 2023
6b30730
Fix: 一時ディレクトリに解凍するように
sevenc-nanashi Apr 9, 2023
737955e
Fix: フォルダ名を描くように
sevenc-nanashi Apr 9, 2023
d3ddee5
Fix: mkdirしてから移動するように
sevenc-nanashi Apr 9, 2023
c1aa9a5
Add: llを追加
sevenc-nanashi Apr 9, 2023
a930a02
Change: バージョンを指定するように
sevenc-nanashi Apr 9, 2023
aceab58
Fix: 不要なプレフィックスを削除
sevenc-nanashi Apr 9, 2023
2196584
Refactor: build.ymlと統合
sevenc-nanashi Apr 9, 2023
e0c59a3
Fix: 変数展開を修正
sevenc-nanashi Apr 9, 2023
85d2b02
VOICEVOX_ENGINE_VERSIONを変数化
Hiroshiba Apr 9, 2023
330ec88
Change: preview -> prerelease-latest
sevenc-nanashi Apr 9, 2023
9139f06
Update .github/actions/download-engine/action.yml
sevenc-nanashi Apr 9, 2023
1c40350
Change: xargsからhead -1に
sevenc-nanashi Apr 9, 2023
04ebd71
Delete: download_pathを削除
sevenc-nanashi Apr 9, 2023
3c70ef1
Code: コメントを追加
sevenc-nanashi Apr 9, 2023
1ec3fb7
Code: no-consoleをテスト内で無効化
sevenc-nanashi Apr 10, 2023
52d5316
Change: タイムアウトを変更
sevenc-nanashi Apr 10, 2023
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
12 changes: 12 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
DEFAULT_ENGINE_INFOS=`[
{
"uuid": "074fc39e-678b-4c13-8916-ffca8d505d1d",
"name": "VOICEVOX Engine",
"executionEnabled": true,
"executionFilePath": "../voicevox_engine/run.exe",
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
"executionArgs": [],
"host": "http://127.0.0.1:50021"
}
]`
VITE_GTM_CONTAINER_ID=GTM-DUMMY
VV_OUTPUT_LOG_UTF8=1
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module.exports = {
"./src/background.ts",
"./src/background/*.ts",
"./src/electron/*.ts",
"./tests/**/*.ts",
],
rules: {
"no-console": "off",
Expand Down
96 changes: 96 additions & 0 deletions .github/actions/download-engine/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: "Download VOICEVOX ENGINE"
description: |
VOICEVOX ENGINEをダウンロードし、指定したディレクトリに展開する。
inputs:
version:
description: "VOICEVOX ENGINEのバージョン。latest(デフォルト)、prerelease-latest、バージョン番号(例:0.14.4)で指定できる。"
required: false
default: "latest"
dest:
description: "VOICEVOX ENGINEを展開するディレクトリ。"
required: true
target:
description: "ダウンロードする対象。デフォルトは各OSのCPU版。"
required: false
default: ""

outputs:
run_path:
description: "run.exe、またはrunのパス。"
value: ${{ steps.result.outputs.run_path }}
version:
description: "VOICEVOX ENGINEのバージョン。"
value: ${{ steps.result.outputs.version }}
runs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

結構長いですね・・・。

このaction.yml全部をshellスクリプトを書いてbuildディレクトリあたりに入れておけば、手元でデバッグしやすいかもです。
あとREADMEでエンジンダウンロードも案内できて嬉しそう。まあご興味あれば・・・!

Copy link
Member Author

@sevenc-nanashi sevenc-nanashi Apr 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionsに依存してる部分がそこそこあって大変そうなので別の機会にやろうと思います

using: "composite"
steps:
- name: Setup tempdir
shell: bash
run: |
TEMPDIR=$(echo '${{ runner.temp }}' | sed -e 's_\\_/_g')
echo TEMPDIR=$TEMPDIR >> $GITHUB_ENV
mkdir -p $TEMPDIR

DEST=$(echo '${{ inputs.dest }}' | sed -e 's_\\_/_g')
echo DEST=$DEST >> $GITHUB_ENV

- name: Get version
shell: bash
run: |
curl -s https://api.github.com/repos/voicevox/voicevox_engine/releases \
-H 'authorization: Bearer ${{ github.token }}' \
-H 'content-type: application/json' > $TEMPDIR/releases.json

if [ "${{ inputs.version }}" = "latest" ]; then
cat $TEMPDIR/releases.json | jq -er '[.[] | select(.prerelease == false)][0]' > $TEMPDIR/target.json
elif [ "${{ inputs.version }}" = "prerelease-latest" ]; then
cat $TEMPDIR/releases.json | jq -er '[.[] | select(.prerelease == true)][0]' > $TEMPDIR/target.json
else
cat $TEMPDIR/releases.json | jq -er '[.[] | select(.tag_name == "${{ inputs.version }}")][0]' > $TEMPDIR/target.json
fi
- name: Download and Extract
shell: bash
run: |
if [ "${{ inputs.target }}" = "" ]; then
OS="${{ runner.os }}"
TARGET="${OS,,}-cpu" # 小文字にする
else
TARGET="${{ inputs.target }}"
fi

# リリース情報からファイル一覧のtxtを取得
cat $TEMPDIR/target.json | jq -er '[.assets[] | select(.name | contains("'$TARGET'") and endswith(".7z.txt"))][0]' > $TEMPDIR/assets_txt.json
LIST_URL=$(cat $TEMPDIR/assets_txt.json | jq -er '.browser_download_url')
echo "7z.txt url: $LIST_URL"
echo $LIST_URL | xargs curl -sSL > $TEMPDIR/download_name.txt
echo "Files to download:"
cat $TEMPDIR/download_name.txt | sed -e 's|^|- |'

# ファイル一覧のtxtにあるファイルをダウンロード
for i in $(cat $TEMPDIR/download_name.txt); do
URL=$(cat $TEMPDIR/target.json | jq -er "[.assets[] | select(.name == \"$i\")][0].browser_download_url")
echo "Download url: $URL, dest: $TEMPDIR/$i"
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
curl -sSL $URL -o $TEMPDIR/$i &
done
for job in `jobs -p`; do
wait $job
done

# 一時ディレクトリに展開してから、本体(windows-cpuなどの中)を取り出す
7z x -y -o$TEMPDIR/tmp-extract $TEMPDIR/$(head -1 $TEMPDIR/download_name.txt)
mkdir -p $DEST
mv $TEMPDIR/tmp-extract/$TARGET/* $DEST

echo "::group::ll $DEST"
ls -al $DEST
echo "::endgroup::"
- name: Set output
id: result
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
echo "run_path=$DEST/run.exe" >> $GITHUB_OUTPUT
else
echo "run_path=$DEST/run" >> $GITHUB_OUTPUT
fi
cat $TEMPDIR/target.json | jq -r '.tag_name' | sed -e 's_^_version=_' >> $GITHUB_OUTPUT
53 changes: 9 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,48 +263,13 @@ jobs:
mv ${{ matrix.artifact_path }} ./prepackage

# Download VOICEVOX ENGINE
- name: Create directory voicevox_engine/download
shell: bash
run: |
mkdir -p voicevox_engine/download

# NOTE: VOICEVOX ENGINE should not be cached since it has a size of several GB
# and actions/cache has a limit of 5GB per repository.
# https://github.com/actions/cache#cache-limits
# - name: Dump VOICEVOX ENGINE repo URL to calc hash
# shell: bash
# run: |
# echo "${{ env.VOICEVOX_ENGINE_REPO_URL }}" > voicevox_engine/repo_url.txt
# - name: Cache VOICEVOX ENGINE
# uses: actions/cache@v3
# id: voicevox-engine-cache
# with:
# path: voicevox_engine/download
# key: ${{ env.cache-version }}-voicevox-engine-${{ hashFiles('voicevox_engine/repo_url.txt') }}-${{ env.VOICEVOX_ENGINE_VERSION }}

- name: Download VOICEVOX ENGINE
# if: steps.voicevox-engine-cache.outputs.cache-hit != 'true'
shell: bash
env:
VOICEVOX_ENGINE_RELEASE_URL: ${{ env.VOICEVOX_ENGINE_REPO_URL }}/releases/download/${{ env.VOICEVOX_ENGINE_VERSION }}
run: |
curl -L -o "voicevox_engine/download/list.txt" "${{ env.VOICEVOX_ENGINE_RELEASE_URL }}/voicevox_engine-${{ matrix.voicevox_engine_asset_name }}-${{ env.VOICEVOX_ENGINE_VERSION }}.7z.txt"
cat "voicevox_engine/download/list.txt" | xargs -I '%' curl -L -o "voicevox_engine/download/%" "${{ env.VOICEVOX_ENGINE_RELEASE_URL }}/%"

- name: Extract VOICEVOX ENGINE
shell: bash
run: |
mkdir -p voicevox_engine/tmp

# Extract first file to extract all parts
# Destination: voicevox_engine/tmp/${{ matrix.voicevox_engine_asset_name }}/
7z x "voicevox_engine/download/$(head -n1 voicevox_engine/download/list.txt)" -ovoicevox_engine/tmp/

mkdir -p voicevox_engine/voicevox_engine
mv "voicevox_engine/tmp/${{ matrix.voicevox_engine_asset_name }}"/* voicevox_engine/voicevox_engine

# remove downloads to free space
rm -rf voicevox_engine/download voicevox_engine/tmp
id: download-engine
uses: ./.github/actions/download-engine
with:
version: ${{ env.VOICEVOX_ENGINE_VERSION }}
dest: ${{ github.workspace }}/voicevox_engine
target: ${{ matrix.voicevox_engine_asset_name }}

# FIXME: asarをextract/packせず、ビルド前にengine_licenses.jsonとlicenses.jsonを結合する
- name: Merge licenses.json (ENGINE, VOICEVOX)
Expand All @@ -314,7 +279,7 @@ jobs:
npx asar extract "${{ matrix.app_asar_dir }}/app.asar" "${{ matrix.app_asar_dir }}/app"
rm "${{ matrix.app_asar_dir }}/app.asar"

mv voicevox_engine/voicevox_engine/licenses.json engine_licenses.json
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"

# Repack asar
Expand All @@ -325,14 +290,14 @@ jobs:
if: startsWith(matrix.artifact_name, 'windows-') || startsWith(matrix.artifact_name, 'linux-')
shell: bash
run: |
mv voicevox_engine/voicevox_engine/* prepackage/
mv voicevox_engine/* prepackage/
rm -rf voicevox_engine

- name: Merge VOICEVOX ENGINE into prepackage/VOICEVOX.app/Contents/MacOS/
if: startsWith(matrix.artifact_name, 'macos-')
shell: bash
run: |
mv voicevox_engine/voicevox_engine/* prepackage/VOICEVOX.app/Contents/MacOS/
mv voicevox_engine/* prepackage/VOICEVOX.app/Contents/MacOS/
rm -rf voicevox_engine

- name: Show disk space (debug info)
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- "**"
workflow_dispatch:

env:
VOICEVOX_ENGINE_VERSION: 0.14.4

jobs:
build:
runs-on: windows-latest
Expand Down Expand Up @@ -47,4 +50,22 @@ jobs:
- run: npm run lint
- run: npm run markdownlint
- run: npm run test:unit

- name: Download VOICEVOX ENGINE
id: download-engine
uses: ./.github/actions/download-engine
with:
version: ${{ env.VOICEVOX_ENGINE_VERSION }}
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
dest: ${{ github.workspace }}/voicevox_engine

- name: Run npm run test:e2e
shell: bash
run: |
cp .env.test .env
sed -i -e 's|"../voicevox_engine/run.exe"|"${{ steps.download-engine.outputs.run_path }}"|' .env
if [ -n "${{ runner.debug }}" ]; then
DEBUG=pw:browser* npm run test:e2e
else
npm run test:e2e
fi
- run: npm run electron:build_pnever
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ npm run test:unit
npm run test:e2e
```

### 監視モード

```bash
npm run test-watch:unit
npm run test-watch:e2e
```

## 依存ライブラリのライセンス情報の生成

```bash
Expand Down
Loading