From 973623f548d322c979c106da3cacfac56f2a72b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=20Go=C3=B1i?= Date: Tue, 29 Oct 2024 13:25:01 +0100 Subject: [PATCH] Improve CI to check the install script --- .github/workflows/rust.yml | 18 +++++++++++++++--- ci-helpers/check-installation.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100755 ci-helpers/check-installation.sh diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b83d0a3..15b7ca5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,6 +1,7 @@ -name: Rust +name: CI on: + workflow_dispatch: push: branches: [ main ] pull_request: @@ -11,7 +12,6 @@ env: jobs: build: - runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -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" @@ -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 diff --git a/ci-helpers/check-installation.sh b/ci-helpers/check-installation.sh new file mode 100755 index 0000000..f54c233 --- /dev/null +++ b/ci-helpers/check-installation.sh @@ -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!"