xiaozhi-esp32-server/.github/workflows/unit_test.yml
2025-03-02 15:42:49 +09:00

53 lines
1.4 KiB
YAML

name: Run Tests
on:
pull_request:
branches:
- "*"
types:
- opened
- reopened
- synchronize
push:
branches:
- main
jobs:
test:
name: Run Pytest on Ubuntu and macOS
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu
python -m pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install ffmpeg and libopus
run: |
if [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
sudo apt-get update
sudo apt-get install -y --no-install-recommends libopus0 ffmpeg
fi
if [ ${{ matrix.os }} == 'macos-latest' ]; then
brew install ffmpeg opus
fi
- name: Run tests with pytest
run: |
pytest --maxfail=5 --disable-warnings --tb=short