Merge pull request #51 from tiagocoutinho/gpio-request-config #288
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
name: Test suite | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
tests: | |
name: "Python ${{ matrix.python-version }}" | |
runs-on: "ubuntu-latest" | |
permissions: write-all | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install necessary packages | |
run: | | |
sudo apt-get install -y linux-image-$(uname -r) linux-modules-extra-$(uname -r) | |
- name: Setup user groups | |
run: | | |
echo KERNEL==\"uinput\", SUBSYSTEM==\"misc\" GROUP=\"docker\", MODE=\"0666\" | sudo tee /etc/udev/rules.d/99-$USER.rules | |
echo KERNEL==\"event[0-9]*\", SUBSYSTEM==\"input\" GROUP=\"docker\", MODE=\"0666\" | sudo tee -a /etc/udev/rules.d/99-$USER.rules | |
echo SUBSYSTEM==\"video4linux\" GROUP=\"docker\", MODE=\"0666\" | sudo tee -a /etc/udev/rules.d/99-$USER.rules | |
echo KERNEL==\"gpiochip[0-9]*\", SUBSYSTEM==\"gpio\", GROUP=\"docker\", MODE=\"0666\" | sudo tee -a /etc/udev/rules.d/99-$USER.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger | |
sudo modprobe -a uinput | |
sudo modprobe vivid n_devs=1 node_types=0xe1d3d vid_cap_nr=190 vid_out_nr=191 meta_cap_nr=192 meta_out_nr=193 | |
sudo modprobe gpio-sim | |
sudo modprobe gpio-aggregator | |
sudo python scripts/setup-gpio-sim.py | |
ls -lsa /dev/video* /dev/uinput /dev/gpio* /dev/inp* | |
- name: Set up Python ${{ matrix.python-version }} | |
id: setuppy | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Issue ref: https://github.com/actions/setup-python/issues/436 | |
# cache: 'pip' | |
# cache-dependency-path: pyproject.toml | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: ${{ env.pythonLocation }} | |
key: python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
pip install --disable-pip-version-check -e .[dev] | |
- name: Linting | |
run: | | |
ruff check --diff --output-format=github linuxpy tests examples | |
ruff format linuxpy tests examples --check | |
- name: Build package | |
run: | | |
python -m build | |
twine check dist/* | |
- name: Tests | |
id: tests | |
run: | | |
ward | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html_report-${{ matrix.python-version }} | |
path: ./htmlcov/ | |
- name: Code Coverage Summary Report | |
uses: irongut/[email protected] | |
with: | |
filename: coverage.xml | |
badge: true | |
format: 'markdown' | |
output: 'both' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
path: code-coverage-results.md | |
recreate: true | |
- name: Write to Job Summary | |
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY |