From 2d7c45d36b415bfbda40e116a98f9c50af1b8a36 Mon Sep 17 00:00:00 2001 From: aoirint Date: Thu, 30 Dec 2021 12:25:51 +0900 Subject: [PATCH] build-macos: use libcore.dylib in 0.10.preview.0 --- .github/workflows/build.yml | 65 +++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 34efe9d41..3da9a9bbe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 @@ -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' @@ -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 @@ -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/ \