Update scripts/tests and Github workflows #1326
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
- 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 | |
pip install pylint mypy pytest pytest-cov | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Lint with pylint | |
run: | | |
pylint --exit-zero amplipi --generated-members "signal.Signals,GPIO.*" | |
pylint -E amplipi --generated-members "signal.Signals,GPIO.*" | |
- name: Lint with mypy, static type checker | |
run: | | |
mypy amplipi/ --ignore-missing-imports | |
- name: Test mock using pytest # rpi cannot be tested directly due to hardware... | |
run: | | |
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 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
files: ./coverage.xml | |
directory: ./coverage/reports/ | |
flags: unittests | |
env_vars: OS,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
path_to_write_report: ./coverage/codecov_report.txt |