Skip to content

Commit

Permalink
ci: add test GitHub Actions for test (mli#42)
Browse files Browse the repository at this point in the history
* ci: add pytest ci

* fix: drop typo i

* fix: branch name

* fix: do not support 3.11 for now

* fix: test name

* fix: ci install ffmpeg

* fix: name change to main
  • Loading branch information
yihong0618 authored Nov 17, 2022
1 parent f13da32 commit e77c585
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test

on:
pull_request:
push:
branches:
- main

jobs:
lint_and_test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}
- name: Install ffmpeg
run: |
sudo apt-get install ffmpeg
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest
- name: Run Test
run: pytest test/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ dmypy.json

# Pyre type checker
.pyre/
log/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,5 @@ autocut
1. commit 信息用英文描述清楚你做了哪些修改即可,小写字母开头。
2. 最好可以保证一次的 commit 涉及的修改比较小,可以简短地描述清楚,这样也方便之后有修改时的查找。
3. PR 的时候 title 简述有哪些修改, contents 可以具体写下修改内容。
4. run test `pip install pytest` then `pytest test`

2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
'srt',
'moviepy',
'opencc-python-reimplemented',
'torchaudio',
'parameterized',
'whisper @ git+https://github.com/openai/whisper.git'
]

Expand Down
2 changes: 1 addition & 1 deletion test/test_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from parameterized import parameterized, param

from autocut.cut import Cutter
from test.config import TestArgs, TEST_VIDEO_PATH, TEST_VIDEO_FILE_SIMPLE, TEST_CONTENT_PATH
from config import TestArgs, TEST_VIDEO_PATH, TEST_VIDEO_FILE_SIMPLE, TEST_CONTENT_PATH


class TestCut(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/test_transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from parameterized import parameterized, param

from autocut.utils import MD
from test.config import TEST_VIDEO_FILE, TestArgs, TEST_VIDEO_FILE_SIMPLE, TEST_VIDEO_FILE_LANG, TEST_VIDEO_PATH
from config import TEST_VIDEO_FILE, TestArgs, TEST_VIDEO_FILE_SIMPLE, TEST_VIDEO_FILE_LANG, TEST_VIDEO_PATH
from autocut.transcribe import Transcribe


Expand Down

0 comments on commit e77c585

Please sign in to comment.