Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasesにアップロードされるzipの構造を変更 #117

Merged
merged 15 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 27 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,91 +255,55 @@ jobs:
pip install -r requirements.txt
python setup.py test

- name: Organize artifact
- name: Set BUILD_IDENTIFIER env var
shell: bash
run: |
mkdir artifact
echo "BUILD_IDENTIFIER=${GITHUB_REF##*/}" >> $GITHUB_ENV

# remove files with duplicate names to create a flat release archive
rm -vf core/lib/core.h
- name: Set ASSET_NAME env var
shell: bash
run: |
echo "ASSET_NAME=voicevox_core-${{ matrix.artifact_name }}-${{ env.BUILD_IDENTIFIER }}" >> $GITHUB_ENV

- name: Organize artifact
shell: bash
run: |
mkdir -p "artifact/${{ env.ASSET_NAME }}"

# copy Windows DLL if exists
cp -v core/lib/core* artifact/ || true
# copy core.h (and Windows DLL if exists)
cp -v core/lib/core* "artifact/${{ env.ASSET_NAME }}" || true
# copy Linux/macOS shared library if exists
cp -v core/lib/libcore* artifact/ || true
cp -v core/lib/libcore* "artifact/${{ env.ASSET_NAME }}" || true

echo "${{ env.BUILD_IDENTIFIER }}" > "artifact/${{ env.ASSET_NAME }}/VERSION"

# Upload
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact_name }}-cpp-shared
path: artifact/*
path: artifact/${{ env.ASSET_NAME }}/*
retention-days: 7

# Create core.zip
upload-to-release-cpp-shared:
if: github.event.release.tag_name != ''
needs: [build-cpp-shared]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set BUILD_IDENTIFIER env var
- name: Archive artifact
if: github.event.release.tag_name != '' && !startsWith(matrix.os, 'windows-')
shell: bash
run: |
echo "BUILD_IDENTIFIER=${GITHUB_REF##*/}" >> $GITHUB_ENV
cd artifact
zip -r "../${{ env.ASSET_NAME }}.zip" "${{ env.ASSET_NAME }}"

- name: Install dependencies
- name: Archive artifact (Windows)
if: github.event.release.tag_name != '' && startsWith(matrix.os, 'windows-')
run: |
sudo apt-get update
sudo apt-get install -y \
zip

- name: Download and extract artifact
uses: actions/download-artifact@v2
with:
path: artifacts/

- name: Rearchive artifacts
run: |
mkdir release

readarray -t MAPPINGS <<EOF
windows-x64-cuda
windows-x64-directml
windows-x64-cpu
windows-x86-cpu
windows-arm64-cpu
windows-arm-cpu
osx-universal2-cpu
linux-x64-gpu
linux-x64-cpu
linux-armhf-cpu
linux-arm64-cpu
EOF

for KND in "${MAPPINGS[@]}"; do
cp core/src/core.h "artifacts/${KND}-cpp-shared"
echo "${{ env.BUILD_IDENTIFIER }}" > "artifacts/${KND}-cpp-shared/VERSION"

cd "artifacts/${KND}-cpp-shared"
zip -r "../../release/${KND}-cpp-shared.zip" *
cd -
done

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: core
path: artifacts/*
powershell Compress-Archive -Path "artifact/${{ env.ASSET_NAME }}" -DestinationPath "${{ env.ASSET_NAME }}.zip"

- name: Upload to Release
if: env.SKIP_UPLOADING_RELEASE_ASSET == '0'
if: github.event.release.tag_name != '' && env.SKIP_UPLOADING_RELEASE_ASSET == '0'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # ==> github.event.release.tag_name
file: release/*.zip
file_glob: true
file: ${{ env.ASSET_NAME }}.zip

build-win-cpp-example:
runs-on: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion example/cpp/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Visual Studio Installerを使用しインストールしてください。
ビルドして実行するには、「core.dll」「core.lib」「Open JTalk辞書フォルダ」が必要です。
以下はDebug x64でビルドする場合です。他の構成・プラットフォーム向けにビルドする場合は、適宜読み替えてください。

Releasesから「windows-x64-cpu-cpp-shared.zip」をダウンロードします。
Releasesから「voicevox_core-windows-x64-cpu-{バージョン名}.zip」をダウンロードします。
zipファイルを展開し、展開されたフォルダに含まれているdllファイルを「core.dll」にリネームします。
出力フォルダを作成するために、一度ビルドします。「windows_example.sln」をVisual Studioで開き、メニューの「ビルド」→「ソリューションのビルド」を押します。
この段階では、ビルドは失敗します。「bin」フォルダと「lib」フォルダが生成されていればOKです。
Expand Down