Skip to content

Commit

Permalink
Fix: メンテナンスされていない Unit テスト、E2E テストの CI を無効化
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukumijima committed Nov 23, 2024
1 parent 2b7aa2a commit bdd55f4
Showing 1 changed file with 169 additions and 169 deletions.
338 changes: 169 additions & 169 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,175 +48,175 @@ jobs:
uses: ./.github/actions/setup-environment
- run: npm run electron:build

# unit テスト
unit-test:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-environment

- run: npm run test:unit

- name: Setup playwright
run: npx playwright install
- name: Run Storybook tests
run: |
# .env
cp .env.test .env
# ランダムなポートを使う
PORT=$(node -r net -e "server=net.createServer();server.listen(0,()=>{console.log(server.address().port);server.close()})")
npx storybook dev --ci --port $PORT &
# 起動を待つ
elapsed=0
until curl --output /dev/null --silent --head --fail http://localhost:$PORT; do
echo "Waiting for Storybook to start on port $PORT..."
sleep 5
((elapsed+=5))
if [ "$elapsed" -ge "60" ]; then
echo "Timed out waiting for Storybook to start."
exit 1
fi
done
# テスト
npm run test:storybook -- --url "http://127.0.0.1:$PORT"
# e2e テスト
e2e-test:
runs-on: ${{ matrix.os }}
needs: [config]
strategy:
fail-fast: false
matrix:
os:
- windows-2022
- macos-13
- macos-14
# - ubuntu-20.04
include:
- os: windows-2022
aivisspeech_engine_asset_name: windows-x64
- os: macos-13
aivisspeech_engine_asset_name: macos-x64
- os: macos-14
aivisspeech_engine_asset_name: macos-arm64
# - os: ubuntu-20.04
# aivisspeech_engine_asset_name: linux-x64
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Install xvfb and x11-xserver-utils
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y xvfb x11-xserver-utils # for electron
sudo apt-get install -y libsndfile1 # for engine
- name: Download AivisSpeech Engine
id: download-engine
uses: ./.github/actions/download-engine
with:
repo: ${{ env.AIVISSPEECH_ENGINE_REPO }}
version: ${{ env.AIVISSPEECH_ENGINE_VERSION }}
dest: ${{ github.workspace }}/AivisSpeech-Engine
target: ${{ matrix.aivisspeech_engine_asset_name }}
token: ${{ secrets.ENGINE_DOWNLOADER_TOKEN }}

- name: Setup
run: |
# playwright
npx playwright install
# 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|"../AivisSpeech-Engine/run.exe"|"${{ steps.download-engine.outputs.run_path }}"|' .env.test
cp .env.test .env
- name: Run npm run test:browser-e2e
run: |
if [ -n "${{ runner.debug }}" ]; then
export DEBUG="pw:browser*"
fi
ARGS=""
if [[ ${{ needs.config.outputs.shouldUpdateSnapshots }} == 'true' ]]; then
ARGS="--update-snapshots"
fi
npm run test:browser-e2e -- $ARGS
- name: Run npm run test:electron-e2e
run: |
if [ -n "${{ runner.debug }}" ]; then
export DEBUG="pw:browser*"
fi
if [[ ${{ matrix.os }} == ubuntu-* ]]; then
xvfb-run --auto-servernum npm run test:electron-e2e
else
npm run test:electron-e2e
fi
- name: Upload playwright report to artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.os }}
path: playwright-report

- name: Collect patch for snapshots
if: needs.config.outputs.shouldUpdateSnapshots == 'true'
run: |
git add --intent-to-add tests/ # git diff に表示されるようにする
git diff tests/ # ロギング用
git diff --binary tests/ > patch-${{ matrix.os }}.diff
- name: Upload patch to artifact
if: needs.config.outputs.shouldUpdateSnapshots == 'true'
uses: actions/upload-artifact@v4
with:
name: updated-snapshots-${{ matrix.os }}
path: patch-${{ matrix.os }}.diff

commit-snapshots:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [config, e2e-test]
if: needs.config.outputs.shouldUpdateSnapshots == 'true'
steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: updated-snapshots-*
path: patches
merge-multiple: true

