forked from VOICEVOX/voicevox_engine
-
Notifications
You must be signed in to change notification settings - Fork 2
700 lines (606 loc) · 25.5 KB
/
build.yml
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
name: build
on:
push:
branches:
- master
release:
types:
- created
env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/voicevox_engine
jobs:
# Build Mac binary (x64 arch only)
build-mac:
strategy:
matrix:
include:
- os: [macos-11]
python: '3.7'
python_architecture: 'x64'
pip_cache_path: ~/Library/Caches/pip
voicevox_resource_version: '0.8.0'
voicevox_core_version: '0.8.0'
voicevox_core_example_version: '0.8.0'
artifact_name: macos-x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install LibTorch and CCache
shell: bash
run: brew install libtorch ccache
- name: Create download and build directory
run: mkdir download build
- name: Setup Python
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.python_architecture }}
- name: Prepare Python dependencies cache
uses: actions/cache@v2
id: pip-cache
with:
path: ${{ matrix.pip_cache_path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Prepare Python for building VOICEVOX engine cache
uses: actions/cache@v2
id: venv-build-voicevox-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-libs-build_voicevox-${{ matrix.python }}-${{ matrix.python_architecture }}-${{ matrix.voicevox_core_version }}-${{ matrix.voicevox_core_example_version }}-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
- name: Prepare Python venv for licenses.json generation cache
uses: actions/cache@v2
id: venv-generate-licenses-cache
with:
path: generate_licenses
key: ${{ runner.os }}-venv-libs-generate_licenses-${{ matrix.python }}-${{ matrix.python_architecture }}-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
- name: Prepare Python venv for licenses.json generation
shell: bash
run: python -m venv generate_licenses
- name: Install dependencies for licenses.json generation
if: steps.venv-generate-licenses-cache.outputs.cache-hit != 'true'
shell: bash
run: |
source generate_licenses/bin/activate
pip install --upgrade pip setuptools wheel
pip install -r requirements-dev.txt
deactivate
- name: Generate licenses.json
shell: bash
run: |
source generate_licenses/bin/activate
python generate_licenses.py > licenses.json
deactivate
# Download VOICEVOX RESOURCE
- name: Prepare VOICEVOX RESOURCE cache
uses: actions/cache@v2
id: voicevox-resource-cache
with:
key: voicevox-resource-${{ matrix.voicevox_resource_version }}
path: download/resource
- name: Checkout VOICEVOX RESOURCE
if: steps.voicevox-resource-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: Hiroshiba/voicevox_resource
path: download/resource
# Merge VOICEVOX RESOURCE
- name: Merge VOICEVOX RESOURCE
shell: bash
run: |
set -eux
rm -r speaker_info
cp -r download/resource/character_info speaker_info
- name: Prepare VOICEVOX Core cache
uses: actions/cache@v2
id: voicevox-core-cache
with:
key: ${{ matrix.os }}-voicevox-core-${{ matrix.voicevox_core_version }}
path: download/core
- name: Download VOICEVOX Core
if: steps.voicevox-core-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L "https://github.com/Hiroshiba/voicevox_core/releases/download/${{ matrix.voicevox_core_version }}/core.zip" > download/core.zip
ditto -x -k --sequesterRsrc --rsrc download/core.zip download/
rm download/core.zip
- name: Prepare VOICEVOX Core file
if: steps.voicevox-core-cache.outputs.cache-hit != 'true'
shell: bash
run: mv libcore_cpu.dylib libcore.dylib
working-directory: download/core
- name: Export VOICEVOX Core path to LD_LIBRARY_PATH and LIBRARY_PATH
run: |
echo "LD_LIBRARY_PATH=$(pwd):${{ env.LD_LIBRARY_PATH }}" >> $GITHUB_ENV
echo "LIBRARY_PATH=$(pwd):${{ env.LIBRARY_PATH }}" >> $GITHUB_ENV
working-directory: download/core
- name: Prepare VOICEVOX Core example cache
uses: actions/cache@v2
id: voicevox-core-example-cache
with:
key: ${{ matrix.os }}-voicevox-core-example-${{ matrix.voicevox_core_example_version }}
path: download/voicevox_core_example
- name: Clone VOICEVOX Core example
if: steps.voicevox-core-example-cache.outputs.cache-hit != 'true'
shell: bash
run: |
git clone -b "${{ matrix.voicevox_core_example_version }}" --depth 1 "https://github.com/Hiroshiba/voicevox_core.git" download/voicevox_core_example
- name: Install dependencies for building VOICEVOX Core Python package
shell: bash
run: |
pip install -r download/voicevox_core_example/example/python/requirements.txt
- name: Install VOICEVOX Core Python package
shell: bash
run: |
NUMPY_INCLUDE=`python -c "import numpy; print(numpy.get_include())"`
cp download/voicevox_core_example/core.h download/voicevox_core_example/example/python/
CPATH="$NUMPY_INCLUDE:${CPATH:-}" pip install download/voicevox_core_example/example/python/
- name: Install dependencies for building VOICEVOX engine
shell: bash
run: |
pip install -r requirements-dev.txt
- name: Download PyOpenJTalk dictionary
shell: bash
run: |
# Download pyopenjtalk dictionary
# try 5 times, sleep 5 seconds before retry
for i in $(seq 5); do
EXIT_CODE=0
python -c "import pyopenjtalk; pyopenjtalk._lazy_init()" || EXIT_CODE=$?
if [ "$EXIT_CODE" = "0" ]; then
break
fi
sleep 5
done
if [ "$EXIT_CODE" != "0" ]; then
exit "$EXIT_CODE"
fi
- name: Build run.py
run: |
python -m nuitka \
--output-dir=./ \
--standalone \
--plugin-enable=numpy \
--follow-import-to=numpy \
--follow-import-to=aiofiles \
--include-package=uvicorn \
--include-package=anyio \
--include-package-data=pyopenjtalk \
--include-package-data=resampy \
--include-package-data=llvmlite \
--include-data-file=../VERSION.txt=./ \
--include-data-file=../licenses.json=./ \
--include-data-file=../presets.yaml=./ \
--include-data-file=$(brew --prefix libtorch)/lib/*.dylib=./ \
--include-data-file=../download/core/*.dylib=./ \
--include-data-file=../download/core/*.bin=./ \
--include-data-file=../download/core/metas.json=./ \
--include-data-file=${{ env.pythonLocation }}/lib/python*/site-packages/scipy/.dylibs/*.dylib=./scipy/.dylibs/ \
--include-data-file=${{ env.pythonLocation }}/lib/python*/site-packages/llvmlite/binding/*.dylib=./ \
--include-data-file=${{ env.pythonLocation }}/lib/python*/site-packages/_soundfile_data/*=./_soundfile_data/ \
--include-data-dir=../speaker_info=./speaker_info \
--follow-imports \
--no-prefer-source-code \
../run.py
working-directory: build
- name: Set @rpath to @executable_path
run: |
install_name_tool -add_rpath @executable_path/. build/run.dist/run
# FIXME: versioned name may be useful; but
# actions/download-artifact and dawidd6/download-artifact do not support
# wildcard / forward-matching yet.
# Currently, It is good to use static artifact name for future binary test workflow.
# https://github.com/actions/toolkit/blob/ea81280a4d48fb0308d40f8f12ae00d117f8acb9/packages/artifact/src/internal/artifact-client.ts#L147
# https://github.com/dawidd6/action-download-artifact/blob/af92a8455a59214b7b932932f2662fdefbd78126/main.js#L113
- uses: actions/upload-artifact@v2
# env:
# VERSIONED_ARTIFACT_NAME: |
# ${{ format('{0}-{1}', matrix.artifact_name, (github.event.release.tag_name != '' && github.event.release.tag_name) || github.sha) }}
with:
name: ${{ matrix.artifact_name }}
path: build/run.dist/
# Build Linux binary (push only buildcache image)
build-linux:
strategy:
matrix:
os: [ubuntu-latest]
tag:
- build-cpu-ubuntu18.04
- build-nvidia-ubuntu18.04
voicevox_resource_version: ['0.8.0']
voicevox_core_version: ['0.8.0']
voicevox_core_example_version: ['0.8.0']
include:
- tag: build-cpu-ubuntu18.04
runtime_tag: cpu-ubuntu18.04 # for cache use
target: build-env
base_image: ubuntu:bionic
base_runtime_image: ubuntu:bionic
voicevox_core_library_name: core_cpu
libtorch_url: https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcpu.zip
use_glibc_231_workaround: 1
artifact_name: linux-cpu
nuitka_cache_path: nuitka_cache
- tag: build-nvidia-ubuntu18.04
runtime_tag: nvidia-ubuntu18.04 # for cache use
target: build-env
base_image: ubuntu:bionic
base_runtime_image: nvidia/driver:460.73.01-ubuntu18.04
voicevox_core_library_name: core
libtorch_url: https://download.pytorch.org/libtorch/cu111/libtorch-cxx11-abi-shared-with-deps-1.9.0%2Bcu111.zip
use_glibc_231_workaround: 1
artifact_name: linux-nvidia
nuitka_cache_path: nuitka_cache
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Download VOICEVOX RESOURCE
- name: Prepare VOICEVOX RESOURCE cache
uses: actions/cache@v2
id: voicevox-resource-cache
with:
key: voicevox-resource-${{ matrix.voicevox_resource_version }}
path: download/resource
- name: Checkout VOICEVOX RESOURCE
if: steps.voicevox-resource-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: Hiroshiba/voicevox_resource
path: download/resource
# Merge VOICEVOX RESOURCE
- name: Merge VOICEVOX RESOURCE
shell: bash
run: |
set -eux
rm -r speaker_info
cp -r download/resource/character_info speaker_info
# NOTE: `load: true` may silently fail when the GitHub Actions disk (14GB) is full.
# https://docs.github.com/ja/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
- name: Create binary build environment with Docker
uses: docker/build-push-action@v2
env:
IMAGE_TAG: ${{ env.IMAGE_NAME }}:${{ matrix.tag }}${{ (matrix.tag != '' && '-') || '' }}latest
RUNTIME_IMAGE_TAG: ${{ env.IMAGE_NAME }}:${{ matrix.runtime_tag }}${{ (matrix.runtime_tag != '' && '-') || '' }}latest
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ./Dockerfile
build-args: |
BASE_IMAGE=${{ matrix.base_image }}
BASE_RUNTIME_IMAGE=${{ matrix.base_runtime_image }}
VOICEVOX_CORE_VERSION=${{ matrix.voicevox_core_version }}
VOICEVOX_CORE_EXAMPLE_VERSION=${{ matrix.voicevox_core_example_version }}
VOICEVOX_CORE_LIBRARY_NAME=${{ matrix.voicevox_core_library_name }}
LIBTORCH_URL=${{ matrix.libtorch_url }}
USE_GLIBC_231_WORKAROUND=${{ matrix.use_glibc_231_workaround || '0' }}
target: ${{ matrix.target }}
load: true
tags: |
${{ env.IMAGE_TAG }}
cache-from: |
type=registry,ref=${{ env.IMAGE_TAG }}-buildcache
type=registry,ref=${{ env.RUNTIME_IMAGE_TAG }}-buildcache
cache-to: type=registry,ref=${{ env.IMAGE_TAG }}-buildcache,mode=max
# Build run.py with Nuitka in Docker
- name: Cache Nuitka (ccache, module-cache)
uses: actions/cache@v2
id: nuitka-cache
with:
path: ${{ matrix.nuitka_cache_path }}
key: ${{ runner.os }}-nuitka-${{ matrix.tag }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nuitka-${{ matrix.tag }}-
- name: Build run.py with Nuitka in Docker
env:
IMAGE_TAG: ${{ env.IMAGE_NAME }}:${{ matrix.tag }}${{ (matrix.tag != '' && '-') || '' }}latest
run: |
docker run --rm \
-v "$(readlink -f "${{ matrix.nuitka_cache_path }}"):/home/user/.cache/Nuitka" \
-v "$(readlink -f "build"):/opt/voicevox_engine_build" \
"${{ env.IMAGE_TAG }}"
# FIXME: versioned name may be useful; but
# actions/download-artifact and dawidd6/download-artifact do not support
# wildcard / forward-matching yet.
# Currently, It is good to use static artifact name for future binary test workflow.
# https://github.com/actions/toolkit/blob/ea81280a4d48fb0308d40f8f12ae00d117f8acb9/packages/artifact/src/internal/artifact-client.ts#L147
# https://github.com/dawidd6/action-download-artifact/blob/af92a8455a59214b7b932932f2662fdefbd78126/main.js#L113
- uses: actions/upload-artifact@v2
# env:
# VERSIONED_ARTIFACT_NAME: |
# ${{ format('{0}-{1}', matrix.artifact_name, (github.event.release.tag_name != '' && github.event.release.tag_name) || github.sha) }}
with:
name: ${{ matrix.artifact_name }}
path: build/run.dist/
build-windows:
strategy:
matrix:
include:
# Windows CPU
- os: windows-2019
python: '3.7'
python_architecture: 'x64'
voicevox_resource_version: '0.8.0'
voicevox_core_version: '0.8.0'
voicevox_core_dll_name: core_cpu.dll
voicevox_core_example_version: '0.8.0'
libtorch_url: https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.9.0%2Bcpu.zip
ccache_url: https://github.com/ccache/ccache/releases/download/v4.4.1/ccache-4.4.1-windows-64.zip
artifact_name: windows-cpu
nuitka_cache_path: nuitka_cache
pip_cache_path: ~\AppData\Local\pip\Cache
# Windows NVIDIA GPU
- os: windows-2019
python: '3.7'
python_architecture: 'x64'
voicevox_resource_version: '0.8.0'
voicevox_core_version: '0.8.0'
voicevox_core_dll_name: core.dll
voicevox_core_example_version: '0.8.0'
libtorch_url: https://download.pytorch.org/libtorch/cu111/libtorch-win-shared-with-deps-1.9.0%2Bcu111.zip
ccache_url: https://github.com/ccache/ccache/releases/download/v4.4.1/ccache-4.4.1-windows-64.zip
artifact_name: windows-nvidia
nuitka_cache_path: nuitka_cache
pip_cache_path: ~\AppData\Local\pip\Cache
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
# Python install path: C:/hostedtoolcache/windows/Python
- name: Setup Python
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.python_architecture }}
# Install Python dependencies
- name: Prepare Python dependencies cache
uses: actions/cache@v2
id: pip-cache
with:
path: ${{ matrix.pip_cache_path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
shell: bash
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements-dev.txt
# Download pyopenjtalk dictionary
# try 5 times, sleep 5 seconds before retry
for i in $(seq 5); do
EXIT_CODE=0
python3 -c "import pyopenjtalk; pyopenjtalk._lazy_init()" || EXIT_CODE=$?
if [ "$EXIT_CODE" = "0" ]; then
break
fi
sleep 5
done
if [ "$EXIT_CODE" != "0" ]; then
exit "$EXIT_CODE"
fi
- name: Create download directory
shell: bash
run: mkdir -p download/
# Install Ccache
- name: Export Ccache url to calc hash
shell: bash
run: echo "${{ matrix.ccache_url }}" > download/ccache_url.txt
- name: Prepare Ccache
uses: actions/cache@v2
id: ccache-cache
with:
key: ${{ matrix.os }}-ccache-${{ hashFiles('download/ccache_url.txt') }}
path: download/ccache
- name: Download Ccache
if: steps.ccache-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L "${{ matrix.ccache_url }}" > download/ccache.zip
unzip download/ccache.zip -d download/
rm download/ccache.zip
mv download/ccache-*/ download/ccache
- name: Install Ccache
shell: bash
run: |
echo "$HOME/download/ccache" >> $GITHUB_PATH
# Download LibTorch
# Included:
# - CUDA
# - cuDNN
- name: Export LibTorch url to calc hash
shell: bash
run: echo "${{ matrix.libtorch_url }}" > download/libtorch_url.txt
- name: Prepare LibTorch cache
uses: actions/cache@v2
id: libtorch-dll-cache
with:
key: ${{ matrix.os }}-libtorch-dll-${{ hashFiles('download/libtorch_url.txt') }}
path: download/libtorch
- name: Download LibTorch (CUDA, cuDNN included)
if: steps.libtorch-dll-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L "${{ matrix.libtorch_url }}" > download/libtorch.zip
# extract only dlls
unzip download/libtorch.zip libtorch/lib/*.dll -d download/
rm download/libtorch.zip
- name: Show disk space (debug info)
shell: bash
run: |
df -h
# Download VOICEVOX RESOURCE
- name: Prepare VOICEVOX RESOURCE cache
uses: actions/cache@v2
id: voicevox-resource-cache
with:
key: voicevox-resource-${{ matrix.voicevox_resource_version }}
path: download/resource
- name: Checkout VOICEVOX RESOURCE
if: steps.voicevox-resource-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: Hiroshiba/voicevox_resource
path: download/resource
# Merge VOICEVOX RESOURCE
- name: Merge VOICEVOX RESOURCE
shell: bash
run: |
set -eux
rm -r speaker_info
cp -r download/resource/character_info speaker_info
# Download VOICEVOX Core
- name: Prepare VOICEVOX Core cache
uses: actions/cache@v2
id: voicevox-core-cache
with:
key: ${{ matrix.os }}-voicevox-core-${{ matrix.voicevox_core_version }}
path: download/core
- name: Download VOICEVOX Core
if: steps.voicevox-core-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L "https://github.com/Hiroshiba/voicevox_core/releases/download/${{ matrix.voicevox_core_version }}/core.zip" > download/core.zip
unzip download/core.zip -d download/
rm download/core.zip
# Install VOICEVOX Core example
- name: Prepare VOICEVOX Core example cache
uses: actions/cache@v2
id: voicevox-core-example-cache
with:
key: ${{ matrix.os }}-voicevox-core-example-${{ matrix.voicevox_core_example_version }}
path: download/voicevox_core_example
- name: Clone VOICEVOX Core example
if: steps.voicevox-core-example-cache.outputs.cache-hit != 'true'
shell: bash
run: |
git clone -b "${{ matrix.voicevox_core_example_version }}" --depth 1 "https://github.com/Hiroshiba/voicevox_core.git" download/voicevox_core_example
- name: Install VOICEVOX Core Python package
shell: bash
run: |
cp download/core/${{ matrix.voicevox_core_dll_name }} download/voicevox_core_example/example/python/core.dll
cp download/voicevox_core_example/core.h download/voicevox_core_example/example/python/
cd download/voicevox_core_example/example/python
./makelib.bat core
pip install .
- name: Generate licenses.json
shell: bash
run: python generate_licenses.py > licenses.json
- name: Cache Nuitka (ccache, module-cache)
uses: actions/cache@v2
id: nuitka-cache
with:
path: ${{ matrix.nuitka_cache_path }}
key: ${{ runner.os }}-nuitka-${{ github.sha }}
restore-keys: |
${{ runner.os }}-nuitka-
- name: Show disk space (debug info)
shell: bash
run: |
df -h
- name: Build run.py with Nuitka
shell: bash
env:
NUITKA_CACHE_DIR: ${{ matrix.nuitka_cache_path }}
run:
python -m nuitka
--standalone
--assume-yes-for-downloads
--plugin-enable=numpy
--follow-import-to=numpy
--follow-import-to=aiofiles
--include-package=uvicorn
--include-package=anyio
--include-package-data=pyopenjtalk
--include-package-data=resampy
--include-data-file="VERSION.txt=./"
--include-data-file="licenses.json=./"
--include-data-dir="speaker_info=./speaker_info"
--msvc=14.2
--follow-imports
--no-prefer-source-code
run.py
- name: Show disk space (debug info)
shell: bash
run: |
df -h
- name: Create artifact directory with symlink
shell: bash
env:
PYTHON_SITE_PACKAGES_DIR: C:/hostedtoolcache/windows/python/${{ steps.setup-python.outputs.python-version }}/x64/lib/site-packages
# create symlink instead of copy (Git Bash)
# https://qiita.com/ucho/items/c5ea0beb8acf2f1e4772
MSYS: winsymlinks:nativestrict
run: |
set -eux
mkdir -p artifact
ln -sf "$(pwd)/run.dist"/* artifact/
ln -sf "$(pwd)/download/libtorch/lib"/*.dll artifact/
ln -sf "$(pwd)/download/core"/*.bin artifact/
ln -sf "$(pwd)/download/voicevox_core_example/example/python/"*.dll artifact/
ln -sf "$(pwd)/download/core/metas.json" artifact/
ln -sf "${{ env.PYTHON_SITE_PACKAGES_DIR }}/_soundfile_data" artifact/
ln -sf "${{ env.PYTHON_SITE_PACKAGES_DIR }}/llvmlite/binding/llvmlite.dll" artifact/
# FIXME: versioned name may be useful; but
# actions/download-artifact and dawidd6/download-artifact do not support
# wildcard / forward-matching yet.
# Currently, It is good to use static artifact name for future binary test workflow.
# https://github.com/actions/toolkit/blob/ea81280a4d48fb0308d40f8f12ae00d117f8acb9/packages/artifact/src/internal/artifact-client.ts#L147
# https://github.com/dawidd6/action-download-artifact/blob/af92a8455a59214b7b932932f2662fdefbd78126/main.js#L113
- uses: actions/upload-artifact@v2
# env:
# VERSIONED_ARTIFACT_NAME: |
# ${{ format('{0}-{1}', matrix.artifact_name, (github.event.release.tag_name != '' && github.event.release.tag_name) || github.sha) }}
with:
name: ${{ matrix.artifact_name }}
path: |
artifact/
upload-to-release:
if: github.event.release.tag_name != ''
needs: [build-mac, build-linux, build-windows]
runs-on: ubuntu-latest
strategy:
matrix:
artifact_name:
- macos-x64
- linux-cpu
- linux-nvidia
- windows-cpu
- windows-nvidia
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
p7zip-full
- name: Download and extract artifact
uses: actions/download-artifact@v2
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}/
- name: Rearchive and split artifact
run: |
# compressed to artifact.7z.001, artifact.7z.002, ...
7z -r -v1g a "${{ matrix.artifact_name }}.7z" "${{ matrix.artifact_name }}/"
# Output splitted archive list
ls ${{ matrix.artifact_name }}.7z.* > archives.txt
mv archives.txt "${{ matrix.artifact_name }}.7z.txt"
- name: Upload splitted archives to Release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # == github.event.release.tag_name
file_glob: true
file: ${{ matrix.artifact_name }}.7z.*