Mayo commited on
Commit
aa02536
·
unverified ·
1 Parent(s): 0ae35fa

ci: run Rust integration tests and Vitest UI tests

Browse files
Files changed (2) hide show
  1. .github/workflows/test.yml +36 -5
  2. package.json +1 -0
.github/workflows/test.yml CHANGED
@@ -12,8 +12,8 @@ env:
12
  CARGO_TERM_COLOR: always
13
 
14
  jobs:
15
- test:
16
- name: Unit Tests
17
  runs-on: ubuntu-latest
18
  steps:
19
  # refer: https://v2.tauri.app/start/prerequisites/#linux
@@ -29,10 +29,41 @@ jobs:
29
  libssl-dev \
30
  libayatana-appindicator3-dev \
31
  librsvg2-dev \
32
- fonts-noto-cjk
 
 
33
  - uses: actions/checkout@v6
34
  - uses: Swatinem/rust-cache@v2
35
  with:
36
  cache-targets: false
37
- - run: cargo test --no-run
38
- - run: cargo test --workspace --tests
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  CARGO_TERM_COLOR: always
13
 
14
  jobs:
15
+ rust:
16
+ name: Rust
17
  runs-on: ubuntu-latest
18
  steps:
19
  # refer: https://v2.tauri.app/start/prerequisites/#linux
 
29
  libssl-dev \
30
  libayatana-appindicator3-dev \
31
  librsvg2-dev \
32
+ fonts-noto-cjk \
33
+ dbus-x11 \
34
+ gnome-keyring
35
  - uses: actions/checkout@v6
36
  - uses: Swatinem/rust-cache@v2
37
  with:
38
  cache-targets: false
39
+ # The integration-tests crate prepares a shared llama.cpp runtime once
40
+ # per `cargo test` invocation under `tests/integration-tests/.cache`;
41
+ # caching that directory across runs avoids re-downloading the dylib
42
+ # on every PR.
43
+ - uses: actions/cache@v4
44
+ with:
45
+ path: tests/integration-tests/.cache
46
+ key: ${{ runner.os }}-integration-runtime-${{ hashFiles('koharu-runtime/**/*.rs', 'koharu-llm/**/*.rs') }}
47
+ restore-keys: ${{ runner.os }}-integration-runtime-
48
+ - name: Run workspace tests (unit + integration)
49
+ run: |
50
+ # Headless dbus + gnome-keyring so the provider-secret integration
51
+ # tests can talk to secret-service on Linux runners.
52
+ eval "$(dbus-launch --sh-syntax)"
53
+ echo -n "" | gnome-keyring-daemon --unlock --components=secrets &>/dev/null &
54
+ export $(echo -n "" | gnome-keyring-daemon --start --components=secrets 2>/dev/null)
55
+ cargo test --workspace --tests
56
+
57
+ ui:
58
+ name: UI
59
+ runs-on: ubuntu-latest
60
+ steps:
61
+ - uses: actions/checkout@v6
62
+ - uses: oven-sh/setup-bun@v2
63
+ - uses: actions/cache@v4
64
+ with:
65
+ path: ~/.bun/install/cache
66
+ key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
67
+ - run: bun install --frozen-lockfile
68
+ - name: Run Vitest
69
+ run: bun run --filter ui test
package.json CHANGED
@@ -7,6 +7,7 @@
7
  "build": "bun run scripts/dev.ts tauri build --no-bundle",
8
  "cargo": "bun run scripts/dev.ts cargo",
9
  "lint:ui": "bun run --filter ui lint",
 
10
  "format": "oxfmt ui package.json .oxfmtrc.json .vscode",
11
  "format:check": "oxfmt --check ui package.json .oxfmtrc.json .vscode",
12
  "generate:openapi": "cargo run -p koharu-rpc --bin openapi -- ui/openapi.json",
 
7
  "build": "bun run scripts/dev.ts tauri build --no-bundle",
8
  "cargo": "bun run scripts/dev.ts cargo",
9
  "lint:ui": "bun run --filter ui lint",
10
+ "test:ui": "bun run --filter ui test",
11
  "format": "oxfmt ui package.json .oxfmtrc.json .vscode",
12
  "format:check": "oxfmt --check ui package.json .oxfmtrc.json .vscode",
13
  "generate:openapi": "cargo run -p koharu-rpc --bin openapi -- ui/openapi.json",