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

Fix deprecated GitHub actions #2305

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
6 changes: 3 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4.3.0
- name: Set up Python
uses: actions/setup-python@v5

- name: Run pre-commit
uses: pre-commit/action@v3.0.0
30 changes: 14 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,58 @@ name: tests
on: [push, pull_request]

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

strategy:
matrix:
python-version: [3.7, 3.12]

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- 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
make test

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

strategy:
matrix:
python-version: [3.7, 3.12]

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- 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
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/
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _data_files():
'report-descriptor': ['hid-parser'],
'desktop-notifications': ['Notify (>= 0.7)'],
'git-commit': ['python-git-info'],
'test': ['pytest'],
'test': ['pytest', 'pytest-cov'],
},
package_dir={'': 'lib'},
packages=['keysyms', 'hidapi', 'logitech_receiver', 'solaar', 'solaar.ui', 'solaar.cli'],
Expand Down
Loading