Skip to content

Commit 7a2ce78

Browse files
committed
ci: Add GitHub Actions CI workflow and fix all clippy/test issues
- Add .github/workflows/ci.yml: fmt, check, clippy -D warnings, test on push/PR to main; oracle excluded (requires native OCI client libs) - Add scripts/ci-check.sh: local mirror of CI steps - Fix lifetime annotations: add '_, to Element<> returns on &self methods - Fix clippy::derivable_impls: replace manual Default impls with derive - Fix clippy::needless_borrow: remove unnecessary & in .args() calls - Fix clippy::manual_strip: use .strip_prefix() in settings - Fix clippy::useless_conversion: remove .into() on iced::Color - Fix clippy::too_many_arguments: allow on left_panel::view() - Fix test failures: strip trailing newline from text_editor::Content::text() - Fix missing pool_config in settings/mod.rs test
1 parent d3511d5 commit 7a2ce78

29 files changed

Lines changed: 179 additions & 150 deletions

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
# Oracle requires native OCI client libs not available on CI runners.
12+
# All other adapters are included.
13+
CI_FEATURES: postgres,mysql,sqlite,mongodb,mssql
14+
15+
jobs:
16+
ci:
17+
name: Check / Fmt / Clippy / Test
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install Rust stable
24+
uses: dtolnay/rust-toolchain@stable
25+
with:
26+
components: rustfmt, clippy
27+
28+
- name: Cache cargo registry and build
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
~/.cargo/registry
33+
~/.cargo/git
34+
target
35+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-cargo-
38+
39+
- name: Install system dependencies (Iced/wgpu)
40+
run: |
41+
sudo apt-get update -qq
42+
sudo apt-get install -y --no-install-recommends \
43+
libssl-dev \
44+
pkg-config \
45+
libvulkan1 \
46+
libxkbcommon-dev \
47+
libwayland-dev \
48+
libx11-dev \
49+
libxi-dev \
50+
libxrandr-dev
51+
52+
- name: cargo fmt --check
53+
run: cargo fmt --all -- --check
54+
55+
- name: cargo check
56+
run: cargo check --workspace --features $CI_FEATURES
57+
58+
- name: cargo clippy
59+
run: cargo clippy --workspace --features $CI_FEATURES -- -D warnings
60+
61+
- name: cargo test
62+
run: cargo test --workspace --features $CI_FEATURES

rusty-app/src/adapter_selector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
66
use crate::button_styles;
77
use crate::theme::ThemeColors;
8+
use arni::DatabaseType;
89
use iced::widget::{button, column, container, pick_list, row, text};
910
use iced::{Border, Element, Fill};
10-
use arni::DatabaseType;
1111

1212
/// Wrapper for DatabaseType to implement Display for the picker
1313
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

rusty-app/src/button_styles.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ pub fn secondary(theme: ThemeColors) -> impl Fn(&iced::Theme, button::Status) ->
3838
let is_hovered = matches!(status, button::Status::Hovered);
3939

