Skip to content

Commit

Permalink
ci: add test+clippy for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
jtroo authored Dec 10, 2023
1 parent 568a0c8 commit 905b038
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 26 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,24 @@ jobs:
- name: Check fmt
run: cargo fmt --all --check

build-test-clippy-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
shared-key: "persist-cross-job"
workspaces: ./
- run: rustup component add clippy
- name: Run tests
run: cargo test --all
- name: Run tests all features
run: cargo test --all --all-features
- name: Run clippy no features
run: cargo clippy --all -- -D warnings
- name: Run clippy all features
run: cargo clippy --all --all-features -- -D warnings

build-test-clippy-windows:
runs-on: windows-latest
build-test-clippy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
- x86_64-pc-windows-msvc
# You can add more, for any target you'd like!
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl

- build: windows
os: windows-latest
target: x86_64-pc-windows-msvc

- build: macos
os: macos-latest
target: x86_64-apple-darwin

steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand Down
4 changes: 4 additions & 0 deletions cfg_samples/kanata.kbd
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ If you need help, please feel welcome to ask in the GitHub discussions.
ì 13
)

(deflocalkeys-macos
ì 13
)

;; Only one defsrc is allowed.
;;
;; defsrc defines the keys that will be intercepted by kanata. The order of the
Expand Down
19 changes: 19 additions & 0 deletions parser/src/cfg/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,25 @@ yen 314
¥ 315
new 316
)
(deflocalkeys-macos
+ 300
[ 301
] 302
{ 303
} 304
/ 305
; 306
` 307
= 308
- 309
' 310
, 311
. 312
\ 313
yen 314
¥ 315
new 316
)
(defsrc + [ ] { } / ; ` = - ' , . \ yen ¥ new)
(deflayer base + [ ] { } / ; ` = - ' , . \ yen ¥ new)
"#;
Expand Down
4 changes: 2 additions & 2 deletions src/kanata/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Kanata {
let mut kanata = kanata.lock();
kanata
.kbd_out
.write(event.clone())
.write(event)
.map_err(|e| anyhow!("failed write: {}", e))?;
continue;
}
Expand All @@ -44,7 +44,7 @@ impl Kanata {
let mut kanata = kanata.lock();
kanata
.kbd_out
.write(event.clone())
.write(event)
.map_err(|e| anyhow!("failed write: {}", e))?;
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/oskbd/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ impl KbdIn {
));
}

let device_names = if include_names.is_some() {
validate_and_register_devices(include_names.unwrap())
let device_names = if let Some(names) = include_names {
validate_and_register_devices(names)
} else {
vec![]
};
Expand Down

0 comments on commit 905b038

Please sign in to comment.