Skip to content

Log Persistence

Log Persistence #2359

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on: pull_request
jobs:
python-tests:
name: Run python linting and tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2 # For codecov coverage history
- name: Make fake dist folder
run: |
mkdir web/dist
touch web/dist/index.html
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
# We go from quickest tests to most time consuming for quick turnaround/lower costs
- name: Lint with pycodestyle
run: |
pip install pycodestyle
# E126: ignore bug due to indent-size=2: https://github.com/hhatto/autopep8/issues/588
# E501: line too long
# E722: do not use bare except, specify exception instead
# E121: continuation line under-indented for hanging indent, see E126
pycodestyle --ignore=E126,E501,E722,E121 --indent-size=2 amplipi/ scripts/ hw/ docs/ streams/
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgirepository1.0-dev libcairo2-dev libdbus-1-dev # required for dbus
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with pylint
run: |
pip install pylint
pylint --exit-zero amplipi --generated-members "signal.Signals,GPIO.*"
pylint -E amplipi --generated-members "signal.Signals,GPIO.*"
pylint -E streams
- name: Lint with mypy, static type checker
run: |
pip install mypy
mypy amplipi/ --ignore-missing-imports
- name: Test mock using pytest # rpi cannot be tested directly due to hardware...
run: |
pip install pytest pytest-cov
pytest tests/test_ctrl.py -vvv -k no_config
pytest tests/test_ctrl.py -vvv -k good_config
pytest tests/test_ctrl.py -vvv -k corrupted_config
pytest tests/test_ctrl.py -vvv -k doubly_corrupted_config
pytest tests/test_ctrl.py -vvv -k missing_config
pytest tests/test_ctrl.py -vvv -k doubly_missing_config
pytest tests/test_rest.py -vvv -k 'not _live' --cov=./ --cov-report=xml
pytest tests/test_auth.py -vvv
pytest tests/test_zeroconf.py -vvv
pytest tests/test_utils.py -vvv
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false