Skip to content

Commit

Permalink
Setting up Ci with pre-commit (#70)
Browse files Browse the repository at this point in the history
* initial ci

* ci: install libportaudio-dev

* ci: tab to space

* ci: drop twine

* ci: add sudo for installing portaudio

* ci: linking pytest and installing pyaudio

* ci: setup portaudio

* ci: fix test case and install pulse

* ci: setup test with pytest

* ci: quiet pip install for pytest

* initial precommit settings

* ci: adding more entries to precommit

* renaming the job

* ci: moving pytest & pre-commit to requirements_training

* renaming stitcher test

* gitignore for test_data
  • Loading branch information
ljj7975 authored Apr 7, 2021
1 parent 4a85d33 commit 333497c
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 14 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
name: Python Package

on:
release:
types: [created]
on: [push]

jobs:
deploy:
test:

runs-on: ubuntu-latest

Expand All @@ -17,15 +15,22 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.7.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
pip install setuptools wheel
sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 libpulse-dev
pip install -r requirements.txt
pip install -r requirements_training.txt
- name: Lint with flake8
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Test with pytest
run: |
pip install --quiet --editable .
pytest --verbose
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
exclude: |
(?x)(
^data/ |
^howl-models
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: check-yaml
- id: requirements-txt-fixer
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-json
- id: name-tests-test
- repo: https://github.com/timothycrosley/isort
rev: 5.2.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
args: [--line-length=120]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.6.0
hooks:
- id: pylint
files: src
2 changes: 2 additions & 0 deletions requirements_training.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
openpyxl
praat-textgrids==1.3.1
webrtcvad==2.0.10
pytest
pre-commit
1 change: 1 addition & 0 deletions test/data/dataset.py → test/data/dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

class TestDataset(AudioDataset[AudioClipMetadata]):
"""Sample dataset for testing"""
__test__ = False

def __init__(self,
**kwargs):
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/model/inference.py → test/model/inference_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest

from howl.data.tokenize import Vocab
from howl.model.inference import WordTranscriptSearcher
from howl.data.searcher import WordTranscriptSearcher
from howl.settings import SETTINGS


Expand Down
1 change: 1 addition & 0 deletions test/test_data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stitched_dataset

0 comments on commit 333497c

Please sign in to comment.