forked from mediatechlab/tts-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 4
180 lines (155 loc) · 5.85 KB
/
Copy pathpythonpackage.yml
File metadata and controls
180 lines (155 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Build, Test, and Publish
on:
push:
branches:
- main
paths-ignore:
- 'website/**'
- 'docs/**'
- '*.md'
tags:
- 'v*.*.*'
pull_request:
branches:
- main
paths-ignore:
- 'website/**'
- 'docs/**'
- '*.md'
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure all tags are fetched
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install eSpeak NG on Windows
run: |
$url = "https://github.com/espeak-ng/espeak-ng/releases/download/1.51/espeak-ng-X64.msi"
Invoke-WebRequest -Uri $url -OutFile espeak-ng.msi
Start-Process msiexec.exe -ArgumentList '/i', 'espeak-ng.msi', '/quiet', '/norestart' -NoNewWindow -Wait
# Add eSpeak NG installation directory to PATH and persist it
$espeakPath = "C:\Program Files\eSpeak NG"
echo "PATH=$env:PATH;$espeakPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Verify eSpeak NG Installation
run: espeak-ng --version
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/.cache/pip
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Install `uv`
run: pip install uv
- name: Install dependencies
run: uv sync --group dev --extra google --extra watson --extra polly --extra microsoft --extra googletrans --extra witai --extra elevenlabs --extra controlaudio --extra sherpaonnx --extra espeak --extra sapi --extra avsynth
- name: Run postinstall script
run: uv run postinstall
- name: Build package
run: uv build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
env:
WATSON_API_KEY: ${{ secrets.WATSON_API_KEY }}
WATSON_API_URL: ${{ secrets.WATSON_API_URL }}
WATSON_REGION: ${{ secrets.WATSON_REGION }}
WATSON_INSTANCE_ID: ${{ secrets.WATSON_INSTANCE_ID }}
MICROSOFT_TOKEN: ${{ secrets.MICROSOFT_TOKEN }}
MICROSOFT_REGION: ${{ secrets.MICROSOFT_REGION }}
POLLY_REGION: ${{ secrets.POLLY_REGION }}
POLLY_AWS_KEY_ID: ${{ secrets.POLLY_AWS_KEY_ID }}
POLLY_AWS_ACCESS_KEY: ${{ secrets.POLLY_AWS_ACCESS_KEY }}
ELEVENLABS_API_KEY: ${{ secrets.ELEVENLABS_API_KEY }}
WITAI_TOKEN: ${{ secrets.WITAI_TOKEN }}
GOOGLE_SA_PATH: ${{ secrets.GOOGLE_SA_PATH }}
GOOGLE_SA_FILE_B64: ${{ secrets.GOOGLE_SA_FILE_B64 }}
PLAYHT_API_KEY: ${{ secrets.PLAYHT_API_KEY }}
PLAYHT_USER_ID: ${{ secrets.PLAYHT_USER_ID }}
UPLIFTAI_KEY: ${{ secrets.UPLIFTAI_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install eSpeak NG on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -y
sudo apt-get install -y portaudio19-dev libttspico-utils ffmpeg espeak-ng
- name: Install eSpeak NG on macOS
if: matrix.os == 'macos-latest'
run: |
brew install portaudio ffmpeg espeak-ng
- name: Install eSpeak NG on Windows
if: matrix.os == 'windows-latest'
run: |
$url = "https://github.com/espeak-ng/espeak-ng/releases/download/1.51/espeak-ng-X64.msi"
Invoke-WebRequest -Uri $url -OutFile espeak-ng.msi
Start-Process msiexec.exe -ArgumentList '/i', 'espeak-ng.msi', '/quiet', '/norestart' -NoNewWindow -Wait
# Add eSpeak NG installation directory to PATH and persist it
$espeakPath = "C:\Program Files\eSpeak NG"
echo "PATH=$env:PATH;$espeakPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Verify eSpeak NG Installation
run: espeak-ng --version
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/uv
~/.cache/pip
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Install `uv`
run: pip install uv
- name: Install dependencies
run: uv sync --group dev --extra google --extra watson --extra polly --extra microsoft --extra googletrans --extra witai --extra elevenlabs --extra sapi --extra avsynth --extra controlaudio --extra sherpaonnx
- name: Run tests with coverage
run: |
if [ "$RUNNER_OS" = "Windows" ]; then
uv run pytest --cov=tts_wrapper -m "not synthetic and not watson"
else
uv run pytest --cov=tts_wrapper -m "not synthetic and not sapi and not watson"
fi
shell: bash
- name: Run all tests including Watson (on release only)
if: startsWith(github.ref, 'refs/tags/')
run: uv run make tests
shell: bash
publish:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: List contents of dist after download
run: ls -R dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}