Skip to content

Commit 6f25411

Browse files
authored
test:e2eをlinuxとmacでも動くように (#1415)
1 parent b8e08ed commit 6f25411

File tree

2 files changed

+49
-8
lines changed

2 files changed

+49
-8
lines changed

.github/actions/download-engine/action.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: "Download VOICEVOX ENGINE"
22
description: |
33
VOICEVOX ENGINEをダウンロードし、指定したディレクトリに展開する。
44
inputs:
5+
repo:
6+
description: "リポジトリ名。デフォルトはVOICEVOX/voicevox_engine。"
7+
required: false
8+
default: "VOICEVOX/voicevox_engine"
59
version:
610
description: "VOICEVOX ENGINEのバージョン。latest(デフォルト)、prerelease-latest、バージョン番号(例:0.14.4)で指定できる。"
711
required: false
@@ -37,7 +41,7 @@ runs:
3741
- name: Get version
3842
shell: bash
3943
run: |
40-
curl -s https://api.github.com/repos/voicevox/voicevox_engine/releases \
44+
curl -s https://api.github.com/repos/${{ inputs.repo }}/releases \
4145
-H 'authorization: Bearer ${{ github.token }}' \
4246
-H 'content-type: application/json' > $TEMPDIR/releases.json
4347
@@ -52,8 +56,8 @@ runs:
5256
shell: bash
5357
run: |
5458
if [ "${{ inputs.target }}" = "" ]; then
55-
OS="${{ runner.os }}"
56-
TARGET="${OS,,}-cpu" # 小文字にする
59+
OS=$(echo "${{ runner.os }}" | tr "[:upper:]" "[:lower:]") # 小文字にする
60+
TARGET="$OS-cpu"
5761
else
5862
TARGET="${{ inputs.target }}"
5963
fi
@@ -93,4 +97,5 @@ runs:
9397
else
9498
echo "run_path=$DEST/run" >> $GITHUB_OUTPUT
9599
fi
96-
cat $TEMPDIR/target.json | jq -r '.tag_name' | sed -e 's_^_version=_' >> $GITHUB_OUTPUT
100+
echo "version=$(jq -r '.tag_name' $TEMPDIR/target.json)" >> $GITHUB_OUTPUT
101+

.github/workflows/test.yml

+40-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ on:
88
workflow_dispatch:
99

1010
env:
11-
VOICEVOX_ENGINE_VERSION: 0.14.4
11+
VOICEVOX_ENGINE_REPO: "VOICEVOX/voicevox_nemo_engine" # 軽いのでNemoを使う
12+
VOICEVOX_ENGINE_VERSION: "0.14.0"
1213

1314
defaults:
1415
run:
1516
shell: bash
16-
17+
1718
jobs:
19+
# ビルドのテスト
1820
build-test:
1921
runs-on: windows-latest
2022
steps:
@@ -23,7 +25,8 @@ jobs:
2325
uses: ./.github/actions/setup-environment
2426
- run: npm run electron:build_pnever
2527

26-
test:
28+
# unit テスト
29+
unit-test:
2730
runs-on: windows-latest
2831
steps:
2932
- uses: actions/checkout@v3
@@ -32,19 +35,52 @@ jobs:
3235

3336
- run: npm run test:unit
3437

38+
# electron の e2e テスト
39+
e2e-test:
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
matrix:
43+
os: [ubuntu-latest, macos-latest, windows-latest]
44+
include:
45+
- os: ubuntu-latest
46+
voicevox_engine_asset_name: linux-cpu
47+
- os: macos-latest
48+
voicevox_engine_asset_name: macos-x64
49+
- os: windows-latest
50+
voicevox_engine_asset_name: windows-cpu
51+
steps:
52+
- uses: actions/checkout@v3
53+
- name: Setup environment
54+
uses: ./.github/actions/setup-environment
55+
56+
- name: Install xvfb and x11-xserver-utils
57+
if: startsWith(matrix.os, 'ubuntu')
58+
run: |
59+
sudo apt-get update
60+
sudo apt-get install -y xvfb x11-xserver-utils # for electron
61+
sudo apt-get install -y libsndfile1 # for engine
62+
3563
- name: Download VOICEVOX ENGINE
3664
id: download-engine
3765
uses: ./.github/actions/download-engine
3866
with:
67+
repo: ${{ env.VOICEVOX_ENGINE_REPO }}
3968
version: ${{ env.VOICEVOX_ENGINE_VERSION }}
4069
dest: ${{ github.workspace }}/voicevox_engine
70+
target: ${{ matrix.voicevox_engine_asset_name }}
4171

4272
- name: Run npm run test:e2e
4373
run: |
74+
chmod +x ${{ steps.download-engine.outputs.run_path }}
75+
4476
cp .env.test .env
4577
sed -i -e 's|"../voicevox_engine/run.exe"|"${{ steps.download-engine.outputs.run_path }}"|' .env
78+
4679
if [ -n "${{ runner.debug }}" ]; then
47-
DEBUG=pw:browser* npm run test:e2e
80+
export DEBUG="pw:browser*"
81+
fi
82+
if [[ ${{ matrix.os }} == ubuntu-* ]]; then
83+
xvfb-run --auto-servernum npm run test:e2e
4884
else
4985
npm run test:e2e
5086
fi

0 commit comments

Comments
 (0)