diff --git a/.github/workflows/ml-test.yml b/.github/workflows/ml-test.yml new file mode 100644 index 0000000..626126b --- /dev/null +++ b/.github/workflows/ml-test.yml @@ -0,0 +1,43 @@ +name: ML Tests + +run-name: ${{ github.actor }} is automating using Github Actions + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.11"] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y portaudio19-dev + sudo apt-get install -y ffmpeg + python -m pip install --upgrade pip + python -m pip install pipenv + pipenv shell --fancy --python $(which python) + pipenv install -r requirements.txt + + working-directory: machine-learning-client + + - name: Run tests + run: | + pipenv run pytest --cov=machine_learning_client.py ml_tests.py + working-directory: machine-learning-client/tests \ No newline at end of file diff --git a/Pipfile b/Pipfile index 81a2880..3089624 100644 --- a/Pipfile +++ b/Pipfile @@ -21,6 +21,7 @@ flask-cors = "*" requests = "*" coverage = "*" pytest-flask = "*" +pytest-cov = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index 009c166..c351d64 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "593b3180607e66e02aa534290e3c60ed5ebb12bdea0a20482914dc53122b05d2" + "sha256": "9965c4d8f357b21858c378618e12d8215581b0735e07076d5acdeae00d641374" }, "pipfile-spec": 6, "requires": { @@ -555,6 +555,15 @@ "markers": "python_version >= '3.7'", "version": "==7.4.3" }, + "pytest-cov": { + "hashes": [ + "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6", + "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a" + ], + "index": "pypi", + "markers": "python_version >= '3.7'", + "version": "==4.1.0" + }, "pytest-flask": { "hashes": [ "sha256:58be1c97b21ba3c4d47e0a7691eb41007748506c36bf51004f78df10691fa95e", diff --git a/machine-learning-client/__init__.py b/machine-learning-client/__init__.py new file mode 100644 index 0000000..e69de29