Update tests.yml

This commit is contained in:
Yonokid
2025-12-27 18:34:34 -05:00
parent 7afb1da1cd
commit 109719b7f5

View File

@@ -1,146 +1,127 @@
name: Tests name: Tests
on: on:
push: push:
branches: [ main, master, develop ] branches: [main, master, develop]
pull_request: pull_request:
branches: [ main, master, develop ] branches: [main, master, develop]
workflow_dispatch: workflow_dispatch:
permissions: permissions:
contents: read contents: read
jobs: jobs:
test: test:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-22.04, windows-latest, macos-latest] os: [ubuntu-22.04, windows-latest, macos-latest]
python-version: ['3.12'] python-version: ["3.12"]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Check-out repository - name: Check-out repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
submodules: recursive
- name: Install libaudio Dependencies (macOS) - name: Install libaudio Dependencies (macOS)
if: runner.os == 'macOS' if: runner.os == 'macOS'
run: | run: |
brew update brew update
brew install portaudio libsndfile speexdsp ccache brew install portaudio libsndfile speexdsp ccache
- name: Install libaudio Dependencies (Windows) - name: Install libaudio Dependencies (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
with: with:
update: true update: true
install: >- install: >-
base-devel base-devel
mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc
mingw-w64-x86_64-libsndfile mingw-w64-x86_64-libsndfile
mingw-w64-x86_64-speexdsp mingw-w64-x86_64-speexdsp
mingw-w64-x86_64-ccache mingw-w64-x86_64-ccache
- name: Install libaudio Dependencies (Linux) - name: Install libaudio Dependencies (Linux)
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
build-essential \ build-essential \
pkg-config \ pkg-config \
libsndfile1-dev \ libsndfile1-dev \
libspeexdsp-dev \ libspeexdsp-dev \
portaudio19-dev \ portaudio19-dev \
libpulse-dev \ libpulse-dev \
ccache ccache
- name: Build libaudio (Windows) - name: Build libaudio (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
shell: msys2 {0} shell: msys2 {0}
run: | run: |
cd libs/audio cd libs/audio
make clean make clean
make all make all
make verify make verify
- name: Build libaudio (Unix) - name: Build libaudio (Unix)
if: runner.os != 'Windows' if: runner.os != 'Windows'
shell: bash shell: bash
run: | run: |
cd libs/audio cd libs/audio
make clean make clean
make all make all
make verify make verify
- name: Copy libaudio to project root (Windows) - name: Copy libaudio to project root (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
shell: bash shell: bash
run: | run: |
cp libs/audio/*.dll . 2>/dev/null || echo "libaudio not found" cp libs/audio/*.dll . 2>/dev/null || echo "libaudio not found"
- name: Copy libaudio to project root (macOS) - name: Copy libaudio to project root (macOS)
if: runner.os == 'macOS' if: runner.os == 'macOS'
shell: bash shell: bash
run: | run: |
cp libs/audio/libaudio.dylib . 2>/dev/null || echo "libaudio not found" cp libs/audio/libaudio.dylib . 2>/dev/null || echo "libaudio not found"
- name: Copy libaudio to project root (Linux) - name: Copy libaudio to project root (Linux)
if: runner.os == 'Linux' if: runner.os == 'Linux'
shell: bash shell: bash
run: | run: |
cp libs/audio/libaudio.so . 2>/dev/null || echo "libaudio not found" cp libs/audio/libaudio.so . 2>/dev/null || echo "libaudio not found"
- name: Install uv - name: Install uv
uses: astral-sh/setup-uv@v4 uses: astral-sh/setup-uv@v4
- name: Setup Python ${{ matrix.python-version }} - name: Setup Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }} run: uv python install ${{ matrix.python-version }}
- name: Install dependencies - name: Install dependencies
run: uv sync run: uv sync
- name: Run tests - name: Run tests
run: uv run pytest test/libs/ -v --tb=short --color=yes run: uv run pytest -v --tb=short --color=yes
continue-on-error: false continue-on-error: false
- name: Run tests with coverage - name: Upload test artifacts
if: matrix.os == 'ubuntu-22.04' if: failure()
run: | uses: actions/upload-artifact@v4
uv run pytest test/libs/ --cov=libs --cov-report=xml --cov-report=html --cov-report=term with:
name: test-results-${{ matrix.os }}-py${{ matrix.python-version }}
path: |
*.log
temp/
if-no-files-found: ignore
retention-days: 7
- name: Upload coverage reports test-summary:
if: matrix.os == 'ubuntu-22.04' runs-on: ubuntu-latest
uses: codecov/codecov-action@v4 needs: test
with: if: always()
file: ./coverage.xml steps:
flags: unittests - name: Test Summary
name: codecov-umbrella run: |
fail_ci_if_error: false echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
env: echo "" >> $GITHUB_STEP_SUMMARY
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} echo "All platform tests completed!" >> $GITHUB_STEP_SUMMARY
continue-on-error: true
- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-py${{ matrix.python-version }}
path: |
*.log
temp/
if-no-files-found: ignore
retention-days: 7
test-summary:
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Test Summary
run: |
echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "All platform tests completed!" >> $GITHUB_STEP_SUMMARY