-
Notifications
You must be signed in to change notification settings - Fork 111
120 lines (100 loc) · 3.53 KB
/
run-python-test.yaml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Run Python tests
on:
push:
branches:
- master
paths:
- '.github/workflows/run-python-test.yaml'
- '.github/scripts/run-python-test.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa/csrc/**'
- 'sherpa/cpp_api/**'
- 'sherpa/python/**'
pull_request:
types: [labeled]
paths:
- '.github/workflows/run-python-test.yaml'
- '.github/scripts/run-python-test.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa/csrc/**'
- 'sherpa/cpp_api/**'
- 'sherpa/python/**'
workflow_dispatch:
concurrency:
group: run_python_tests-${{ github.ref }}
cancel-in-progress: true
jobs:
run_python_tests:
if: github.event.label.name == 'ready' || github.event.label.name == 'python' || github.event_name == 'push'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
torch: ["1.13.1"]
torchaudio: ["0.13.1"]
python-version: ["3.10"]
build_type: ["Release"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.torch }}-${{ matrix.python-version }}-${{ matrix.build_type }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display gcc version
run: |
gcc --version
- name: Install PyTorch ${{ matrix.torch }}
shell: bash
run: |
sudo apt-get -qq install git-lfs tree sox
sox --version
sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
python3 -m pip install --upgrade pip kaldi_native_io sentencepiece>=0.1.96
python3 -m pip install wheel twine typing_extensions pytest
python3 -m pip install torch==${{ matrix.torch }} torchaudio==${{ matrix.torchaudio }} numpy -f https://download.pytorch.org/whl/cpu/torch_stable.html
python3 -m pip install k2==1.24.4.dev20240223+cpu.torch${{ matrix.torch }} -f https://k2-fsa.github.io/k2/cpu.html
python3 -m torch.utils.collect_env
- name: Cache kaldifeat
id: my-cache-2
uses: actions/cache@v2
with:
path: |
~/tmp/kaldifeat
key: cache-tmp-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.torch }}-kaldifeat-v1.22
- name: Install kaldifeat
if: steps.my-cache-2.outputs.cache-hit != 'true'
shell: bash
run: |
.github/scripts/install-kaldifeat.sh
- name: Build sherpa
shell: bash
env:
BUILD_TYPE: ${{ matrix.build_type }}
run: |
export KALDIFEAT_INSTALL_PREFIX=$HOME/tmp/kaldifeat/build
echo $KALDIFEAT_INSTALL_PREFIX
ls -lh $KALDIFEAT_INSTALL_PREFIX
echo "Build type: $BUILD_TYPE"
export SHERPA_CMAKE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSHERPA_ENABLE_TESTS=ON"
python3 setup.py bdist_wheel
ls -lh dist
pip install ./dist/*.whl
- name: Display sherpa version
shell: bash
run: |
sherpa-version
- name: Run Python tests
shell: bash
run: |
export PYTHONPATH=$HOME/tmp/kaldifeat/kaldifeat/python:$PYTHONPATH
export PYTHONPATH=$HOME/tmp/kaldifeat/build/lib:$PYTHONPATH
.github/scripts/run-python-test.sh