4040
button::Style {
41-
background: Some(
42-
if is_hovered {
43-
theme.border.into()
44-
} else {
45-
theme.background_secondary.into()
46-
}
47-
),
41+
background: Some(if is_hovered {
42+
theme.border.into()
43+
} else {
44+
theme.background_secondary.into()
45+
}),
4846
text_color: if is_hovered {
4947
theme.text
5048
} else {
@@ -112,17 +110,15 @@ pub fn danger(theme: ThemeColors) -> impl Fn(&iced::Theme, button::Status) -> bu
112110
///
113111
/// Use when button action is not currently available
114112
pub fn disabled(theme: ThemeColors) -> impl Fn(&iced::Theme, button::Status) -> button::Style {
115-
move |_theme, _status| {
116-
button::Style {
117-
background: Some(theme.background_secondary.into()),
118-
text_color: theme.text_secondary,
119-
border: Border {
120-
color: theme.border,
121-
width: 1.0,
122-
radius: BUTTON_BORDER_RADIUS.into(),
123-
},
124-
shadow: iced::Shadow::default(),
125-
}
113+
move |_theme, _status| button::Style {
114+
background: Some(theme.background_secondary.into()),
115+
text_color: theme.text_secondary,
116+
border: Border {
117+
color: theme.border,
118+
width: 1.0,
119+
radius: BUTTON_BORDER_RADIUS.into(),
120+
},
121+
shadow: iced::Shadow::default(),
126122
}
127123
}
128124

rusty-app/src/components/connection_form.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
33
use crate::components::{Component, ComponentAction, ComponentId, ConnectionFormAction};
44
use crate::theme::ThemeColors;
5+
use arni::DatabaseType;
56
use iced::widget::{button, column, container, pick_list, row, text, text_input};
67
use iced::{Border, Element, Fill};
7-
use arni::DatabaseType;
88

99
/// Wrapper for DatabaseType to implement Display
1010
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -226,7 +226,7 @@ impl Component for ConnectionFormComponent {
226226
ComponentId::ConnectionForm
227227
}
228228

229-
fn view(&self, theme: ThemeColors) -> Element<ComponentAction> {
229+
fn view(&self, theme: ThemeColors) -> Element<'_, ComponentAction> {
230230
let data = &self.data;
231231

232232
// Database type picker

rusty-app/src/components/editor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl Component for EditorComponent {
145145
ComponentId::Editor
146146
}
147147

148-
fn view(&self, theme: ThemeColors) -> Element<ComponentAction> {
148+
fn view(&self, theme: ThemeColors) -> Element<'_, ComponentAction> {
149149
// Tab bar
150150
let mut tab_row = row![].spacing(2);
151151

rusty-app/src/components/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub trait Component: Send {
141141
///
142142
/// # Returns
143143
/// Element that emits ComponentAction messages
144-
fn view(&self, theme: ThemeColors) -> Element<ComponentAction>;
144+
fn view(&self, theme: ThemeColors) -> Element<'_, ComponentAction>;
145145
}
146146

147147
/// Map a component's Element<ComponentAction> to Element<Message>

rusty-app/src/components/properties.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,13 @@ impl Component for PropertiesComponent {
9595
ComponentId::Properties
9696
}
9797

98-
fn view(&self, theme: ThemeColors) -> Element<ComponentAction> {
98+
fn view(&self, theme: ThemeColors) -> Element<'_, ComponentAction> {
9999
let mut content_col = column![
100100
row![
101-
text(icons::symbol_key()).font(icons::font()).size(14).color(theme.accent),
101+
text(icons::symbol_key())
102+
.font(icons::font())
103+
.size(14)
104+
.color(theme.accent),
102105
text("Properties").size(12).color(theme.text),
103106
]
104107
.spacing(6)

rusty-app/src/components/results_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Component for ResultsViewComponent {
3232
ComponentId::ResultsView
3333
}
3434

35-
fn view(&self, theme: ThemeColors) -> Element<ComponentAction> {
35+
fn view(&self, theme: ThemeColors) -> Element<'_, ComponentAction> {
3636
// Placeholder view - actual result grid rendering will be integrated later
3737
let content = column![text("Results").size(14).color(theme.text),]
3838
.spacing(10)

rusty-app/src/components/server_list.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use crate::button_styles;
44
use crate::components::{Component, ComponentAction, ComponentId, ServerListAction};
55
use crate::icons;
66
use crate::theme::ThemeColors;
7+
use arni::ConnectionConfig;
78
use iced::widget::{button, column, container, horizontal_space, row, scrollable, text};
89
use iced::{Border, Element, Fill};
9-
use arni::ConnectionConfig;
1010

1111
/// Server list component with internal connection list
1212
#[derive(Debug, Clone)]
@@ -75,7 +75,7 @@ impl Component for ServerListComponent {
7575
ComponentId::ServerList
7676
}
7777

78-
fn view(&self, theme: ThemeColors) -> Element<ComponentAction> {
78+
fn view(&self, theme: ThemeColors) -> Element<'_, ComponentAction> {
7979
// New connection button
8080
let new_conn_btn = button(text("+ New Connection").size(12))
8181
.padding([6, 10])
@@ -84,7 +84,10 @@ impl Component for ServerListComponent {
8484

8585
let mut content_col = column![
8686
row![
87-
text(icons::server()).font(icons::font()).size(14).color(theme.accent),
87+
text(icons::server())
88+
.font(icons::font())
89+
.size(14)
90+
.color(theme.accent),
8891
text("Servers").size(12).color(theme.text),
8992
horizontal_space(),
9093
new_conn_btn,

rusty-app/src/components/table_list.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,13 @@ impl Component for TableListComponent {
8484
ComponentId::TableList
8585
}
8686

87-
fn view(&self, theme: ThemeColors) -> Element<ComponentAction> {
87+
fn view(&self, theme: ThemeColors) -> Element<'_, ComponentAction> {
8888
let mut content_col = column![
8989
row![
90-
text(icons::table()).font(icons::font()).size(14).color(theme.accent),
90+
text(icons::table())
91+
.font(icons::font())
92+
.size(14)
93+
.color(theme.accent),
9194
text("Tables").size(12).color(theme.text),
9295
]
9396
.spacing(6)

0 commit comments

Comments
 (0)