Skip to content

Commit

Permalink
Improve CI to check the install script
Browse files Browse the repository at this point in the history
  • Loading branch information
JosuGZ committed Oct 29, 2024
1 parent aa6ea62 commit 973623f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Rust
name: CI

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
Expand All @@ -11,7 +12,6 @@ env:

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -20,7 +20,6 @@ jobs:
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"
Expand All @@ -31,3 +30,16 @@ jobs:
- name: Run tests
working-directory: ./razer_control_gui
run: cargo test --verbose

install:
# This assumes that the worker will be using systemctl
runs-on: ubuntu-latest
needs: build
steps:
- 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_install.sh
29 changes: 29 additions & 0 deletions ci-helpers/check-installation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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 "~/.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 "Done!"

0 comments on commit 973623f

Please sign in to comment.