Add GitHub Actions for build test and releases

Adds a build test for ubuntu (latest, 20.04), archlinux, and fedora
and makes a tarball including submodules.
This commit is contained in:
pixl 2023-05-03 23:52:00 -04:00
parent a96036c97d
commit bb8e0b4a78
No known key found for this signature in database
GPG Key ID: 1866C148CD593B6E
6 changed files with 102 additions and 49 deletions

55
.github/workflows/build-test.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: Build test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
matrix:
container: [ 'ubuntu:latest', 'ubuntu:20.04', 'fedora:latest', 'archlinux:base-devel' ]
steps:
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.container, 'ubuntu')
env:
DEBIAN_FRONTEND: noninteractive
TZ: Etc/UTC
run: |
apt-get update -y -q
apt-get install -y -q \
build-essential cmake git pkg-config \
libevdev-dev libudev-dev libconfig++-dev libglib2.0-dev
- name: Install dependencies (Fedora)
if: startsWith(matrix.container, 'fedora')
run: |
dnf update -y
dnf install -y \
cmake git libevdev-devel \
systemd-devel libconfig-devel gcc-c++ glib2-devel
- name: Install dependencies (Arch Linux)
if: startsWith(matrix.container, 'archlinux')
run: |
pacman -Syu --noconfirm \
cmake git libevdev libconfig systemd-libs glib2
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build LogiOps
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-Werror"
cmake --build build -j$(nproc)

33
.github/workflows/make-release.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Publish release tarball
on:
push:
tags:
- 'v*.*'
jobs:
publish:
name: Publish release tarball
runs-on: ubuntu-latest
strategy:
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Add version info
run: echo ${{ github.ref_name }} > version.txt
- name: Remove git repo information
run: find . -name '.git' | xargs rm -rf
- name: Create tarball
run: |
tar cvfz /tmp/logiops.tar.gz .
mv /tmp/logiops.tar.gz logiops-${{ github.ref_name }}.tar.gz
- name: Upload release asset
uses: softprops/action-gh-release@v0.1.15
with:
files: logiops-${{ github.ref_name }}.tar.gz

View File

@ -1,37 +0,0 @@
name: release-ci
on:
push:
types:
- tags
workflow_dispatch:
jobs:
job:
name: ${{ matrix.os }}-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
include:
- os: ubuntu-latest
triplet: x64-linux
installDependencies: 'sudo apt-get update -m && sudo apt-get install libconfig++-dev libevdev-dev libudev-dev'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Install dependencies
run: '${{ matrix.installDependencies }}'
- name: Run CMake+Make
uses: lukka/run-cmake@v2
id: runcmake
with:
cmakeGenerator: 'UnixMakefiles'
cmakeListsOrSettingsJson: 'CMakeListsTxtBasic'
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
cmakeAdditionalArgs: '-DFORCE_BUILD_HIDPP=True'
buildWithCMakeArgs: '-- -v'
cmakeBuildType: 'Release'
buildDirectory: '${{ runner.workspace }}/build/'

View File

@ -13,10 +13,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(USE_USER_BUS "Uses user bus" OFF)
find_package(Git REQUIRED)
find_package(Git)
# Set version number and update submodules
if(EXISTS ${CMAKE_SOURCE_DIR}/.git)
if(EXISTS ${CMAKE_SOURCE_DIR}/.git AND GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags
OUTPUT_VARIABLE LOGIOPS_VERSION
RESULT_VARIABLE LOGIOPS_VERSION_RET
@ -36,9 +36,10 @@ elseif(EXISTS ${CMAKE_SOURCE_DIR}/version.txt)
file(READ version.txt LOGIOPS_VERSION)
string(REGEX REPLACE "\n$" "" LOGIOPS_VERSION ${LOGIOPS_VERSION})
IF(NOT EXISTS src/ipcgull)
message(FATAL_ERROR "Missing ipcgull submodule")
endif()
endif()
IF(NOT EXISTS src/ipcgull)
message(FATAL_ERROR "Missing ipcgull submodule")
endif()
if(NOT LOGIOPS_VERSION)

View File

@ -1,4 +1,6 @@
# logiops
# LogiOps
![Build Status](https://github.com/PixlOne/logiops/actions/workflows/main.yml/badge.svg)
This is an unofficial driver for Logitech mice and keyboard.
@ -16,17 +18,17 @@ Default location for the configuration file is /etc/logid.cfg, but another can b
This project requires a C++20 compiler, `cmake`, `libevdev`, `libudev`, `glib`, and `libconfig`.
For popular distributions, I've included commands below.
**Arch Linux:** `sudo pacman -S base-devel cmake g++ libevdev libconfig pkgconf glib2`
**Arch Linux:** `sudo pacman -S base-devel cmake libevdev libconfig systemd-libs glib2`
**Debian/Ubuntu:** `sudo apt install git cmake g++ libevdev-dev libudev-dev libconfig++-dev libglib2.0-dev`
**Debian/Ubuntu:** `sudo apt install build-essential cmake pkg-config libevdev-dev libudev-dev libconfig++-dev libglib2.0-dev`
**Fedora:** `sudo dnf install cmake libevdev-devel systemd-devel libconfig-devel gcc-c++ glib2`
**Fedora:** `sudo dnf install cmake libevdev-devel systemd-devel libconfig-devel gcc-c++ glib2-devel`
**Gentoo Linux:** `sudo emerge dev-libs/libconfig dev-libs/libevdev dev-libs/glib dev-util/cmake virtual/libudev`
**Solus:** `sudo eopkg install cmake libevdev-devel libconfig-devel libgudev-devel glib2`
**Solus:** `sudo eopkg install cmake libevdev-devel libconfig-devel libgudev-devel glib2-devel`
**openSUSE:** `sudo zypper install cmake libevdev-devel systemd-devel libconfig-devel gcc-c++ libconfig++-devel libudev-devel glib2`
**openSUSE:** `sudo zypper install cmake libevdev-devel systemd-devel libconfig-devel gcc-c++ libconfig++-devel libudev-devel glib2-devel`
## Building

View File

@ -1 +0,0 @@
v0.3.0