| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| VENV_PATH: ./venv | |
| VOICEVOX_SKIP_IF_EXISTS: true | |
| HF_SPACE: Kyosuke0/yomitalk_staging | |
| jobs: | |
| format-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install linting dependencies | |
| run: | | |
| make setup-lint | |
| - name: Run linting checks | |
| run: | | |
| make lint-ci | |
| e2e-tests: | |
| runs-on: ubuntu-latest | |
| needs: format-check | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies and setup | |
| run: | | |
| VOICEVOX_ACCEPT_AGREEMENT=true make setup | |
| - name: Verify environment and dependencies | |
| run: | | |
| echo "Checking virtual environment and Python packages..." | |
| ls -la $VENV_PATH/bin | |
| $VENV_PATH/bin/pip list | grep gradio | |
| # Check that the Python module can be imported | |
| $VENV_PATH/bin/python -c "import gradio; print(f'Gradio version: {gradio.__version__}')" | |
| - name: Install Playwright browsers | |
| run: | | |
| $VENV_PATH/bin/python -m playwright install chromium | |
| - name: Run E2E tests | |
| run: | | |
| $VENV_PATH/bin/python -m pytest tests/e2e/ -v -s | |
| deploy-to-hf: | |
| runs-on: ubuntu-latest | |
| needs: e2e-tests | |
| if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'workflow_dispatch' || github.event_name == 'push') }} | |
| environment: | |
| name: huggingface-spaces | |
| url: https://huggingface.co/spaces/${{ env.HF_SPACE }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "actions@github.com" | |
| git config --global http.postBuffer 524288000 | |
| git config --global http.lowSpeedLimit 1000 | |
| git config --global http.lowSpeedTime 300 | |
| - name: Deploy to Hugging Face Spaces | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| echo "Starting deployment to Hugging Face Spaces..." | |
| git push -f https://Kyosuke0:$HF_TOKEN@huggingface.co/spaces/$HF_SPACE main | |
| echo "Deployment completed successfully!" | |