-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tox check with CI on Windows, macOS and Ubuntu (#164)
- Loading branch information
Showing
2 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Python package | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ["3.8", "3.12"] | ||
system-hidapi: ["", "--with-system-hidapi"] | ||
libusb-backend: ["", "--with-libusb"] | ||
exclude: | ||
# TODO: it is non-trivial to install pkg-config and HIDAPI, | ||
# and configure it run work in runtime | ||
- platform: windows-latest | ||
system-hidapi: "--with-system-hidapi" | ||
# libusb backend is not present on Windows/macOS | ||
- platform: macos-latest | ||
libusb-backend: "--with-libusb" | ||
- platform: windows-latest | ||
libusb-backend: "--with-libusb" | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Install Ubuntu dependencies | ||
if: matrix.platform == 'ubuntu-latest' | ||
run: sudo apt install libudev-dev libusb-1.0-0-dev | ||
|
||
- name: Install Ubuntu HIDAPI | ||
if: ${{ (matrix.platform == 'ubuntu-latest') && (matrix.system-hidapi == '--with-system-hidapi') }} | ||
# the default apt version of libhidapi-dev is too old, need to build the one we know would work | ||
run: | | ||
sudo apt install cmake | ||
mkdir hidapi_build && cd hidapi_build | ||
cmake -B . -S ../hidapi -DCMAKE_INSTALL_PREFIX=/usr | ||
make | ||
sudo make install | ||
- name: Install macOS HIDAPI | ||
if: ${{ (matrix.platform == 'macos-latest') && (matrix.system-hidapi == '--with-system-hidapi') }} | ||
run: brew install hidapi | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install setuptools tox tox-gh-actions | ||
pip install -r requirements.txt --upgrade | ||
- name: Test with tox | ||
env: | ||
HIDAPI_SYSTEM_HIDAPI: ${{ matrix.system-hidapi == '--with-system-hidapi' && '1' || '0' }} | ||
HIDAPI_WITH_LIBUSB: ${{ matrix.libusb-backend == '--with-libusb' && '1' || '0' }} | ||
run: | | ||
pip install . | ||
tox |
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