forked from VOICEVOX/voicevox_engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker イメージをリリース時にテストするように追加 & ubuntu18 をベースとしたイメージのサポートを終了 (VOICEVOX…
- Loading branch information
Showing
3 changed files
with
136 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Test Docker Release Build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
type: string | ||
required: true | ||
repo_url: | ||
type: string | ||
required: false | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: "テストしたいタグ名" | ||
required: true | ||
|
||
env: | ||
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/voicevox_engine | ||
VERSION: |- # version指定時はversionを、それ以外はタグ名を使用 | ||
${{ (github.event.inputs || inputs).version }} | ||
jobs: | ||
test: | ||
runs-on: [ ubuntu-20.04 ] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
tag: | ||
- "" | ||
- cpu | ||
- cpu-ubuntu20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# | ||
# Setup Python Environment | ||
# | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8.10" | ||
cache: pip | ||
|
||
- name: Install libsndfile1 | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsndfile1 | ||
- name: Install requirements | ||
run: | | ||
pip install -r requirements-test.txt | ||
# | ||
# Setup Docker Environment | ||
# | ||
- name: Declare variables | ||
id: docker_vars | ||
run: | | ||
if [ "${{ matrix.tag }}" != "" ]; then | ||
echo "image_tag=${{ env.IMAGE_NAME }}:${{ matrix.tag }}-${{ env.VERSION }}" >> $GITHUB_OUTPUT | ||
else | ||
echo "image_tag=${{ env.IMAGE_NAME }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Docker pull | ||
run: docker pull ${{ steps.docker_vars.outputs.image_tag }} | ||
|
||
- name: Docker run | ||
run: docker run -d -p 50021:50021 ${{ steps.docker_vars.outputs.image_tag }} | ||
|
||
# Docker コンテナが起動してから、レスポンスが返ってくるまで待機する | ||
# リトライは10回まで `/version` にアクセスしてレスポンスのステータスコードをチェック | ||
# - ステータスコードが `200` の場合は正常終了します | ||
# - ステータスコードが `200` 以外の場合は、5秒間スリープしてリトライします | ||
- name: Wait for container to start | ||
shell: bash -xv {0} | ||
run: | | ||
url="http://127.0.0.1:50021/version" | ||
max_attempts=10 | ||
sleep_interval=5 | ||
for i in $(seq 1 $max_attempts); do | ||
status=$(curl -o /dev/null -s -w '%{http_code}\n' $url) | ||
if [ $status -eq 200 ]; then | ||
echo "Container is ready! Response status code: $status" | ||
exit 0 | ||
else | ||
echo "Attempt $i/$max_attempts: Response status code $status" | ||
sleep $sleep_interval | ||
fi | ||
done | ||
exit 1 | ||
- name: Test | ||
shell: bash | ||
run: python build_util/check_release_build.py --skip_run_process --dist_dir dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters