1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
name: tests
on: [push, pull_request]
jobs:
build:
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.14', '3.13', '3.12', '3.11', '3.10']
exclude:
# windows runners are slow, exclude intermediate python releases
- os: windows-latest
python-version: '3.13'
- os: windows-latest
python-version: '3.12'
- os: windows-latest
python-version: '3.11'
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
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
|