Skip to content

Commit

Permalink
build-macos: use libcore.dylib in 0.10.preview.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aoirint committed Dec 30, 2021
1 parent 77e271b commit 2d7c45d
Showing 1 changed file with 34 additions and 31 deletions.
65 changes: 34 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
python_architecture: 'x64'
pip_cache_path: ~/Library/Caches/pip
voicevox_resource_version: '0.10.preview.1'
voicevox_core_version: '0.9.0'
voicevox_core_example_version: '0.9.0'
voicevox_core_version: '0.10.preview.0'
voicevox_core_source_version: '0.10.preview.0'
voicevox_core_library_name: libcore_cpu_x64.dylib
onnxruntime_url: https://github.com/microsoft/onnxruntime/releases/download/v1.9.0/onnxruntime-osx-x64-1.9.0.tgz
artifact_name: macos-x64

Expand Down Expand Up @@ -60,7 +61,7 @@ jobs:
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') }}
key: ${{ runner.os }}-libs-build_voicevox-${{ matrix.python }}-${{ matrix.python_architecture }}-${{ matrix.voicevox_core_version }}-${{ matrix.voicevox_core_source_version }}-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}

- name: Prepare Python venv for licenses.json generation cache
uses: actions/cache@v2
Expand Down Expand Up @@ -146,7 +147,7 @@ jobs:
id: voicevox-core-cache
with:
key: ${{ matrix.os }}-voicevox-core-${{ matrix.voicevox_core_version }}
path: download/core
path: download/voicevox_core

- name: Download VOICEVOX Core
if: steps.voicevox-core-cache.outputs.cache-hit != 'true'
Expand All @@ -155,44 +156,48 @@ jobs:
curl -L "https://github.com/VOICEVOX/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
mv core/ voicevox_core
- 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
# Install VOICEVOX Core Python package
- name: Prepare VOICEVOX Core source cache
uses: actions/cache@v2
id: voicevox-core-example-cache
id: voicevox-core-source-cache
with:
key: ${{ matrix.os }}-voicevox-core-example-${{ matrix.voicevox_core_example_version }}
path: download/voicevox_core_example
key: ${{ matrix.os }}-voicevox-core-source-${{ matrix.voicevox_core_source_version }}
path: download/voicevox_core_source

- 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/VOICEVOX/voicevox_core.git" download/voicevox_core_example
- name: Checkout VOICEVOX Core source
if: steps.voicevox-core-source-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: VOICEVOX/voicevox_core
ref: ${{ matrix.voicevox_core_source_version }}
path: download/voicevox_core_source

- name: Install dependencies for building VOICEVOX Core Python package
shell: bash
run: |
pip install -r download/voicevox_core_example/example/python/requirements.txt
pip install -r download/voicevox_core_source/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/
cd download/voicevox_core_source
mkdir -p core/lib
# Copy VOICEVOX Core dylib to core/lib
cp download/core/${{ matrix.voicevox_core_library_name }} download/voicevox_core_source/core/lib/libcore.dylib
CPATH="$NUMPY_INCLUDE:${CPATH:-}" pip install download/voicevox_core_example/example/python/
cp core/src/core.h core/lib/
cd -
# Copy ONNX Runtime dylib
cp download/onnxruntime/lib/libonnxruntime.*.dylib download/voicevox_core_source/core/lib/
# Install VOICEVOX Core Python package with libcore.dylib & libonnxruntime.*.dylib
cd download/voicevox_core_source
NUMPY_INCLUDE=`python -c "import numpy; print(numpy.get_include())"`
CPATH="$NUMPY_INCLUDE:${CPATH:-}" pip install .
- name: Install dependencies for building VOICEVOX engine
shell: bash
Expand Down Expand Up @@ -234,8 +239,6 @@ jobs:
--include-data-file=../VERSION.txt=./ \
--include-data-file=../licenses.json=./ \
--include-data-file=../presets.yaml=./ \
--include-data-file=../download/onnxruntime/lib/libonnxruntime.*.dylib=./ \
--include-data-file=../download/core/libcore.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/ \
Expand Down

0 comments on commit 2d7c45d

Please sign in to comment.