From d84830eebcb6a3ab0e76ca5abe1b8557150d2d46 Mon Sep 17 00:00:00 2001 From: michelia Date: Fri, 22 Nov 2024 11:21:09 +0800 Subject: [PATCH] test: ci --- .github/workflows/ci.yml | 126 +++++++++++++++++++------------------- hack/lib/windows/util.ps1 | 16 ++++- hack/windows/build.ps1 | 2 +- hack/windows/install.ps1 | 2 +- 4 files changed, 78 insertions(+), 68 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8222712..d461bee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,76 +11,76 @@ on: - "**.gif" jobs: - linux-macos: - timeout-minutes: 20 - runs-on: ubuntu-latest + # linux-macos: + # timeout-minutes: 20 + # runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.11"] - os: [linux, darwin] - steps: - - name: Free Disk Space - if: matrix.os == 'linux' - uses: jlumbroso/free-disk-space@main - with: - android: true - dotnet: true - haskell: true - - uses: actions/checkout@v4 - name: Checkout code + # strategy: + # matrix: + # python-version: ["3.11"] + # os: [linux, darwin] + # steps: + # - name: Free Disk Space + # if: matrix.os == 'linux' + # uses: jlumbroso/free-disk-space@main + # with: + # android: true + # dotnet: true + # haskell: true + # - uses: actions/checkout@v4 + # name: Checkout code - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + # - name: Set up Python + # uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cache/pypoetry/artifacts - ~/.cache/pypoetry/repository - ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} - restore-keys: | - ${{ runner.os }}-poetry-${{ matrix.python-version }}- + # - name: Cache dependencies + # uses: actions/cache@v4 + # with: + # path: | + # ~/.cache/pypoetry/artifacts + # ~/.cache/pypoetry/repository + # ~/.cache/pypoetry/virtualenvs + # key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} + # restore-keys: | + # ${{ runner.os }}-poetry-${{ matrix.python-version }}- - - name: Run CI build - run: | - df -h - make ci - df -h - env: - BUILD_OS: ${{ matrix.os }} + # - name: Run CI build + # run: | + # df -h + # make ci + # df -h + # env: + # BUILD_OS: ${{ matrix.os }} - - name: Upload wheel as artifact - if: matrix.python-version == '3.11' && matrix.os == 'linux' - uses: actions/upload-artifact@v4 - with: - name: speech-dist - path: dist/*.whl - retention-days: 5 + # - name: Upload wheel as artifact + # if: matrix.python-version == '3.11' && matrix.os == 'linux' + # uses: actions/upload-artifact@v4 + # with: + # name: speech-dist + # path: dist/*.whl + # retention-days: 5 - - name: Release GitHub Assets - uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.11' && matrix.os == 'linux' - with: - # Draft for official releases to prepare and review release notes before publishing - draft: ${{ !contains(github.ref, 'rc') }} - fail_on_unmatched_files: true - prerelease: ${{ contains(github.ref, 'rc') }} - files: dist/*.whl + # - name: Release GitHub Assets + # uses: softprops/action-gh-release@v2 + # if: startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.11' && matrix.os == 'linux' + # with: + # # Draft for official releases to prepare and review release notes before publishing + # draft: ${{ !contains(github.ref, 'rc') }} + # fail_on_unmatched_files: true + # prerelease: ${{ contains(github.ref, 'rc') }} + # files: dist/*.whl - - name: Publish to PyPI - if: startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.11' && matrix.os == 'linux' - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.CI_PYPI_API_TOKEN }} - TWINE_REPOSITORY: ${{ vars.CI_PYPI_REPOSITORY || '' }} - PUBLISH_SOURCE: ${{ matrix.os == 'linux' && '1' || '' }} - run: | - make publish-pypi + # - name: Publish to PyPI + # if: startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.11' && matrix.os == 'linux' + # env: + # TWINE_USERNAME: __token__ + # TWINE_PASSWORD: ${{ secrets.CI_PYPI_API_TOKEN }} + # TWINE_REPOSITORY: ${{ vars.CI_PYPI_REPOSITORY || '' }} + # PUBLISH_SOURCE: ${{ matrix.os == 'linux' && '1' || '' }} + # run: | + # make publish-pypi windows-amd64: timeout-minutes: 20 diff --git a/hack/lib/windows/util.ps1 b/hack/lib/windows/util.ps1 index 91979d9..11a0609 100644 --- a/hack/lib/windows/util.ps1 +++ b/hack/lib/windows/util.ps1 @@ -1,11 +1,21 @@ $ROOT_DIR = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent | Split-Path -Parent | Split-Path -Parent | Split-Path -Parent -Resolve function Ignore-Thirdparty-InvalidFile { - $dataFileDir = "$env:ROOT_DIR/vox_box/third_party/CosyVoice/third_party/Matcha-TTS" + $dataFileDir = Join-Path -Path $ROOT_DIR -ChildPath "vox_box/third_party/CosyVoice/third_party/Matcha-TTS" + if (-Not (Test-Path -Path $dataFileDir)) { + Write-Host "Directory $dataFileDir does not exist. Skipping." + return + } + Push-Location -Path $dataFileDir try { - git update-index --assume-unchanged "data" - Remove-Item -Recurse -Force "data" + if (Test-Path -Path "data") { + git update-index --assume-unchanged "data" + Remove-Item -Recurse -Force "data" + } + else { + Write-Host "File 'data' does not exist. Skipping." + } } finally { Pop-Location diff --git a/hack/windows/build.ps1 b/hack/windows/build.ps1 index 5dfacfa..4f6b006 100644 --- a/hack/windows/build.ps1 +++ b/hack/windows/build.ps1 @@ -9,7 +9,7 @@ $ROOT_DIR = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent | Split- function Build { $distDir = Join-Path -Path $ROOT_DIR -ChildPath "dist" Remove-Item -Path $distDir -Recurse -Force -ErrorAction SilentlyContinue - + Ignore-Thirdparty-InvalidFile poetry build if ($LASTEXITCODE -ne 0) { diff --git a/hack/windows/install.ps1 b/hack/windows/install.ps1 index b8ad29d..6747500 100644 --- a/hack/windows/install.ps1 +++ b/hack/windows/install.ps1 @@ -11,7 +11,7 @@ function Install-Dependency { git submodule update --init --recursive Ignore-Thirdparty-InvalidFile - + pip install poetry==1.8.3 pre-commit==4.0.1 if ($LASTEXITCODE -ne 0) { SpeechBox.Log.Fatal "failed to install poetry."