mirror of
https://github.com/vee1e/moomer.git
synced 2026-09-01 10:18:47 +00:00
Fix CI: rustfmt and keep GUI deps off the Linux lib job
Make xcap/winit/pixels/image optional under the default `gui` feature so `cargo clippy/test --lib --no-default-features` no longer needs dbus on Ubuntu. Format main.rs for rustfmt.
This commit is contained in:
parent
e7207ad7aa
commit
862a9712c8
5 changed files with 330 additions and 253 deletions
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
- name: Check formatting
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
# Pure logic only — no windowing / screenshot deps, runs on Linux.
|
||||
# Pure logic only — no GUI / capture deps (feature "gui" off).
|
||||
lib:
|
||||
name: clippy + test (lib)
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -31,9 +31,7 @@ jobs:
|
|||
with:
|
||||
components: clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
# --lib only: pure logic, no GUI binary. (Do not use --all-targets / --tests
|
||||
# here — those also compile the macOS-only binary target.)
|
||||
- name: Clippy (lib)
|
||||
run: cargo clippy --lib -- -D warnings
|
||||
- name: Tests (lib)
|
||||
run: cargo test --lib
|
||||
- name: Clippy (lib, no gui)
|
||||
run: cargo clippy --lib --no-default-features -- -D warnings
|
||||
- name: Tests (lib, no gui)
|
||||
run: cargo test --lib --no-default-features
|
||||
|
|
|
|||
540
Cargo.lock
generated
540
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
17
Cargo.toml
17
Cargo.toml
|
|
@ -10,13 +10,19 @@ path = "src/lib.rs"
|
|||
[[bin]]
|
||||
name = "moomer"
|
||||
path = "src/main.rs"
|
||||
required-features = ["gui"]
|
||||
|
||||
[features]
|
||||
default = ["gui"]
|
||||
# GUI / capture stack — only needed for the binary. Lib CI uses --no-default-features.
|
||||
gui = ["dep:xcap", "dep:winit", "dep:pixels", "dep:image"]
|
||||
|
||||
[dependencies]
|
||||
# screenshots is unmaintained (future-incompat) and points users at xcap.
|
||||
xcap = "0.4"
|
||||
winit = "0.28"
|
||||
pixels = "0.13"
|
||||
image = "0.25"
|
||||
# screenshots is unmaintained (future-incompat); xcap is the maintained replacement.
|
||||
xcap = { version = "0.4", optional = true }
|
||||
winit = { version = "0.28", optional = true }
|
||||
pixels = { version = "0.13", optional = true }
|
||||
image = { version = "0.25", optional = true }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
cocoa = "0.25"
|
||||
|
|
@ -27,4 +33,3 @@ libc = "0.2"
|
|||
# Declare it so rustc's unexpected_cfgs lint stays quiet.
|
||||
[lints.rust]
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(feature, values("cargo-clippy"))'] }
|
||||
|
||||
|
|
|
|||
|
|
@ -48,11 +48,12 @@ GitHub Actions (Linux) runs:
|
|||
|
||||
```bash
|
||||
$ cargo fmt --all -- --check
|
||||
$ cargo clippy --lib -- -D warnings
|
||||
$ cargo test --lib
|
||||
$ cargo clippy --lib --no-default-features -- -D warnings
|
||||
$ cargo test --lib --no-default-features
|
||||
```
|
||||
|
||||
Platform-independent logic lives in `src/lib.rs` so those jobs do not need macOS or a display.
|
||||
Platform-independent logic lives in `src/lib.rs`. The `gui` feature (default on) pulls in
|
||||
`xcap` / `winit` / `pixels` for the binary; CI disables it so Linux runners never need dbus/X11.
|
||||
|
||||
## Running
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ use moomer::best_capture_for_monitor;
|
|||
use moomer::{apply_zoom, physical_dims, ViewState};
|
||||
use pixels::{Pixels, SurfaceTexture};
|
||||
use std::collections::HashMap;
|
||||
use xcap::Monitor;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
use std::sync::Mutex;
|
||||
|
|
@ -16,6 +15,7 @@ use winit::{
|
|||
event_loop::{ControlFlow, EventLoop},
|
||||
window::{Window, WindowBuilder, WindowId},
|
||||
};
|
||||
use xcap::Monitor;
|
||||
|
||||
/// Dual log: stderr + /tmp/moomer.log (so hotkey / Raycast launches still leave a trail).
|
||||
static LOG_FILE: Mutex<Option<std::fs::File>> = Mutex::new(None);
|
||||
|
|
@ -910,9 +910,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
let target_monitor = {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let by_id = macos::display_id_under_cursor().and_then(|id| {
|
||||
monitors.iter().find(|m| m.id().ok() == Some(id)).cloned()
|
||||
});
|
||||
let by_id = macos::display_id_under_cursor()
|
||||
.and_then(|id| monitors.iter().find(|m| m.id().ok() == Some(id)).cloned());
|
||||
if let Some(m) = by_id {
|
||||
log(format!(
|
||||
"main: target display under cursor = id={} primary={} {}x{} @ ({},{})",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue