name: Test Package

on:
  workflow_dispatch:       # запуск вручную

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        python-version: ["3.8","3.9","3.10","3.11","3.12","3.13"]

    steps:
    - uses: actions/checkout@v4

    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install build hatchling pytest soundfile
        pip install .[test]
        pip install .[onnx-cpu]

    - name: Build package
      run: python -m build --wheel --outdir dist

    - name: Install package
      run: |
        import glob, subprocess, sys
        whl = glob.glob("dist/*.whl")[0]
        subprocess.check_call([sys.executable, "-m", "pip", "install", whl])
      shell: python

    - name: Run tests
      run: pytest tests
