Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
ci(rust-check): lint the standalone jan-cli crate (#9104)
Akarshan Biswas74a8b1b02e69
diff --git a/.github/workflows/rust-check.yml b/.github/workflows/rust-check.ymlindex 71519b70a..389915b3d 100644--- a/.github/workflows/rust-check.yml+++ b/.github/workflows/rust-check.yml@@ -195,6 +195,12 @@ jobs:# Each plugin and src-tauri/utils is its own workspace, so checking the app# crate compiles them as path dependencies but never lints them. No --locked# here: Cargo.lock is gitignored and only some of these crates commit one.+ #+ # jan-cli is standalone the same way, but depends on app_lib rather than the+ # reverse, so the app matrix never reaches it either. Its include entry adds+ # what it differs by: it commits a Cargo.lock (so --locked), it only builds+ # with the cli feature, that feature is Tauri-free (no system libraries), and+ # its .cargo/config.toml puts the target dir at src-tauri/target.crates:name: ${{ matrix.crate }}runs-on: ubuntu-latest@@ -204,6 +210,7 @@ jobs:# tauri-plugin-mlx is Apple-Silicon-only and is a macOS target# dependency, not part of any Linux build.crate:+ - jan-cli- plugins/tauri-plugin-agent-tools- plugins/tauri-plugin-hardware- plugins/tauri-plugin-llamacpp@@ -211,6 +218,11 @@ jobs:- plugins/tauri-plugin-vector-db- plugins/tauri-plugin-websearch- utils+ include:+ - crate: jan-cli+ flags: --locked --no-default-features --features cli+ target_dir: ../target+ skip_tauri: truesteps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -220,19 +232,20 @@ jobs:- uses: Swatinem/rust-cache@v2with:- workspaces: src-tauri/${{ matrix.crate }}+ workspaces: src-tauri/${{ matrix.crate }} -> ${{ matrix.target_dir || 'target' }}save-if: ${{ github.ref == 'refs/heads/main' }}- name: Install Tauri dependencies+ if: ${{ !matrix.skip_tauri }}run: |sudo apt updatesudo apt install -y libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev- name: cargo check- run: cargo check --manifest-path src-tauri/${{ matrix.crate }}/Cargo.toml --all-targets+ run: cargo check ${{ matrix.flags }} --manifest-path src-tauri/${{ matrix.crate }}/Cargo.toml --all-targets- name: cargo clippy- run: cargo clippy --manifest-path src-tauri/${{ matrix.crate }}/Cargo.toml --all-targets -- -D warnings+ run: cargo clippy ${{ matrix.flags }} --manifest-path src-tauri/${{ matrix.crate }}/Cargo.toml --all-targets -- -D warnings# The ADKs are clients of the same channel the CLI tests drive, so they are# built and run here rather than in the linter workflow: the subject is a realdiff --git a/Makefile b/Makefileindex 9496c6da1..fd38356d6 100644--- a/Makefile+++ b/Makefile@@ -196,16 +196,21 @@ test-ci: test-prepare# Compile and test guard for the CLI feature set. The `jan` CLI is no longer# bundled with the app; `make test` still builds the real binary via build-cli.#-# This is the only job that compiles jan-cli at all: it is a standalone crate-# and not a dependency of src-tauri, so the rust-check `cli` matrix entry never-# reaches it (that entry's --all-targets covers app_lib's own-# cfg(feature = "cli") test modules, which is a different crate). A bare-# `cargo check` here built the bin but not the #[cfg(test)] module, which is-# how the fixture in `compact_plugin_list_omits_long_metadata` silently rotted.-# `cargo test` builds and runs those targets, so it subsumes that check.+# jan-cli is a standalone crate and not a dependency of src-tauri, so the+# rust-check `cli` app entry never reaches it (that entry's --all-targets covers+# app_lib's own cfg(feature = "cli") test modules, a different crate). This+# target runs its tests; the CI lint guarantee is the jan-cli entry of the+# rust-check `crates` matrix, which `lint-cli` reproduces locally. A bare+# `cargo check` here once built the bin but not the #[cfg(test)] module, which+# is how the fixture in `compact_plugin_list_omits_long_metadata` silently rotted.check-cli:cd src-tauri/jan-cli && cargo test --locked --no-default-features --features cli+# The same clippy invocation as the rust-check `crates` matrix jan-cli entry.+# Kept out of check-cli so the linter workflow does not lint it a second time.+lint-cli:+ cd src-tauri/jan-cli && cargo clippy --locked --no-default-features --features cli --all-targets -- -D warnings+# Build MLX server (macOS Apple Silicon only) - always builds, unless# JAN_MLX_PREBUILT_DIR holds a cached build of the same inputs# (build-utils/mlx-prebuilt.sh), which is then staged and signed the same way