- name: Commit updated snapshots
run: |
# パッチを適用
for patch in patches/*.diff; do
git apply --allow-empty $patch
rm $patch
done
# 変更があるかチェック
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add tests/
git commit -m "(スナップショットを更新)"
git push
else
echo "No changes to commit"
fi
# # unit テスト
# unit-test:
# runs-on: windows-2022
# steps:
# - uses: actions/checkout@v4
# - name: Setup environment
# uses: ./.github/actions/setup-environment

# - run: npm run test:unit

# - name: Setup playwright
# run: npx playwright install
# - name: Run Storybook tests
# run: |
# # .env
# cp .env.test .env

# # ランダムなポートを使う
# PORT=$(node -r net -e "server=net.createServer();server.listen(0,()=>{console.log(server.address().port);server.close()})")
# npx storybook dev --ci --port $PORT &

# # 起動を待つ
# elapsed=0
# until curl --output /dev/null --silent --head --fail http://localhost:$PORT; do
# echo "Waiting for Storybook to start on port $PORT..."
# sleep 5
# ((elapsed+=5))
# if [ "$elapsed" -ge "60" ]; then
# echo "Timed out waiting for Storybook to start."
# exit 1
# fi
# done

# # テスト
# npm run test:storybook -- --url "http://127.0.0.1:$PORT"

# # e2e テスト
# e2e-test:
# runs-on: ${{ matrix.os }}
# needs: [config]
# strategy:
# fail-fast: false
# matrix:
# os:
# - windows-2022
# - macos-13
# - macos-14
# # - ubuntu-20.04
# include:
# - os: windows-2022
# aivisspeech_engine_asset_name: windows-x64
# - os: macos-13
# aivisspeech_engine_asset_name: macos-x64
# - os: macos-14
# aivisspeech_engine_asset_name: macos-arm64
# # - os: ubuntu-20.04
# # aivisspeech_engine_asset_name: linux-x64
# steps:
# - uses: actions/checkout@v4
# - name: Setup environment
# uses: ./.github/actions/setup-environment

# - name: Install xvfb and x11-xserver-utils
# if: startsWith(matrix.os, 'ubuntu')
# run: |
# sudo apt-get update
# sudo apt-get install -y xvfb x11-xserver-utils # for electron
# sudo apt-get install -y libsndfile1 # for engine

# - name: Download AivisSpeech Engine
# id: download-engine
# uses: ./.github/actions/download-engine
# with:
# repo: ${{ env.AIVISSPEECH_ENGINE_REPO }}
# version: ${{ env.AIVISSPEECH_ENGINE_VERSION }}
# dest: ${{ github.workspace }}/AivisSpeech-Engine
# target: ${{ matrix.aivisspeech_engine_asset_name }}
# token: ${{ secrets.ENGINE_DOWNLOADER_TOKEN }}

# - name: Setup
# run: |
# # playwright
# npx playwright install

# # 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|"../AivisSpeech-Engine/run.exe"|"${{ steps.download-engine.outputs.run_path }}"|' .env.test
# cp .env.test .env

# - name: Run npm run test:browser-e2e
# run: |
# if [ -n "${{ runner.debug }}" ]; then
# export DEBUG="pw:browser*"
# fi
# ARGS=""
# if [[ ${{ needs.config.outputs.shouldUpdateSnapshots }} == 'true' ]]; then
# ARGS="--update-snapshots"
# fi
# npm run test:browser-e2e -- $ARGS

# - name: Run npm run test:electron-e2e
# run: |
# if [ -n "${{ runner.debug }}" ]; then
# export DEBUG="pw:browser*"
# fi
# if [[ ${{ matrix.os }} == ubuntu-* ]]; then
# xvfb-run --auto-servernum npm run test:electron-e2e
# else
# npm run test:electron-e2e
# fi

# - name: Upload playwright report to artifact
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: playwright-report-${{ matrix.os }}
# path: playwright-report

# - name: Collect patch for snapshots
# if: needs.config.outputs.shouldUpdateSnapshots == 'true'
# run: |
# git add --intent-to-add tests/ # git diff に表示されるようにする
# git diff tests/ # ロギング用
# git diff --binary tests/ > patch-${{ matrix.os }}.diff

# - name: Upload patch to artifact
# if: needs.config.outputs.shouldUpdateSnapshots == 'true'
# uses: actions/upload-artifact@v4
# with:
# name: updated-snapshots-${{ matrix.os }}
# path: patch-${{ matrix.os }}.diff

# commit-snapshots:
# runs-on: ubuntu-latest
# permissions:
# contents: write
# needs: [config, e2e-test]
# if: needs.config.outputs.shouldUpdateSnapshots == 'true'
# steps:
# - uses: actions/checkout@v4

# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# pattern: updated-snapshots-*
# path: patches
# merge-multiple: true

# - name: Commit updated snapshots
# run: |
# # パッチを適用
# for patch in patches/*.diff; do
# git apply --allow-empty $patch
# rm $patch
# done

# # 変更があるかチェック
# if [ -n "$(git status --porcelain)" ]; then
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git add tests/
# git commit -m "(スナップショットを更新)"
# git push
# else
# echo "No changes to commit"
# fi

lint:
runs-on: ubuntu-latest
Expand Down

0 comments on commit bdd55f4

Please sign in to comment.