Skip to content

Commit 19d589e

Browse files
committed
fix ci
1 parent 16ade83 commit 19d589e

4 files changed

Lines changed: 30 additions & 33 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Coverage
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches: [main, release-*]
7-
pull_request:
8-
branches: [main, release-*]
5+
# push:
6+
# branches: [main, release-*]
7+
# pull_request:
8+
# branches: [main, release-*]
99

1010
env:
1111
CARGO_TERM_COLOR: always

.github/workflows/rust.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- os: macos-latest
2626
extra: -- --skip test_afrim
2727
- os: windows-latest
28-
extra: -- --skip test_afrim
28+
# extra: -- --skip test_afrim
2929

3030
steps:
3131
- uses: actions/checkout@v4
@@ -45,6 +45,10 @@ jobs:
4545
- name: Setup headless environment
4646
run: ${{matrix.headless}}
4747

48+
- if: matrix.os == 'windows-latest'
49+
name: Install Tcl/Tk (wish) via Chocolatey
50+
run: choco install tcltk -y
51+
4852
- name: Rustfmt
4953
run: cargo fmt -- --check
5054

.github/workflows/web.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Web
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches: [main, release-*]
7-
pull_request:
8-
branches: [main, release-*]
5+
# push:
6+
# branches: [main, release-*]
7+
# pull_request:
8+
# branches: [main, release-*]
99

1010
env:
1111
CARGO_TERM_COLOR: always

service/src/lib.rs

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ pub fn run(
205205
mod tests {
206206
use crate::{frontend::Console, run, Config};
207207
use afrish::{self, TkPackLayout};
208-
use rdev::{self, Button, EventType::*, Key::*};
209-
use std::sync::mpsc::{self, Sender};
208+
use rdev::{self, EventType::*, Key::*};
209+
use std::sync::mpsc::{self};
210210
use std::{thread, time::Duration};
211211

212212
macro_rules! input {
@@ -255,11 +255,7 @@ mod tests {
255255
input_field
256256
}
257257

258-
fn end_sandbox() {
259-
afrish::end_wish();
260-
}
261-
262-
fn start_simulation(signal: Sender<()>) {
258+
fn start_simulation() {
263259
let typing_speed_ms = Duration::from_millis(500);
264260

265261
// To detect excessive backspace
@@ -268,15 +264,10 @@ mod tests {
268264
// Start the sandbox
269265
let textfield = start_sandbox(LIMIT);
270266

271-
// Send the ready signal.
272-
signal.send(()).unwrap();
273-
274-
rdev::simulate(&MouseMove { x: 100.0, y: 100.0 }).unwrap();
275-
thread::sleep(typing_speed_ms);
276-
rdev::simulate(&ButtonPress(Button::Left)).unwrap();
277-
thread::sleep(typing_speed_ms);
278-
rdev::simulate(&ButtonRelease(Button::Left)).unwrap();
279-
thread::sleep(typing_speed_ms);
267+
rdev::simulate(&KeyPress(Alt)).unwrap();
268+
rdev::simulate(&KeyPress(Tab)).unwrap();
269+
rdev::simulate(&KeyRelease(Alt)).unwrap();
270+
rdev::simulate(&KeyRelease(Tab)).unwrap();
280271

281272
input!(KeyU, typing_speed_ms);
282273
#[cfg(not(feature = "inhibit"))]
@@ -378,8 +369,6 @@ mod tests {
378369
rdev::simulate(&KeyPress(ShiftLeft)).unwrap();
379370
input!(Minus, typing_speed_ms);
380371
rdev::simulate(&KeyRelease(ShiftLeft)).unwrap();
381-
382-
end_sandbox();
383372
}
384373

385374
#[test]
@@ -388,16 +377,20 @@ mod tests {
388377

389378
let (tx, rx) = mpsc::channel();
390379

391-
// TODO: handle simulation errors.
392-
let simulation_thread = thread::spawn(move || start_simulation(tx));
380+
let afrim_thread = thread::spawn(move || {
381+
let test_config = Config::from_file(Path::new("./data/test.toml")).unwrap();
382+
// Send the ready signal.
383+
tx.send(()).unwrap();
384+
385+
assert!(run(test_config, Console::default()).is_ok());
386+
});
393387

394388
// Wait the ready signal.
395389
rx.recv().unwrap();
396390

397-
let test_config = Config::from_file(Path::new("./data/test.toml")).unwrap();
398-
assert!(run(test_config, Console::default()).is_ok());
391+
start_simulation();
399392

400-
// Wait the simulation to end properly.
401-
simulation_thread.join().unwrap();
393+
// Wait the afrim to end properly.
394+
afrim_thread.join().unwrap();
402395
}
403396
}

0 commit comments

Comments
 (0)