Skip to content

Commit

Permalink
Add GitHub Actions for build test and releases
Browse files Browse the repository at this point in the history
Adds a build test for ubuntu (latest, 20.04), archlinux, and fedora
and makes a tarball including submodules.
  • Loading branch information
PixlOne committed May 4, 2023
1 parent a96036c commit bb8e0b4
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 49 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 33 additions & 0 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
files: logiops-${{ github.ref_name }}.tar.gz
37 changes: 0 additions & 37 deletions .github/workflows/release.yml

This file was deleted.

11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion version.txt

This file was deleted.

0 comments on commit bb8e0b4

Please sign in to comment.