Skip to content

Commit

Permalink
refactor: electron用の.envを作成し、test.ymlをリファクタリング (#2468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Jan 3, 2025
1 parent 8a6d2a4 commit faf91f0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ jobs:
- name: Setup
run: |
# .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
cp tests/env/.env.test-e2e .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|"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
sed -i -e 's|random_port|'$PORT'|' .env
cat .env # ログ用
- name: Run npm run test:browser-e2e
run: |
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/electron/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test.beforeEach(async () => {
},
{
envName: "VVPPデフォルトエンジン",
envPath: ".env.test-electron-default-vvpp",
envPath: "tests/env/.env.test-electron-default-vvpp",
},
].forEach(({ envName, envPath }) => {
test.describe(`${envName}`, () => {
Expand Down
16 changes: 16 additions & 0 deletions tests/env/.env.test-e2e
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CI環境でのe2eテスト用の.envファイル。CI時に値が上書きされる。

VITE_APP_NAME=voicevox
VITE_DEFAULT_ENGINE_INFOS=`[
{
"name": "VOICEVOX Nemo Engine",
"uuid": "208cf94d-43d2-4cf5-abc0-9783cac36d29",
"executionEnabled": true,
"executionFilePath": "path/to/engine",
"executionArgs": ["--port=random_port"],
"host": "http://127.0.0.1:random_port"
}
]`
VITE_OFFICIAL_WEBSITE_URL=https://voicevox.hiroshiba.jp/
VITE_LATEST_UPDATE_INFOS_URL=https://voicevox.hiroshiba.jp/updateInfos.json
VITE_GTM_CONTAINER_ID=GTM-DUMMY
File renamed without changes.

0 comments on commit faf91f0

Please sign in to comment.