Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend makefile #2304

Merged
merged 4 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: tests
on: [push, pull_request]

jobs:
build:
ubuntu-tests:
runs-on: ubuntu-latest

strategy:
Expand All @@ -20,19 +20,17 @@ jobs:

- name: Install Ubuntu dependencies
run: |
sudo apt update
sudo apt install libdbus-1-dev libglib2.0-dev
make install_apt

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e ."[test]"
make install_pip PIP_ARGS='.["test"]'

- name: Run tests on Ubuntu
run: |
pytest --cov=lib/ tests/
make test

macos-build:
macos-tests:
runs-on: macos-latest

strategy:
Expand All @@ -50,13 +48,12 @@ jobs:

- name: Set up macOS dependencies
run: |
brew install hidapi gtk+3 pygobject3
make install_brew

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install ."[test]"
make install_pip PIP_ARGS='.["test"]'

- name: Run tests on macOS
run: |
pytest --cov=lib/ tests/
make test
38 changes: 35 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,51 @@ UDEV_RULES_SOURCE := rules.d/$(UDEV_RULE_FILE)
UDEV_RULES_SOURCE_UINPUT := rules.d-uinput/$(UDEV_RULE_FILE)
UDEV_RULES_DEST := /etc/udev/rules.d/

.PHONY: install_udev install_udev_uinput uninstall_udev
PIP_ARGS ?= .

.PHONY: install_ubuntu install_macos
.PHONY: install_apt install_brew install_pip
.PHONY: install_udev install_udev_uinput reload_udev uninstall_udev
.PHONY: test

install_ubuntu: install_apt install_udev_uinput install_pip

install_macos: install_brew install_pip

install_apt:
@echo "Installing Solaar dependencies via apt"
sudo apt update
sudo apt install libdbus-1-dev libglib2.0-dev

install_brew:
@echo "Installing Solaar dependencies via brew"
brew update
brew install hidapi gtk+3 pygobject3

install_pip:
@echo "Installing Solaar dependencies via pip"
python -m pip install --upgrade pip
pip install $(PIP_ARGS)

install_udev:
@echo "Copying Solaar udev rule to $(UDEV_RULES_DEST)"
sudo cp $(UDEV_RULES_SOURCE) $(UDEV_RULES_DEST)
sudo udevadm control --reload-rules
make reload_udev

install_udev_uinput:
@echo "Copying Solaar udev rule (uinput) to $(UDEV_RULES_DEST)"
sudo cp $(UDEV_RULES_SOURCE_UINPUT) $(UDEV_RULES_DEST)
make reload_udev

reload_udev:
@echo "Reloading udev rules"
sudo udevadm control --reload-rules

uninstall_udev:
@echo "Removing Solaar udev rules from $(UDEV_RULES_DEST)"
sudo rm -f $(UDEV_RULES_DEST)/$(UDEV_RULE_FILE)
sudo udevadm control --reload-rules
make reload_udev

test:
@echo "Running Solaar tests"
pytest --cov=lib/ tests/
Loading