Skip to content

Kraken230 firmware 2 image support #2015

Kraken230 firmware 2 image support

Kraken230 firmware 2 image support #2015

name: tests
on: [push, pull_request]
jobs:
build:
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 10
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.12', '3.11', '3.10', '3.9', '3.8']
exclude:
# mac os: exclude all but the last two python releases
- os: macos-latest
python-version: '3.10'
- os: macos-latest
python-version: '3.9'
- os: macos-latest
python-version: '3.8'
# windows: exclude all but the last two python releases
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.9'
- os: windows-latest
python-version: '3.8'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libudev-dev
- name: Install system dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install libusb
- name: Install Python tools
run: |
python -m pip install --upgrade pip
- name: Set up a test environment with pytest and the runtime dependencies
run: |
python -m venv vtest
export PATH=$PWD/vtest/bin/:$PWD/vtest/Scripts/:$PATH
python -m pip install --upgrade pip setuptools setuptools_scm wheel
# todo: remove git pysub once pyusb/pyusb#511 reaches a release
python -m pip install \
colorlog \
crcmod==1.7 \
docopt \
hidapi \
pillow \
pytest \
git+https://github.com/pyusb/pyusb \
"libusb-package; sys_platform == 'win32' or sys_platform == 'cygwin'" \
"smbus; sys_platform == 'linux'" \
"winusbcdc>=1.5; sys_platform == 'win32'"
- name: Run unit tests and module doctests
run: |
export PATH=$PWD/vtest/bin/:$PWD/vtest/Scripts/:$PATH
XDG_RUNTIME_DIR=.tests_rundir python -m pytest
- name: Set up a environment to install into, and install the package from sources
run: |
python -m venv vinstall
export PATH=$PWD/vinstall/bin/:$PWD/vinstall/Scripts/:$PATH
python -m pip install --upgrade pip setuptools setuptools_scm wheel
# todo: remove git pysub once pyusb/pyusb#511 reaches a release
python -m pip install git+https://github.com/pyusb/pyusb
python -m pip install .
- name: Test that the installed executable is able to probe for devices
run: |
export PATH=$PWD/vinstall/bin/:$PWD/vinstall/Scripts/:$PATH
liquidctl list --verbose --debug
- name: Lint with flake8
run: |
python -m pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --extend-exclude vtest,vinstall --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --extend-exclude vtest,vinstall --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics