Skip to content

Use cheaper OpenAI models for unit testing #16

Use cheaper OpenAI models for unit testing

Use cheaper OpenAI models for unit testing #16

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python vcon unit test
on:
push:
#branches: [ $default-branch ]
pull_request:
# all PRs for now
#branches: [ $default-branch ]
jobs:
vcon-utest-python-version:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: checkout ${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} os ${{ runner.os }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# This does not seem to actually load the pip dev packages. However
# leaving this in so that it does not pull in **/requirements.txt
cache-dependency-path: vcon/docker_dev/pip_dev_package_list.txt
- name: Install dependencies
run: |
pwd
ls -l vcon/docker_dev
# Pull out comments and python3 specific packages as the platform already has that
sudo apt-get update
apt-cache madison ffmpeg
apt-cache depends ffmpeg
apt-cache depends ffmpeg=7:4.4.1-3ubuntu5
apt-cache depends ffmpeg=7:4.4.2-0ubuntu0.22.04.1
apt-cache depends ffmpeg=7:4.4.2-0ubuntu0.22.04.1
apt-cache madison intel-media-va-driver
apt-cache depends intel-media-va-driver
echo "Installing apt packages: " $(grep -vE "^\s*#" vcon/docker_dev/apt_package_list.txt | grep -v python3 | tr "\n" " ")
sudo apt-get install -y --fix-missing $(grep -vE "^\s*#" vcon/docker_dev/apt_package_list.txt | grep -v python3 | tr "\n" " ")
python -m pip install --upgrade pip
pip install -r vcon/docker_dev/pip_dev_package_list.txt
pip install -r vcon/docker_dev/pip_package_list.txt
#pip install -r vcon/docker_dev/pip_server_requirements.txt
pip freeze | grep stable
pip freeze | grep whisper
pip freeze | grep pydantic
python3 -c "import stable_whisper;print(stable_whisper.__version__)"
- name: Lint catastrophic errors with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
# TODO: need to get to the point where we can run this without exit-zero
flake8 . --count --exit-zero --select=E9,F63,F7,F82 --show-source --statistics
- name: Lint stylistic errors with flake8
run: |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --ignore=E111,E114,E121,E123,E126,E128,E251,E261,E265,E275 --max-complexity=10 --max-line-length=127 --statistics
- name: Test CLI with pytest
# Environment variables
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
DEEPGRAM_KEY: ${{ secrets.DEEPGRAM_KEY }}
run: |
# This test gets run by itself as it catches print/stdout that may only
# occur upon the initial inport that can cause the CLI to fail due to
# spurious output which can cause the JSON output to contain junk.
pytest -v -rP tests/test_vcon_cli.py
- name: Test Vcon core package with pytest
# Environment variables
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
DEEPGRAM_KEY: ${{ secrets.DEEPGRAM_KEY }}
run: |
# Run all Vcon package unit tests
pytest -v -rP tests