Skip to content

Commit

Permalink
Merge branch 'JosuGZ:main' into dev-nix
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbelindholm authored Nov 1, 2024
2 parents 66a36b0 + 11826b8 commit b0b87c6
Show file tree
Hide file tree
Showing 23 changed files with 386 additions and 165 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: "Build and Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libdbus-1-dev libusb-dev libhidapi-dev libhidapi-hidraw0 pkg-config libudev-dev libgtk-3-dev
version: 1.0
- name: "Install Rust"
uses: dtolnay/rust-toolchain@stable
- name: "Cache cargo"
uses: Swatinem/rust-cache@v2
- name: Build
working-directory: ./razer_control_gui
run: cargo build --verbose
- name: Run tests
working-directory: ./razer_control_gui
run: cargo test --verbose

install:
# This assumes that the worker will be using systemctl
name: "Install on Github Worker"
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libdbus-1-dev libusb-dev libhidapi-dev libhidapi-hidraw0 pkg-config libudev-dev libgtk-3-dev
version: 1.0
- name: "Install"
working-directory: ./razer_control_gui
# According to this, sudo sould run ok: https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#administrative-privileges
run: ./install.sh install
- name: "Check installation"
working-directory: ./razer_control_gui
run: ../ci-helpers/check-installation.sh
33 changes: 0 additions & 33 deletions .github/workflows/rust.yml

This file was deleted.

1 change: 0 additions & 1 deletion NOTES.md

This file was deleted.

32 changes: 32 additions & 0 deletions ci-helpers/check-installation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
set -o errexit
set -o nounset
set -o pipefail

check_file() {
if [ ! -e $1 ]; then
echo "File \"$1\" does not exist."
exit 1
fi
}

echo "Checking the existence of the necessary files..."
# Daemon
check_file "$HOME/.local/share/razercontrol"
check_file "/usr/share/razercontrol/daemon"
check_file "/usr/share/razercontrol/laptops.json"
check_file "/etc/udev/rules.d/99-hidraw-permissions.rules"
# CLI
check_file "/usr/bin/razer-cli"
# GUI
check_file "/usr/bin/razer-settings"
check_file "/usr/share/applications/razer-settings.desktop"
echo "All files are present"

printf "Checking that the service is enabled: "
systemctl --user is-enabled razercontrol.service

echo "Checking files on the path"
printf -- "- " && which razer-cli
printf -- "- " && which razer-settings

echo "Done!"
90 changes: 86 additions & 4 deletions razer_control_gui/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions razer_control_gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ edition = "2018"

[[bin]]
name = "razer-cli"
path = "src/cli.rs"
path = "src/cli/cli.rs"

[[bin]]
name = "daemon"
path = "src/daemon.rs"
path = "src/daemon/daemon.rs"

[[bin]]
name = "razer-settings"
Expand All @@ -38,3 +38,5 @@ serde-big-array = "0.5.1"
clap = { version = "4.4.13", features = ["derive"] }
gtk = "0.18.1"
glib = "0.19.7"
log = "0.4.22"
env_logger = "0.11.5"
Loading

0 comments on commit b0b87c6

Please sign in to comment.