-
Notifications
You must be signed in to change notification settings - Fork 1.1k
50 lines (47 loc) · 1.42 KB
/
unit_test.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
name: UnitTest
on:
pull_request:
paths:
- '**.py'
jobs:
unit-test:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 20
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- name: Cache Python Packages
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') }}
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Fetch Wenet
uses: actions/checkout@v1
- name: Checkout PR tip
run: |
set -eux
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# We are on a PR, so actions/checkout leaves us on a merge commit.
# Check out the actual tip of the branch.
git checkout ${{ github.event.pull_request.head.sha }}
fi
echo ::set-output name=commit_sha::$(git rev-parse HEAD)
id: get_pr_tip
- name: Install Wenet Dependencies
run: |
set -eux
pip install -r requirements.txt
sudo apt update && sudo apt install -y ffmpeg
- name: Run Pytest
run: |
set -eux
pytest --version
PYTHONPATH="${PYTHONPATH:-}:$(pwd)" pytest -q
if [ $? != 0 ]; then exit 1; fi