Skip to content

Run black on code

Run black on code #243

name: Build, Lint, and Test
on:
push:
branches:
- '*'
pull_request:
branches: [ master ]
jobs:
build:
name: Build, Lint, and Test
runs-on: ${{matrix.os}}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 mypy pytest
pip install -r requirements.txt
- name: Install bluetooth ctl linux
if: runner.os == 'Linux'
run: |
if [ "$RUNNER_OS" == "Linux" ] ; then
# Circumvent bleak's check for bluetoothctl version
# It's not needed for non-hardware tests
pwd >> $GITHUB_PATH
printf "#include <stdio.h>\nint main(void)\n{\n\tprintf(\"bluetoothctl: 5.55\\\n\");\n\treturn 0;\n}\n" | gcc -x c -o ./bluetoothctl -
./bluetoothctl
fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --show-source --statistics --max-line-length 88
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --statistic --max-line-length 88
- name: Check mypy
# Hold off on windows. Mypy is not being consistant there
if: runner.os != 'Windows'
run: |
mypy bless
- name: Test with pytest
run: |
python -m pytest