mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
79 lines
2.1 KiB
YAML
79 lines
2.1 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]
|
|
python-version: ["3.10", "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: PyTest
|
|
run: |
|
|
pytest
|
|
|
|
# output the version of python and pip
|
|
# - name: PyTest
|
|
# run: |
|
|
# pytest --junit-xml=results/pytest.xml
|
|
# continue-on-error: true
|
|
|
|
# # Show the test results in the Actions tab
|
|
# - name: Upload Unit Test Results
|
|
# if: ${{ always() }}
|
|
# uses: actions/upload-artifact@v4
|
|
# with:
|
|
# name: Unit Test Results ${{ matrix.os }}
|
|
# path: results/*.xml
|
|
|
|
# - name: Download Artifacts
|
|
# if: success() || failure()
|
|
# uses: actions/download-artifact@v4
|
|
# with:
|
|
# path: artifacts
|
|
|
|
# - name: Publish Unit Test Results
|
|
# uses: EnricoMi/publish-unit-test-result-action@v2
|
|
# with:
|
|
# junit_files: artifacts/**/*.xml
|
|
|