Merge branch 'master' of https://github.com/lhotse-speech/lhotse #2798
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: unit_tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
unit_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- python-version: "3.8" | |
torch-install-cmd: "pip install torch==1.12.1 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cpu" | |
extra_deps: kaldifeat | |
- python-version: "3.9" | |
torch-install-cmd: "pip install torch==2.3 torchaudio==2.3 --extra-index-url https://download.pytorch.org/whl/cpu" | |
extra_deps: "" | |
- python-version: "3.10" # note: no torchaudio | |
torch-install-cmd: "pip install torch==2.3 --extra-index-url https://download.pytorch.org/whl/cpu" | |
extra_deps: "" | |
- python-version: "3.11" # note: no torchaudio | |
torch-install-cmd: "pip install torch==2.3 --extra-index-url https://download.pytorch.org/whl/cpu" | |
extra_deps: "" | |
- python-version: "3.12" # note: no torchaudio | |
torch-install-cmd: "pip install torch==2.3 --extra-index-url https://download.pytorch.org/whl/cpu" | |
extra_deps: "" | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: | | |
docs/requirements.txt | |
setup.py | |
- name: Install apt dependencies | |
run: | | |
sudo apt update | |
sudo apt install libsndfile1-dev libsndfile1 ffmpeg sox | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install wheel numpy | |
# Force the installation of a CPU-only PyTorch | |
${{ matrix.torch-install-cmd }} | |
# the torchaudio env var does nothing when torchaudio is installed, but doesn't require it's presence when it's not | |
pip install lilcom '.[tests]' | |
# Enable some optional tests | |
pip install h5py dill smart_open[http] kaldi_native_io webdataset==0.2.5 s3prl scipy nara_wpe pyloudnorm ${{ matrix.extra_deps }} | |
- name: Install sph2pipe | |
run: | | |
lhotse install-sph2pipe # Handle sphere files. | |
- name: Test with pytest and coverage | |
run: | | |
export TORCHAUDIO_USE_BACKEND_DISPATCHER=1 | |
pytest --cov --forked -n auto test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 |