mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-11-27 01:44:10 +08:00
69 lines
2.4 KiB
YAML
69 lines
2.4 KiB
YAML
name: Inference Tests and Image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Install inference runtime
|
|
run: |
|
|
python -m pip install torch==2.7.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cpu
|
|
python -m pip install -r requirements.txt
|
|
- name: Prepare language resources
|
|
run: python -c "import nltk; [nltk.download(n, quiet=True, raise_on_error=True) for n in ('cmudict','punkt','punkt_tab','averaged_perceptron_tagger','averaged_perceptron_tagger_eng')]; import pyopenjtalk; pyopenjtalk.g2p('test')"
|
|
- name: Import service without model weights
|
|
run: python -c "import api_v2; assert api_v2.tts_pipeline is None"
|
|
- name: Test API, streaming, and checkpoint compatibility
|
|
run: python -m unittest discover -s tests -t . -p "test_*.py"
|
|
|
|
docker:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Set image name
|
|
shell: bash
|
|
run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/gpt-sovits-inference" >> "$GITHUB_ENV"
|
|
- name: Build inference image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
load: true
|
|
tags: ${{ env.IMAGE }}:latest
|
|
- name: Verify container imports and HTTP contract
|
|
run: |
|
|
docker run --rm --entrypoint python "$IMAGE:latest" -c "import api_v2; assert api_v2.tts_pipeline is None"
|
|
docker run --rm --entrypoint python "$IMAGE:latest" -m unittest tests.test_api_v2_streaming
|
|
- name: Log in to GitHub Container Registry
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Publish inference image
|
|
if: github.event_name != 'pull_request'
|
|
run: docker push "$IMAGE:latest"
|