diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index eef992c5..eff90973 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -11,21 +11,15 @@ on: jobs: build: strategy: - fail-fast: true + fail-fast: false matrix: - include: - - os: ubuntu-latest - python-version: "3.9" - - os: ubuntu-latest - python-version: "3.10" - - os: ubuntu-latest - python-version: "3.11" - - os: ubuntu-latest - python-version: "3.12" - - os: ubuntu-latest - python-version: "3.13" - - os: windows-latest - python-version: "3.11" + os: [ubuntu-latest] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + include: + - os: macos-latest + python-version: "3.13" + - os: windows-latest + python-version: "3.11" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -33,27 +27,34 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install build dependencies - if: matrix.os == 'ubuntu-latest' + - run: python -m pip install --upgrade pip + - name: Install build dependencies (Linux) + if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install --no-install-recommends -y libpulse-dev libasound2-dev - sudo apt-get install --no-install-recommends -y portaudio19-dev + sudo apt-get install --no-install-recommends -y libpulse-dev libasound2-dev portaudio19-dev - name: Install ffmpeg (for Whisper) + if: runner.os != 'macOS' uses: FedericoCarboni/setup-ffmpeg@v3 - name: Install Python dependencies (Ubuntu, <=3.12) - if: matrix.os == 'ubuntu-latest' && matrix.python-version != '3.13' + if: runner.os == 'Linux' && matrix.python-version != '3.13' run: | python -m pip install .[dev,audio,pocketsphinx,whisper-local,whisper-api] - name: Install Python dependencies (Ubuntu, 3.13) - if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' + if: runner.os == 'Linux' && matrix.python-version == '3.13' run: | python -m pip install standard-aifc setuptools python -m pip install --no-build-isolation .[dev,audio,pocketsphinx,whisper-api] + - name: Install Python dependencies (macOS, 3.13) + if: runner.os == 'macOS' + run: | + brew install portaudio + python -m pip install pocketsphinx standard-aifc setuptools + python -m pip install --no-build-isolation .[dev,audio,whisper-api] - name: Install Python dependencies (Windows) - if: matrix.os == 'windows-latest' + if: runner.os == 'Windows' run: | python -m pip install .[dev,whisper-local,whisper-api] - name: Test with unittest run: | - pytest --doctest-modules -v speech_recognition/recognizers/ tests/ + pytest --doctest-modules --strict -v -W="ignore: aifc" speech_recognition/recognizers/ tests/ diff --git a/tests/test_special_features.py b/tests/test_special_features.py index 9dd2574e..37dac290 100644 --- a/tests/test_special_features.py +++ b/tests/test_special_features.py @@ -13,7 +13,7 @@ def setUp(self): self.AUDIO_FILE_EN = os.path.join(os.path.dirname(os.path.realpath(__file__)), "english.wav") self.addTypeEqualityFunc(str, self.assertSameWords) - @unittest.skipIf(sys.platform.startswith("win"), "skip on Windows") + @unittest.skipIf(sys.platform.startswith(("darwin", "win")), "skip on macOS and Windows") def test_sphinx_keywords(self): r = sr.Recognizer() with sr.AudioFile(self.AUDIO_FILE_EN) as source: audio = r.record(source)