From 60fce30a06e3f781837747a4007aab2696107b6e Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Mon, 20 Oct 2025 00:39:17 +0200 Subject: [PATCH] Chore: flush out requirement for nightly --- .cargo-husky/hooks/pre-commit | 4 ++-- .cargo-husky/hooks/pre-push | 4 ++-- .gitlab-ci.yml | 13 ++++++------- Makefile | 9 +++++++++ README.md | 2 +- asusd/src/aura_laptop/config.rs | 17 +++++++++++++++++ rog-control-center/Cargo.toml | 2 +- 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/.cargo-husky/hooks/pre-commit b/.cargo-husky/hooks/pre-commit index baed3cf7..070d97b2 100755 --- a/.cargo-husky/hooks/pre-commit +++ b/.cargo-husky/hooks/pre-commit @@ -1,6 +1,6 @@ #!/bin/sh set -e -echo '+cargo +nightly fmt --all -- --check' -cargo +nightly fmt --all -- --check +echo '+cargo fmt --all -- --check' +cargo fmt --all -- --check git add -u diff --git a/.cargo-husky/hooks/pre-push b/.cargo-husky/hooks/pre-push index b47ed1ad..62ed288a 100755 --- a/.cargo-husky/hooks/pre-push +++ b/.cargo-husky/hooks/pre-push @@ -2,8 +2,8 @@ set -e -echo '+cargo +nightly fmt --all -- --check' -cargo +nightly fmt --all -- --check +echo '+cargo fmt --all -- --check' +cargo fmt --all -- --check echo '+cargo clippy --all -- -D warnings' cargo clippy --all -- -D warnings echo '+cargo cranky' diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 198cba7a..176b3dcc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,8 +31,7 @@ format: - tags <<: *rust_cache script: - - echo "nightly" > rust-toolchain - - rustup component add rustfmt + - rustup component add rustfmt || true - cargo fmt --check check: @@ -40,8 +39,8 @@ check: - tags <<: *rust_cache script: - - rustup component add clippy - - cargo check + - rustup component add clippy || true + - cargo check --locked --workspace # deny currently catches too much #- cargo install cargo-deny && cargo deny - cargo install cargo-cranky && cargo cranky @@ -52,7 +51,7 @@ test: <<: *rust_cache script: - mkdir -p .git/hooks > /dev/null - - cargo test --all -- --test-threads=1 + - cargo test --locked --all release: only: @@ -60,7 +59,7 @@ release: <<: *rust_cache script: - cargo install cargo-vendor-filterer - - make && make vendor + - make FROZEN=1 && make vendor artifacts: paths: - vendor_asusctl*.tar.xz @@ -72,7 +71,7 @@ pages: - tags <<: *rust_cache script: - - cargo doc --document-private-items --no-deps --workspace + - cargo doc --locked --document-private-items --no-deps --workspace - rm -rf public - mkdir public - cp -R target/doc/* public diff --git a/Makefile b/Makefile index 60540fcf..6db2b96c 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,15 @@ ifeq ($(X11),1) ARGS += --features "rog-control-center/x11" endif +# Always use the versions in Cargo.lock by default +ARGS += --locked + +# Allow optionally freezing the build to avoid any network access and enforce Cargo.lock strictly +FROZEN ?= 0 +ifeq ($(FROZEN),1) + ARGS += --frozen +endif + VENDORED ?= 0 ifeq ($(VENDORED),1) ARGS += --frozen diff --git a/README.md b/README.md index de536b26..d3e1071d 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ A gui is now in the repo - ROG Control Center. At this time it is still a WIP, b Rust and cargo are required, they can be installed from [rustup.rs](https://rustup.rs/). -Distro repos probably won't work (unless rustup is shipped like in the case of archlinux) as nightly is needed. +Distro packaging should work with the stable toolchain. If your distro does not provide a recent Rust toolchain, install rustup and use the stable toolchain. **fedora:** diff --git a/asusd/src/aura_laptop/config.rs b/asusd/src/aura_laptop/config.rs index 326602af..43f535a0 100644 --- a/asusd/src/aura_laptop/config.rs +++ b/asusd/src/aura_laptop/config.rs @@ -231,6 +231,8 @@ impl AuraConfig { #[cfg(test)] mod tests { + use std::sync::{Mutex, MutexGuard, OnceLock}; + use rog_aura::keyboard::AuraPowerState; use rog_aura::{ AuraEffect, AuraModeNum, AuraZone, Colour, Direction, LedBrightness, PowerZones, Speed, @@ -238,8 +240,20 @@ mod tests { use super::AuraConfig; + // Global mutex to serialize tests that rely on process-wide environment + // variables + static TEST_MUTEX: OnceLock> = OnceLock::new(); + + fn test_lock() -> MutexGuard<'static, ()> { + TEST_MUTEX + .get_or_init(|| Mutex::new(())) + .lock() + .expect("TEST_MUTEX poisoned") + } + #[test] fn set_multizone_4key_config() { + let _guard = test_lock(); std::env::set_var("BOARD_NAME", ""); let mut config = AuraConfig::new("19b6"); @@ -319,6 +333,7 @@ mod tests { #[test] fn set_multizone_multimode_config() { + let _guard = test_lock(); std::env::set_var("BOARD_NAME", ""); let mut config = AuraConfig::new("19b6"); @@ -367,6 +382,7 @@ mod tests { #[test] fn verify_0x1866_g531i() { + let _guard = test_lock(); std::env::set_var("BOARD_NAME", "G513I"); let mut config = AuraConfig::new("1866"); @@ -392,6 +408,7 @@ mod tests { #[test] fn verify_0x19b6_g634j() { + let _guard = test_lock(); std::env::set_var("BOARD_NAME", "G634J"); let mut config = AuraConfig::new("19b6"); diff --git a/rog-control-center/Cargo.toml b/rog-control-center/Cargo.toml index 8a7318ab..bf505f37 100644 --- a/rog-control-center/Cargo.toml +++ b/rog-control-center/Cargo.toml @@ -12,7 +12,7 @@ edition.workspace = true default = [] mocking = [] x11 = ["slint/backend-winit-x11"] -# Requires RUSTFLAGS="--cfg tokio_unstable" +# Optional tokio debug feature does not require nightly; remove RUSTFLAGS note. tokio-debug = ["console-subscriber"] [dependencies]