Add a workaround for audioop for Python 3.13, Gradio, and pydub #252
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
DO_NOT_TRACK: 1 | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
jobs: | |
rust: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests (Rust) | |
run: cargo test --verbose | |
python: | |
runs-on: ubuntu-latest | |
needs: rust | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
.venv/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-python-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Create virtual environment | |
run: | | |
curl -LsSf https://astral.sh/uv/install.sh | sh | |
uv venv | |
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH | |
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV | |
- name: Set up Maturin | |
run: | | |
uv pip install maturin | |
maturin develop --uv --extras dev,docs,gradio | |
- if: matrix.python-version != '3.8' | |
name: Lint with Mypy | |
run: mypy . | |
- name: Lint with Ruff | |
run: ruff check | |
- name: Run tests | |
run: pytest --cov | |
- if: matrix.python-version == '3.13' | |
name: Upload to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Run Module | |
run: | | |
python3 -m evalica.gradio --version | |
python3 -m evalica --input=food.csv counting | |
- name: Run CLI | |
run: evalica --input=food.csv counting | |
- name: Lint Jupyter with Mypy | |
run: nbqa mypy *.ipynb | |
- name: Lint with abi3audit | |
run: python3 -c "import evalica;print(evalica.evalica.__file__)" | xargs abi3audit --assume-minimum-abi3=3.8 --verbose | |
- name: Run Jupyter | |
run: | | |
mkdir jupyter | |
jupyter nbconvert --to html --output jupyter/index.html --execute Tutorial.ipynb | |
cp Evalica.svg jupyter/ | |
- if: matrix.python-version == '3.13' && github.ref == 'refs/heads/master' | |
name: Upload Jupyter | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "./jupyter" | |
- name: Run MkDocs | |
run: | | |
python3 -c "import evalica;print(evalica.evalica.__file__)" | xargs rm -fv | |
mkdocs build --strict | |
- if: matrix.python-version == '3.13' | |
name: Make a release build | |
run: maturin develop --uv --release --extras dev,docs | |
- if: matrix.python-version == '3.13' | |
name: Run benchmarks | |
uses: CodSpeedHQ/action@v3 | |
with: | |
token: ${{ secrets.CODSPEED_TOKEN }} | |
run: pytest --codspeed | |
pages: | |
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
actions: read | |
id-token: write | |
pages: write | |
runs-on: ubuntu-latest | |
needs: python | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |