diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 330d157d3f..3e5c56bcbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: flag-name: frontend parallel: true - backend_tests: + ruby_tests: runs-on: ubuntu-latest env: COVERAGE: 1 @@ -100,7 +100,7 @@ jobs: flag-name: backend parallel: true - backend_linter: + ruby_linter: runs-on: ubuntu-latest defaults: @@ -123,7 +123,7 @@ jobs: - name: Rubocop run: /usr/bin/rubocop.*-1.24.1 - backend_doc: + ruby_doc: runs-on: ubuntu-latest env: COVERAGE: 1 @@ -161,6 +161,44 @@ jobs: - name: Check that introspected API and its docs have not diverged run: make -C ../doc check + rust_ci: + runs-on: ubuntu-latest + env: + COVERAGE: 1 + + defaults: + run: + working-directory: ./rust + + strategy: + fail-fast: false + + container: + image: registry.opensuse.org/opensuse/tumbleweed:latest + + steps: + + - name: Git Checkout + uses: actions/checkout@v3 + + - name: Configure and refresh repositories + # disable unused repositories to have faster refresh + run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && ( zypper ref || zypper ref || zypper ref ) + + - name: Install Rust development files + run: zypper --non-interactive install rustup + + - name: Install required packages + run: zypper --non-interactive install python-langtable-data openssl-3 libopenssl-3-devel + + - name: Install Rust toolchains + run: rustup toolchain install stable + + - name: Run the tests + run: cargo test --verbose + + - name: Lint formatting + run: cargo fmt --all -- --check integration-tests: timeout-minutes: 60 @@ -203,9 +241,6 @@ jobs: - name: Setup service run: podman exec agama bash -c "cd /checkout; ./setup-service.sh" - - name: Rust unit tests - run: podman exec agama bash -c "cd /checkout/rust; cargo test --verbose" - - name: Set a testing Agama configuration # copy a simplified ALP config file, it skips the product selection at the beginning run: podman exec agama bash -c "cp /checkout/playwright/config/agama.yaml /checkout/service/etc/agama.yaml" @@ -251,7 +286,7 @@ jobs: finish: runs-on: ubuntu-latest - needs: [frontend_build, backend_tests] + needs: [frontend_build, ruby_tests] steps: diff --git a/rust/agama-dbus-server/src/network/system.rs b/rust/agama-dbus-server/src/network/system.rs index 9439f14a8f..b529ac7f23 100644 --- a/rust/agama-dbus-server/src/network/system.rs +++ b/rust/agama-dbus-server/src/network/system.rs @@ -1,5 +1,5 @@ use crate::network::{ - dbus::Tree, model::Connection, nm::NetworkManagerAdapter, Action, Adapter, NetworkState + dbus::Tree, model::Connection, nm::NetworkManagerAdapter, Action, Adapter, NetworkState, }; use agama_lib::error::ServiceError; use std::error::Error; diff --git a/rust/agama-lib/src/install_settings.rs b/rust/agama-lib/src/install_settings.rs index 203bfd6e14..bd1323f185 100644 --- a/rust/agama-lib/src/install_settings.rs +++ b/rust/agama-lib/src/install_settings.rs @@ -1,13 +1,11 @@ //! Configuration settings handling //! //! This module implements the mechanisms to load and store the installation settings. +use crate::settings::{SettingObject, SettingValue, Settings}; use crate::{ - network::NetworkSettings, - storage::StorageSettings, - software::SoftwareSettings, - users::UserSettings + network::NetworkSettings, software::SoftwareSettings, storage::StorageSettings, + users::UserSettings, }; -use crate::settings::{SettingObject, SettingValue, Settings}; use serde::{Deserialize, Serialize}; use std::default::Default; use std::str::FromStr; @@ -172,4 +170,4 @@ impl Settings for InstallSettings { storage.merge(other_storage); } } -} \ No newline at end of file +} diff --git a/rust/agama-lib/src/network.rs b/rust/agama-lib/src/network.rs index c63c7c6096..11bd289408 100644 --- a/rust/agama-lib/src/network.rs +++ b/rust/agama-lib/src/network.rs @@ -1,8 +1,8 @@ //! Implements support for handling the network settings mod client; -mod settings; mod proxies; +mod settings; mod store; pub mod types; diff --git a/rust/agama-lib/src/proxies.rs b/rust/agama-lib/src/proxies.rs index 5340e494d7..d2f31e00da 100644 --- a/rust/agama-lib/src/proxies.rs +++ b/rust/agama-lib/src/proxies.rs @@ -137,4 +137,4 @@ trait Questions1 { size: &str, attempt: u8, ) -> zbus::Result; -} \ No newline at end of file +} diff --git a/rust/agama-lib/src/software.rs b/rust/agama-lib/src/software.rs index 6b557e32c0..b494e4f26c 100644 --- a/rust/agama-lib/src/software.rs +++ b/rust/agama-lib/src/software.rs @@ -7,4 +7,4 @@ mod store; pub use client::SoftwareClient; pub use settings::SoftwareSettings; -pub use store::SoftwareStore; \ No newline at end of file +pub use store::SoftwareStore; diff --git a/rust/agama-lib/src/software/store.rs b/rust/agama-lib/src/software/store.rs index 0e39487163..609aed4536 100644 --- a/rust/agama-lib/src/software/store.rs +++ b/rust/agama-lib/src/software/store.rs @@ -1,7 +1,7 @@ //! Implements the store for the storage settings. +use super::{SoftwareClient, SoftwareSettings}; use crate::error::{ServiceError, WrongParameter}; -use super::{SoftwareSettings, SoftwareClient}; use std::error::Error; use zbus::Connection; diff --git a/rust/agama-lib/src/storage.rs b/rust/agama-lib/src/storage.rs index f203b7b1ed..dfb9105357 100644 --- a/rust/agama-lib/src/storage.rs +++ b/rust/agama-lib/src/storage.rs @@ -7,4 +7,4 @@ mod store; pub use client::StorageClient; pub use settings::StorageSettings; -pub use store::StorageStore; \ No newline at end of file +pub use store::StorageStore; diff --git a/rust/agama-lib/src/storage/proxies.rs b/rust/agama-lib/src/storage/proxies.rs index 19ba25ff50..41a123c175 100644 --- a/rust/agama-lib/src/storage/proxies.rs +++ b/rust/agama-lib/src/storage/proxies.rs @@ -103,4 +103,3 @@ trait StorageProposal { &self, ) -> zbus::Result>>; } - diff --git a/rust/agama-lib/src/storage/store.rs b/rust/agama-lib/src/storage/store.rs index 22b873c356..10c013cbdc 100644 --- a/rust/agama-lib/src/storage/store.rs +++ b/rust/agama-lib/src/storage/store.rs @@ -1,7 +1,7 @@ //! Implements the store for the storage settings. -use crate::error::ServiceError; use super::{StorageClient, StorageSettings}; +use crate::error::ServiceError; use std::default::Default; use std::error::Error; use zbus::Connection; diff --git a/rust/agama-lib/src/users.rs b/rust/agama-lib/src/users.rs index 5e816f0a02..a7dc878639 100644 --- a/rust/agama-lib/src/users.rs +++ b/rust/agama-lib/src/users.rs @@ -1,10 +1,10 @@ //! Implements support for handling the users settings mod client; -mod settings; mod proxies; +mod settings; mod store; -pub use client::{UsersClient, FirstUser}; +pub use client::{FirstUser, UsersClient}; pub use settings::{FirstUserSettings, RootUserSettings, UserSettings}; -pub use store::UsersStore; \ No newline at end of file +pub use store::UsersStore; diff --git a/rust/agama-lib/src/users/client.rs b/rust/agama-lib/src/users/client.rs index c81ccdeae3..9985ffda1d 100644 --- a/rust/agama-lib/src/users/client.rs +++ b/rust/agama-lib/src/users/client.rs @@ -111,4 +111,4 @@ impl<'a> UsersClient<'a> { ) .await } -} \ No newline at end of file +} diff --git a/rust/agama-lib/src/users/settings.rs b/rust/agama-lib/src/users/settings.rs index a7efc1de10..f14b9bb0d9 100644 --- a/rust/agama-lib/src/users/settings.rs +++ b/rust/agama-lib/src/users/settings.rs @@ -108,4 +108,4 @@ mod tests { user1.merge(&user2); assert_eq!(user1.full_name.unwrap(), "Jane Doe") } -} \ No newline at end of file +} diff --git a/rust/agama-lib/src/users/store.rs b/rust/agama-lib/src/users/store.rs index 397051b854..3c8d28b5cc 100644 --- a/rust/agama-lib/src/users/store.rs +++ b/rust/agama-lib/src/users/store.rs @@ -1,5 +1,5 @@ +use super::{FirstUser, FirstUserSettings, RootUserSettings, UserSettings, UsersClient}; use crate::error::WrongParameter; -use super::{FirstUserSettings, RootUserSettings, UserSettings, UsersClient, FirstUser}; use std::error::Error; use zbus::Connection;