-
Notifications
You must be signed in to change notification settings - Fork 227
69 lines (63 loc) · 2.68 KB
/
unit_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 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@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
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