Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
ci: run only the jobs a pull request's changes can affect (#9564)
Akarshan Biswasc20880179cf9
diff --git a/.github/actions/changed-areas/action.yml b/.github/actions/changed-areas/action.ymlnew file mode 100644index 000000000..5b4576ee7--- /dev/null+++ b/.github/actions/changed-areas/action.yml@@ -0,0 +1,62 @@+name: Changed areas+description: >-+ Classify a pull request's changed files into the CI areas they can affect+ (see .github/scripts/changed-areas.sh). Anything that is not a pull request,+ or a pull request whose file list cannot be read, turns every area on.+outputs:+ ts:+ description: lint + vitest+ value: ${{ steps.classify.outputs.ts }}+ mlx:+ description: the macOS-only mlx-extension suite+ value: ${{ steps.classify.outputs.mlx }}+ rust:+ description: the desktop app crate or a plugin+ value: ${{ steps.classify.outputs.rust }}+ cli:+ description: app_lib in the cli feature set+ value: ${{ steps.classify.outputs.cli }}+ jan_cli:+ description: the standalone jan-cli crate+ value: ${{ steps.classify.outputs.jan_cli }}+ adk:+ description: the JavaScript and Python ADKs+ value: ${{ steps.classify.outputs.adk }}+ app:+ description: JSON list of rust-check app configs to lint+ value: ${{ steps.classify.outputs.app }}+ crates:+ description: JSON list of rust-check crates matrix entries to lint+ value: ${{ steps.classify.outputs.crates }}+runs:+ using: composite+ steps:+ - id: classify+ shell: bash+ env:+ GH_TOKEN: ${{ github.token }}+ PR: ${{ github.event.pull_request.number }}+ CHANGED: ${{ github.event.pull_request.changed_files }}+ SCRIPT: ${{ github.action_path }}/../../scripts/changed-areas.sh+ # The files endpoint rather than `gh pr diff`: the diff endpoint refuses+ # large pull requests outright. The list stops at 3000 files without an+ # error, so a list shorter than the PR's changed_files count is treated as+ # unreadable. A rename counts on both sides, so moving a file out of an+ # area still runs it.+ run: |+ files=""+ if [ -n "$PR" ] && list=$(gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PR/files" \+ --jq '.[] | "F\t\(.filename)", (.previous_filename // empty | "P\t\(.)")'); then+ if [ "$(grep -c $'^F\t' <<< "$list")" -ge "${CHANGED:-0}" ]; then+ files=$(cut -f2- <<< "$list")+ else+ echo "file list truncated; running every area"+ fi+ fi+ if [ -n "$files" ]; then+ areas=$(bash "$SCRIPT" <<< "$files")+ else+ areas=$(bash "$SCRIPT" --all)+ fi+ echo "$areas"+ echo "$areas" >> "$GITHUB_OUTPUT"diff --git a/.github/scripts/changed-areas.sh b/.github/scripts/changed-areas.shnew file mode 100644index 000000000..56ae4cdd0--- /dev/null+++ b/.github/scripts/changed-areas.sh@@ -0,0 +1,168 @@+#!/usr/bin/env bash+# Maps a pull request's changed files to the CI areas they can affect, so the+# Linter & Test and Rust Check workflows run only the jobs a change can break.+#+# Reads one path per line on stdin and prints key=value lines for+# $GITHUB_OUTPUT. `--all` ignores stdin and turns everything on: pushes,+# dispatches and an unreadable file list take that path, so a doubt runs more.+#+# ts lint + vitest+# mlx the mlx-extension suite, which vitest only runs on macOS+# rust the desktop app crate or a plugin: Rust suites on three OSes+# cli app_lib as the cli feature set compiles it+# jan_cli the standalone jan-cli crate, which depends on app_lib+# adk the JavaScript and Python ADKs, which drive the jan binary+# app JSON list of rust-check `app` matrix configs to lint+# crates JSON list of rust-check `crates` matrix entries to lint+#+# The fan-out follows the path dependencies in each Cargo.toml: a crate is+# linted when it, or a crate it depends on, changes. app_lib takes utils,+# agent-tools, websearch and vector-db unconditionally; every other plugin is+# desktop-only, so it never reaches the cli feature set or jan-cli.+# Cases: changed-areas.test.sh.+set -euo pipefail++ts=false mlx=false rust=false cli=false jan_cli=false adk=false+declare -A crates=()++all_crates=(+ jan-cli+ plugins/tauri-plugin-agent-tools+ plugins/tauri-plugin-hardware+ plugins/tauri-plugin-llamacpp+ plugins/tauri-plugin-rag+ plugins/tauri-plugin-vector-db+ plugins/tauri-plugin-websearch+ utils+)++everything() {+ ts=true mlx=true rust=true cli=true jan_cli=true adk=true+ local c+ for c in "${all_crates[@]}"; do crates[$c]=1; done+}++# A plugin, and the standalone crates that take it as a path dependency.+# tauri-plugin-mlx is a macOS-only target dependency with no matrix entry, so+# the app crate's own suites are what cover it.+plugin() {+ local name="$1"+ rust=true+ case "$name" in+ tauri-plugin-mlx) ;;+ tauri-plugin-hardware)+ crates[plugins/tauri-plugin-hardware]=1+ crates[plugins/tauri-plugin-llamacpp]=1+ ;;+ tauri-plugin-websearch)+ crates[plugins/tauri-plugin-websearch]=1+ crates[plugins/tauri-plugin-agent-tools]=1+ cli=true+ ;;+ tauri-plugin-agent-tools | tauri-plugin-vector-db)+ crates[plugins/$name]=1+ cli=true+ ;;+ *) crates[plugins/$name]=1 ;;+ esac+}++if [ "${1:-}" = "--all" ]; then+ everything+else+ while IFS= read -r file; do+ [ -n "$file" ] || continue+ case "$file" in+ Makefile | rust-toolchain.toml | \+ .github/workflows/rust-check.yml | .github/workflows/jan-linter-and-test.yml | \+ .github/actions/changed-areas/* | .github/scripts/changed-areas*)+ everything+ ;;+ # test-rust consumes these too: its `make test-ci-rust` runs yarn install,+ # download:bin and build:icon (the Tauri CLI) before the Rust suites.+ package.json | yarn.lock | .yarnrc.yml)+ ts=true mlx=true rust=true adk=true+ ;;+ vitest.config.ts | core/* | extensions/mlx-extension/* | \+ src-tauri/plugins/package.json | src-tauri/plugins/yarn.lock | src-tauri/plugins/.yarnrc.yml)+ ts=true mlx=true+ ;;+ web-app/* | extensions/*)+ ts=true+ ;;+ src-tauri/plugins/*/*)+ name="${file#src-tauri/plugins/}"+ name="${name%%/*}"+ plugin "$name"+ # `make lint` builds every plugin's guest-js, and the llamacpp suite+ # scans all plugin TypeScript for raw invoke calls. llamacpp's lib.rs+ # also include_str!s its guest-js, so that side stays on as well.+ case "${file#src-tauri/plugins/"$name"/}" in+ guest-js/* | package.json | rollup.config.js | tsconfig.json | *.ts | *.tsx)+ ts=true+ case "$name" in+ tauri-plugin-mlx | tauri-plugin-llamacpp) mlx=true ;;+ esac+ ;;+ esac+ ;;+ src-tauri/utils/*)+ rust=true cli=true+ crates[utils]=1+ crates[plugins/tauri-plugin-llamacpp]=1+ ;;+ src-tauri/jan-cli/*)+ jan_cli=true+ ;;+ # tauri-plugin-llamacpp include_str!s fetch-engine-source.sh.+ src-tauri/build-utils/*)+ rust=true+ crates[plugins/tauri-plugin-llamacpp]=1+ ;;+ src-tauri/*)+ rust=true cli=true+ ;;+ # The committed schemas are include_str!ed by core::cli and jan-cli tests.+ protocol/*)+ cli=true+ ;;+ # adk_examples runs every example and checks the docs excerpts quoting them.+ examples/adk/* | docs/src/pages/docs/agent/*)+ jan_cli=true+ ;;+ adk/* | packages/adk/*)+ adk=true+ ;;+ # Everything `make test-ci-rust` runs besides cargo: the resource stubs,+ # the bundled-binary download and the icon build, plus coverage.+ scripts/stub-tauri-resources.mjs | scripts/rust-coverage.sh | \+ scripts/download-bin.mjs | scripts/build-windows-icon.mjs)+ rust=true+ ;;+ esac+ done+fi++[ "$cli" = true ] && jan_cli=true+if [ "$jan_cli" = true ]; then+ crates[jan-cli]=1+ adk=true+fi++json() {+ [ "$#" -gt 0 ] || { echo '[]'; return; }+ printf '%s\n' "$@" | LC_ALL=C sort | sed 's/.*/"&"/' | paste -sd, - | sed 's/.*/[&]/'+}++app=()+[ "$rust" = true ] && app+=(desktop e2e)+[ "$cli" = true ] && app+=(cli)++echo "ts=$ts"+echo "mlx=$mlx"+echo "rust=$rust"+echo "cli=$cli"+echo "jan_cli=$jan_cli"+echo "adk=$adk"+echo "app=$(json ${app[@]+"${app[@]}"})"+echo "crates=$(json ${crates[@]+"${!crates[@]}"})"diff --git a/.github/scripts/changed-areas.test.sh b/.github/scripts/changed-areas.test.shnew file mode 100644index 000000000..b01a8672a--- /dev/null+++ b/.github/scripts/changed-areas.test.sh@@ -0,0 +1,125 @@+#!/usr/bin/env bash+# Cases for changed-areas.sh. Each feeds a file list on stdin and checks the+# outputs that matter for it. Run: bash .github/scripts/changed-areas.test.sh+set -euo pipefail++script="$(dirname "$0")/changed-areas.sh"+failures=0++check() {+ local name="$1" out="$2"+ shift 2+ local want+ for want in "$@"; do+ if ! grep -qxF -- "$want" <<< "$out"; then+ echo "FAIL $name: want $want, got:"+ sed 's/^/ /' <<< "$out"+ failures=$((failures + 1))+ fi+ done+}++# expect <name> <files, newline-separated> <key=value>...+expect() {+ local name="$1" files="$2"+ shift 2+ check "$name" "$(printf '%s\n' "$files" | bash "$script")" "$@"+}++none='crates=[]'+all_crates='crates=["jan-cli","plugins/tauri-plugin-agent-tools","plugins/tauri-plugin-hardware","plugins/tauri-plugin-llamacpp","plugins/tauri-plugin-rag","plugins/tauri-plugin-vector-db","plugins/tauri-plugin-websearch","utils"]'+all_app='app=["cli","desktop","e2e"]'++expect 'web-app only' 'web-app/src/routes/index.tsx' \+ ts=true mlx=false rust=false cli=false jan_cli=false adk=false 'app=[]' "$none"++expect 'core reaches mlx-extension' 'core/src/index.ts' ts=true mlx=true rust=false++expect 'mlx-extension' 'extensions/mlx-extension/src/index.ts' ts=true mlx=true rust=false++# jan-cli depends on app_lib, so an app change lints and tests it too.+expect 'app crate source' 'src-tauri/src/core/agent/context.rs' \+ ts=false rust=true cli=true jan_cli=true adk=true "$all_app" 'crates=["jan-cli"]'++expect 'jan-cli only' 'src-tauri/jan-cli/src/main.rs' \+ ts=false rust=false cli=false jan_cli=true adk=true 'app=[]' 'crates=["jan-cli"]'++expect 'plugin guest-js' 'src-tauri/plugins/tauri-plugin-llamacpp/guest-js/index.ts' \+ ts=true mlx=true rust=true cli=false 'app=["desktop","e2e"]' 'crates=["plugins/tauri-plugin-llamacpp"]'++# The raw-invoke guard scans every .ts/.tsx under src-tauri/plugins.+expect 'plugin TypeScript outside guest-js' 'src-tauri/plugins/tauri-plugin-rag/scripts/gen.ts' \+ ts=true rust=true++expect 'plugin Rust source is not TS' 'src-tauri/plugins/tauri-plugin-rag/src/lib.rs' \+ ts=false rust=true cli=false jan_cli=false adk=false 'crates=["plugins/tauri-plugin-rag"]'++expect 'utils fans out to its dependents' 'src-tauri/utils/src/lib.rs' \+ rust=true cli=true 'crates=["jan-cli","plugins/tauri-plugin-llamacpp","utils"]'++expect 'hardware is desktop-only' 'src-tauri/plugins/tauri-plugin-hardware/src/lib.rs' \+ rust=true cli=false jan_cli=false adk=false 'app=["desktop","e2e"]' \+ 'crates=["plugins/tauri-plugin-hardware","plugins/tauri-plugin-llamacpp"]'++expect 'websearch reaches agent-tools and the CLI' 'src-tauri/plugins/tauri-plugin-websearch/src/lib.rs' \+ rust=true cli=true jan_cli=true "$all_app" \+ 'crates=["jan-cli","plugins/tauri-plugin-agent-tools","plugins/tauri-plugin-websearch"]'++expect 'agent-tools reaches the CLI' 'src-tauri/plugins/tauri-plugin-agent-tools/src/lib.rs' \+ cli=true 'crates=["jan-cli","plugins/tauri-plugin-agent-tools"]'++expect 'mlx plugin has no matrix entry' 'src-tauri/plugins/tauri-plugin-mlx/src/lib.rs' \+ rust=true cli=false "$none"++expect 'build-utils reach llamacpp' 'src-tauri/build-utils/fetch-engine-source.sh' \+ rust=true cli=false 'crates=["plugins/tauri-plugin-llamacpp"]'++expect 'committed protocol schema' 'protocol/schema.json' \+ ts=false rust=false cli=true jan_cli=true adk=true 'app=["cli"]'++expect 'ADK cookbook page' 'docs/src/pages/docs/agent/adk.mdx' \+ rust=false cli=false jan_cli=true 'app=[]' 'crates=["jan-cli"]'++expect 'ADK example' 'examples/adk/hello.mjs' rust=false jan_cli=true++expect 'docs site' 'docs/src/pages/index.mdx' \+ ts=false mlx=false rust=false cli=false jan_cli=false adk=false 'app=[]' "$none"++expect 'unknown top-level file runs nothing' 'README.md' \+ ts=false rust=false jan_cli=false adk=false "$none"++expect 'JS ADK package' 'packages/adk/src/index.mjs' ts=false rust=false jan_cli=false adk=true++expect 'Python ADK' 'adk/python/jan/client.py' ts=false adk=true++# test-rust's asset step runs yarn install and the Tauri CLI, so the lockfile+# reaches it; the app clippy configs follow rust as well.+expect 'lockfile reaches TS, ADK and test-rust' 'yarn.lock' ts=true mlx=true rust=true adk=true++expect 'download-bin feeds test-rust' 'scripts/download-bin.mjs' ts=false rust=true++expect 'windows icon build feeds test-rust' 'scripts/build-windows-icon.mjs' ts=false rust=true++expect 'stub script feeds the Rust build' 'scripts/stub-tauri-resources.mjs' ts=false rust=true++for shared in Makefile rust-toolchain.toml .github/workflows/rust-check.yml \+ .github/workflows/jan-linter-and-test.yml .github/scripts/changed-areas.sh \+ .github/actions/changed-areas/action.yml; do+ expect "shared: $shared" "$shared" \+ ts=true mlx=true rust=true cli=true jan_cli=true adk=true "$all_app" "$all_crates"+done++# What a push, a dispatch or an unreadable file list gets.+check '--all' "$(bash "$script" --all < /dev/null)" \+ ts=true mlx=true rust=true cli=true jan_cli=true adk=true "$all_app" "$all_crates"++expect 'mixed PR unions its areas' "$(printf '%s\n' web-app/src/a.ts src-tauri/plugins/tauri-plugin-rag/src/lib.rs)" \+ ts=true rust=true cli=false 'crates=["plugins/tauri-plugin-rag"]'++expect 'empty list runs nothing' '' ts=false rust=false adk=false 'app=[]' "$none"++if [ "$failures" -ne 0 ]; then+ echo "$failures failure(s)"+ exit 1+fi+echo "changed-areas: all cases pass"diff --git a/.github/workflows/jan-linter-and-test.yml b/.github/workflows/jan-linter-and-test.ymlindex b632c3727..7ea54b539 100644--- a/.github/workflows/jan-linter-and-test.yml+++ b/.github/workflows/jan-linter-and-test.yml@@ -6,6 +6,14 @@ on:- mainpaths:- .github/workflows/jan-linter-and-test.yml+ - '.github/actions/changed-areas/**'+ - '.github/scripts/changed-areas*'+ - 'vitest.config.ts'+ - 'rust-toolchain.toml'+ - 'scripts/stub-tauri-resources.mjs'+ - 'scripts/rust-coverage.sh'+ - 'scripts/download-bin.mjs'+ - 'scripts/build-windows-icon.mjs'- 'package.json'- 'yarn.lock'- 'core/**'@@ -14,19 +22,14 @@ on:- 'src-tauri/**'- 'web-app/**'+ # No paths filter on pull requests: a workflow a filter skips never reports,+ # so its required ci-ok check would sit pending and block the merge. The+ # changes job does the filtering instead, and a PR that reaches no area runs+ # only that job and ci-ok.pull_request:branches:- main- release/**- paths:- - .github/workflows/jan-linter-and-test.yml- - 'package.json'- - 'yarn.lock'- - 'Makefile'- - 'extensions/**'- - 'core/**'- - 'src-tauri/**'- - 'web-app/**'concurrency:group: linter-test-${{ github.ref }}@@ -34,7 +37,10 @@ concurrency:jobs:base_branch_cov:- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository+ needs: changes+ if: >-+ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository+ && (needs.changes.outputs.ts == 'true' || needs.changes.outputs.rust == 'true')runs-on: ubuntu-latestcontinue-on-error: truesteps:@@ -46,12 +52,6 @@ jobs:with:node-version: 20- - name: 'Cleanup cache'- continue-on-error: true- run: |- rm -rf ~/jan- make clean-- name: Config Yarnrun: |corepack enable@@ -74,7 +74,10 @@ jobs:path: coverage/lcov.infobase_branch_rust_cov:- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository+ needs: changes+ if: >-+ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository+ && needs.changes.outputs.rust == 'true'runs-on: ubuntu-latestcontinue-on-error: truesteps:@@ -127,9 +130,27 @@ jobs:name: ref-rust-lcov.infopath: rust-lcov.info- test-on-macos:- runs-on: 'macos-latest'- if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'+ # Classifies the PR's files (.github/scripts/changed-areas.sh); every job+ # below runs only for the areas it tests. Pushes and dispatches run all.+ changes:+ runs-on: ubuntu-latest+ outputs:+ ts: ${{ steps.areas.outputs.ts }}+ mlx: ${{ steps.areas.outputs.mlx }}+ rust: ${{ steps.areas.outputs.rust }}+ steps:+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6+ with:+ sparse-checkout: .github+ - id: areas+ uses: ./.github/actions/changed-areas++ # Lint and vitest are platform-independent, so they run once, on Linux. The+ # one exception is the mlx-extension suite, which the next job covers.+ test-ts:+ needs: changes+ if: needs.changes.outputs.ts == 'true'+ runs-on: ubuntu-lateststeps:- name: Getting the repouses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -139,12 +160,6 @@ jobs:with:node-version: 20- - name: 'Cleanup cache'- continue-on-error: true- run: |- rm -rf ~/jan- make clean-- name: Config Yarnrun: |corepack enable@@ -152,22 +167,15 @@ jobs:yarn --versionyarn config set -H enableImmutableInstalls false- - name: Set up Xcode version- run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer-- name: Linter and test- run: |- make test-ci- env:- CSC_IDENTITY_AUTO_DISCOVERY: 'false'+ run: make test-ts- test-on-windows:- if: github.event_name == 'push'- strategy:- fail-fast: false- matrix:- antivirus-tools: ['mcafee', 'bit-defender']- runs-on: windows-desktop-${{ matrix.antivirus-tools }}+ # vitest.config.ts includes extensions/mlx-extension only on macOS: its+ # plugin API resolves nowhere else.+ test-mlx-extension:+ needs: changes+ if: needs.changes.outputs.mlx == 'true'+ runs-on: 'macos-latest'steps:- name: Getting the repouses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -177,19 +185,6 @@ jobs:with:node-version: 20- # Clean cache, continue on error- - name: 'Cleanup cache'- shell: powershell- continue-on-error: true- run: |- $path = "$Env:APPDATA\jan"- if (Test-Path $path) {- Remove-Item "\\?\$path" -Recurse -Force- } else {- Write-Output "Folder does not exist."- }- make clean-- name: Config Yarnrun: |corepack enable@@ -197,38 +192,76 @@ jobs:yarn --versionyarn config set -H enableImmutableInstalls false- - name: Linter and test- shell: powershell+ - name: Test the mlx extensionrun: |- make test-- test-on-windows-pr:- if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'- runs-on: 'windows-latest'+ make install-and-build+ yarn vitest run --project @janhq/mlx-extension++ # The Rust suites do depend on the platform (the shell sandbox, paths, the+ # Windows resource compiler), so they keep all three.+ test-rust:+ needs: changes+ if: needs.changes.outputs.rust == 'true'+ env:+ # No debuginfo in test builds: it is most of the target dir's size (and+ # so of the cache), and a failing test still reports file and line, which+ # come from the panic location rather than debuginfo.+ CARGO_PROFILE_DEV_DEBUG: 0+ CARGO_PROFILE_TEST_DEBUG: 0+ strategy:+ fail-fast: false+ matrix:+ os: [ubuntu-latest, macos-latest, windows-latest]+ runs-on: ${{ matrix.os }}steps:- name: Getting the repouses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6- - name: install dependencies- run: |- choco install --yes --no-progress make+ - name: Install make+ if: runner.os == 'Windows'+ run: choco install --yes --no-progress make- name: Installing nodeuses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4with:node-version: 20- - name: 'Cleanup cache'- shell: powershell- continue-on-error: true+ - name: Install Tauri dependencies+ if: runner.os == 'Linux'run: |- $path = "$Env:APPDATA\jan"- if (Test-Path $path) {- Remove-Item "\\?\$path" -Recurse -Force- } else {- Write-Output "Folder does not exist."- }- make clean+ sudo apt update+ sudo 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 libfuse2 webkit2gtk-driver++ # The agent-tools unit tests run the shell tool inside its Linux sandbox,+ # bubblewrap, which needs unprivileged user namespaces; Ubuntu 24.04's+ # AppArmor default refuses those.+ - name: Install the shell sandbox+ if: runner.os == 'Linux'+ run: |+ sudo apt install -y bubblewrap+ sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0++ - name: Set up Xcode version+ if: runner.os == 'macOS'+ run: sudo xcode-select -s /Applications/Xcode_26.2.app/Contents/Developer++ # Linux only, and saved only on main: the repo's 10GB cache cap already+ # holds rust-check's caches, and a pull request's own cache is readable+ # by nothing but that pull request, so saving per PR only evicts main's.+ # macOS and Windows build cold; they run only when Rust changed.+ # The workspaces are the five `make test-rust` builds, each its own+ # target dir (the plugins and utils are standalone crates).+ - uses: Swatinem/rust-cache@v2+ if: runner.os == 'Linux'+ with:+ workspaces: |+ src-tauri+ src-tauri/plugins/tauri-plugin-hardware+ src-tauri/plugins/tauri-plugin-llamacpp+ src-tauri/plugins/tauri-plugin-agent-tools+ src-tauri/utils+ shared-key: test-rust+ save-if: ${{ github.ref == 'refs/heads/main' }}- name: Config Yarnrun: |@@ -237,16 +270,50 @@ jobs:yarn --versionyarn config set -H enableImmutableInstalls false- - name: Linter and test- shell: powershell+ - name: Rust tests+ if: runner.os == 'Linux'run: |- make test-ci+ export DISPLAY=$(w -h | awk 'NR==1 {print $2}')+ make test-ci-rust++ - name: Rust tests+ if: runner.os == 'macOS'+ run: make test-ci-rustenv:- NODE_OPTIONS: '--max-old-space-size=2048'+ CSC_IDENTITY_AUTO_DISCOVERY: 'false'- test-on-ubuntu:+ - name: Rust tests+ if: runner.os == 'Windows'+ shell: powershell+ run: make test-ci-rust++ # The one check to mark required, for the reason given on rust-check's ci-ok:+ # the jobs above report "skipped" when a PR does not reach them.+ ci-ok:+ name: Linter & Test passed+ if: always()+ needs: [changes, test-ts, test-mlx-extension, test-rust]runs-on: ubuntu-latest- if: github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'+ steps:+ - name: Fail on a failed or cancelled job+ env:+ RESULTS: ${{ join(needs.*.result, ' ') }}+ run: |+ echo "results: $RESULTS"+ for r in $RESULTS; do+ case "$r" in+ success | skipped) ;;+ *) exit 1 ;;+ esac+ done++ test-on-windows:+ if: github.event_name == 'push'+ strategy:+ fail-fast: false+ matrix:+ antivirus-tools: ['mcafee', 'bit-defender']+ runs-on: windows-desktop-${{ matrix.antivirus-tools }}steps:- name: Getting the repouses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -256,23 +323,17 @@ jobs:with:node-version: 20- - name: Install Tauri dependencies- run: |- sudo apt update- sudo 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 libfuse2 webkit2gtk-driver-- # The agent-tools unit tests run the shell tool inside its Linux sandbox,- # bubblewrap, which needs unprivileged user namespaces; Ubuntu 24.04's- # AppArmor default refuses those.- - name: Install the shell sandbox- run: |- sudo apt install -y bubblewrap- sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0-+ # Clean cache, continue on error- name: 'Cleanup cache'+ shell: powershellcontinue-on-error: truerun: |- rm -rf ~/jan+ $path = "$Env:APPDATA\jan"+ if (Test-Path $path) {+ Remove-Item "\\?\$path" -Recurse -Force+ } else {+ Write-Output "Folder does not exist."+ }make clean- name: Config Yarn@@ -283,16 +344,19 @@ jobs:yarn config set -H enableImmutableInstalls false- name: Linter and test+ shell: powershellrun: |- export DISPLAY=$(w -h | awk 'NR==1 {print $2}')- echo -e "Display ID: $DISPLAY"- make test-ci- make check-cli+ make test+ # A PR that touches no Rust skips Rust coverage on both sides, so the+ # comparison stays like for like (TS only); the merge step below already+ # falls back to TS-only when the base Rust report is missing.coverage-check:- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository+ if: >-+ !cancelled() && needs.base_branch_cov.result == 'success'+ && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repositoryruns-on: ubuntu-latest- needs: [base_branch_cov, base_branch_rust_cov]+ needs: [changes, base_branch_cov, base_branch_rust_cov]continue-on-error: truesteps:- name: Getting the repo@@ -302,12 +366,6 @@ jobs:uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4with:node-version: 20- - name: 'Cleanup cache'- continue-on-error: true- run: |- rm -rf ~/jan- make clean-- name: Config Yarnrun: |corepack enable@@ -324,19 +382,26 @@ jobs:yarn test:coverage- name: Install Tauri dependencies+ if: needs.changes.outputs.rust == 'true'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: Install cargo-llvm-cov+ if: needs.changes.outputs.rust == 'true'uses: taiki-e/install-action@9e57365e36de1e26dea5145e57d471261468d9f7 # cargo-llvm-cov- name: Run Rust test coverage+ if: needs.changes.outputs.rust == 'true'run: ./scripts/rust-coverage.sh- name: Merge coverage reportsrun: |- cat ./coverage/lcov.info rust-lcov.info > merged-lcov.info+ if [ -f rust-lcov.info ]; then+ cat ./coverage/lcov.info rust-lcov.info > merged-lcov.info+ else+ cp ./coverage/lcov.info merged-lcov.info+ fi- name: Download code coverage report from base branchuses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4@@ -345,6 +410,7 @@ jobs:- name: Download Rust code coverage report from base branchid: download-rust-cov+ if: needs.changes.outputs.rust == 'true'continue-on-error: trueuses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4with:diff --git a/.github/workflows/jan-tauri-build-nightly-external.yaml b/.github/workflows/jan-tauri-build-nightly-external.yamlindex 84c4a914c..212172e3e 100644--- a/.github/workflows/jan-tauri-build-nightly-external.yaml+++ b/.github/workflows/jan-tauri-build-nightly-external.yaml@@ -2,6 +2,11 @@ name: Tauri Builder - Nightly / External PRson:pull_request:+ # Desktop builds run on a pull request only while it carries the+ # `ci:build` label (36-50 min across four platforms). `labeled` makes adding+ # the label start a build; with the label on, every push rebuilds. Adding+ # any other label builds nothing (the job conditions check which label).+ types: [opened, synchronize, reopened, labeled]branches:- mainpaths:@@ -17,16 +22,19 @@ on:- 'package.json'concurrency:- group: nightly-external-${{ github.ref }}+ # Adding some other label to a PR that carries `ci:build` fires `labeled`+ # too. That run builds nothing, so it gets a group of its own rather than+ # cancelling the build in progress.+ group: nightly-external-${{ github.ref }}${{ github.event.action == 'labeled' && github.event.label.name != 'ci:build' && format('-{0}', github.run_id) || '' }}cancel-in-progress: truejobs:get-update-version:- if: github.event.pull_request.head.repo.full_name != github.repository+ if: github.event.pull_request.head.repo.full_name != github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build')uses: ./.github/workflows/template-get-update-version.ymlbuild-macos:- if: github.event.pull_request.head.repo.full_name != github.repository+ if: github.event.pull_request.head.repo.full_name != github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build')uses: ./.github/workflows/template-tauri-build-macos-external.ymlneeds: [get-update-version]with:@@ -35,7 +43,7 @@ jobs:channel: nightlybuild-windows-x64:- if: github.event.pull_request.head.repo.full_name != github.repository+ if: github.event.pull_request.head.repo.full_name != github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build')uses: ./.github/workflows/template-tauri-build-windows-x64-external.ymlneeds: [get-update-version]with:@@ -44,7 +52,7 @@ jobs:channel: nightlybuild-linux-x64:- if: github.event.pull_request.head.repo.full_name != github.repository+ if: github.event.pull_request.head.repo.full_name != github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build')uses: ./.github/workflows/template-tauri-build-linux-x64-external.ymlneeds: [get-update-version]with:diff --git a/.github/workflows/jan-tauri-build-nightly.yaml b/.github/workflows/jan-tauri-build-nightly.yamlindex f4ac8bafa..13df1f009 100644--- a/.github/workflows/jan-tauri-build-nightly.yaml+++ b/.github/workflows/jan-tauri-build-nightly.yaml@@ -17,6 +17,11 @@ on:description: 'If true, builds both .deb and .appimage but disables auto-updater'default: falsepull_request:+ # Desktop builds run on a pull request only while it carries the+ # `ci:build` label (36-50 min across four platforms). `labeled` makes adding+ # the label start a build; with the label on, every push rebuilds. Adding+ # any other label builds nothing (the job conditions check which label).+ types: [opened, synchronize, reopened, labeled]branches:- release/**- main@@ -39,13 +44,16 @@ on:concurrency:- group: nightly-${{ github.ref }}+ # Adding some other label to a PR that carries `ci:build` fires `labeled`+ # too. That run builds nothing, so it gets a group of its own rather than+ # cancelling the build in progress.+ group: nightly-${{ github.ref }}${{ github.event.action == 'labeled' && github.event.label.name != 'ci:build' && format('-{0}', github.run_id) || '' }}cancel-in-progress: truejobs:set-public-provider:runs-on: ubuntu-latest- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository+ if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build'))outputs:public_provider: ${{ steps.set-public-provider.outputs.public_provider }}ref: ${{ steps.set-public-provider.outputs.ref }}@@ -73,13 +81,13 @@ jobs:fi# Job create Update app version based on latest release tag with build number and save to outputget-update-version:- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository+ if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build'))uses: ./.github/workflows/template-get-update-version.ymlbuild-macos:uses: ./.github/workflows/template-tauri-build-macos.ymlneeds: [get-update-version, set-public-provider]- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository+ if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build'))secrets: inheritwith:ref: ${{ needs.set-public-provider.outputs.ref }}@@ -94,7 +102,7 @@ jobs:uses: ./.github/workflows/template-tauri-build-windows-x64.ymlsecrets: inheritneeds: [get-update-version, set-public-provider]- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository+ if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build'))with:ref: ${{ needs.set-public-provider.outputs.ref }}public_provider: ${{ needs.set-public-provider.outputs.public_provider }}@@ -106,7 +114,7 @@ jobs:uses: ./.github/workflows/template-tauri-build-linux-x64.ymlsecrets: inheritneeds: [get-update-version, set-public-provider]- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository+ if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build'))with:ref: ${{ needs.set-public-provider.outputs.ref }}public_provider: ${{ needs.set-public-provider.outputs.public_provider }}@@ -119,7 +127,7 @@ jobs:uses: ./.github/workflows/template-tauri-build-windows-arm64.ymlsecrets: inheritneeds: [get-update-version, set-public-provider]- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository+ if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build'))with:ref: ${{ needs.set-public-provider.outputs.ref }}public_provider: ${{ needs.set-public-provider.outputs.public_provider }}@@ -154,7 +162,7 @@ jobs:&& needs.build-windows-x64.result == 'success'&& needs.build-linux-x64.result == 'success'&& needs.build-macos.result == 'success'- && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)+ && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'ci:build') && (github.event.action != 'labeled' || github.event.label.name == 'ci:build')))steps:- name: Getting the repouses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6diff --git a/.github/workflows/rust-check.yml b/.github/workflows/rust-check.ymlindex ee7f2a3cf..c64cc8a9b 100644--- a/.github/workflows/rust-check.yml+++ b/.github/workflows/rust-check.yml@@ -11,18 +11,9 @@ on:branches:- main- dev- # Skip PRs that only touch the docs site, top-level markdown or GitHub- # templates. Two things stay in: markdown elsewhere (crates include_str!- # some of it) and docs/src/pages/docs/agent, whose fenced excerpts the- # adk_examples test checks against examples/adk. Later patterns override- # earlier ones, so the agent pages are re-included after docs/** is dropped.- paths:- - '**'- - '!docs/**'- - 'docs/src/pages/docs/agent/**'- - '!*.md'- - '!.github/ISSUE_TEMPLATE/**'- - '!.github/pull_request_template.md'+ # No paths filter: a workflow a filter skips never reports, so the required+ # ci-ok check would sit pending and block the merge. The changes job skips+ # the jobs a PR cannot affect instead (docs, top-level markdown, templates).concurrency:group: rust-check-${{ github.ref }}@@ -30,36 +21,64 @@ concurrency:env:CARGO_TERM_COLOR: always+ # No debuginfo: it is most of a debug target dir, and so of every cache+ # below, against the repo's 10GB cap. Failing tests still report file and+ # line (from the panic location, not debuginfo). rust-cache hashes CARGO*+ # variables into its key, so this starts one fresh, smaller set on main.+ CARGO_PROFILE_DEV_DEBUG: 0+ CARGO_PROFILE_TEST_DEBUG: 0jobs:+ # Classifies the PR's files (.github/scripts/changed-areas.sh) so each job+ # below runs only when something it compiles changed. Pushes, dispatches and+ # an unreadable file list run everything.+ changes:+ name: changed areas+ runs-on: ubuntu-latest+ outputs:+ rust: ${{ steps.areas.outputs.rust }}+ cli: ${{ steps.areas.outputs.cli }}+ jan_cli: ${{ steps.areas.outputs.jan_cli }}+ adk: ${{ steps.areas.outputs.adk }}+ app: ${{ steps.areas.outputs.app }}+ crates: ${{ steps.areas.outputs.crates }}+ steps:+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6+ with:+ sparse-checkout: .github+ - id: areas+ uses: ./.github/actions/changed-areas+ - name: Self-test the classifier+ run: bash .github/scripts/changed-areas.test.sh+# The desktop and CLI feature sets are mutually exclusive configs of the same- # crate, so neither one alone proves the other compiles.+ # crate, so neither one alone proves the other compiles. A change reaching+ # only desktop code (a desktop-only plugin) skips the cli config, and one+ # reaching only the cli surface (protocol/) skips the two desktop ones; any+ # change to app_lib itself runs all three.app:name: app (${{ matrix.name }})+ needs: changes+ if: needs.changes.outputs.app != '[]'runs-on: ubuntu-lateststrategy:fail-fast: falsematrix:- include:- - name: desktop- features: test-tauri- targets: --all-targets- tauri: true- # --all-targets matters here: modules like core::agent::global_config- # are #[cfg(feature = "cli")], so their tests exist in no other config- # and --lib --bins would leave them unlinted.- - name: cli- features: cli- targets: --all-targets- tauri: false- # The e2e feature gates the embedded WebDriver server and turns off- # single-instance. No other matrix entry compiles that code, so- # without this the cfg block silently bit-rots. This only type-checks- # the gate; it does not run the e2e suite.- - name: e2e- features: test-tauri,e2e- targets: --all-targets- tauri: true+ # The configs' properties are looked up by name below rather than+ # listed under `include`: an include entry naming a config the+ # classifier left out would add that config back as a new job.+ name: ${{ fromJSON(needs.changes.outputs.app) }}+ env:+ # desktop: the app as it ships.+ # cli: --all-targets matters here: modules like core::agent::global_config+ # are #[cfg(feature = "cli")], so their tests exist in no other config+ # and --lib --bins would leave them unlinted.+ # e2e: the e2e feature gates the embedded WebDriver server and turns off+ # single-instance. No other config compiles that code, so without this+ # the cfg block silently bit-rots. This only type-checks the gate; it+ # does not run the e2e suite.+ FEATURES: ${{ fromJSON('{"desktop":"test-tauri","cli":"cli","e2e":"test-tauri,e2e"}')[matrix.name] }}+ TAURI: ${{ matrix.name != 'cli' }}steps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -76,24 +95,24 @@ jobs:save-if: ${{ github.ref == 'refs/heads/main' }}- name: Install Tauri dependencies- if: matrix.tauri+ if: env.TAURI == 'true'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: Create Tauri resource stubs- if: matrix.tauri+ if: env.TAURI == 'true'run: node scripts/stub-tauri-resources.mjs- name: cargo checkrun: |cargo check --locked --manifest-path src-tauri/Cargo.toml \- --no-default-features --features ${{ matrix.features }} ${{ matrix.targets }}+ --no-default-features --features "$FEATURES" --all-targets- name: cargo clippyrun: |cargo clippy --locked --manifest-path src-tauri/Cargo.toml \- --no-default-features --features ${{ matrix.features }} ${{ matrix.targets }} \+ --no-default-features --features "$FEATURES" --all-targets \-- -D warnings# `cargo check` and `clippy --all-targets` compile the tests but never run@@ -105,6 +124,8 @@ jobs:# among these tests.test:name: cargo test (cli)+ needs: changes+ if: needs.changes.outputs.jan_cli == 'true'runs-on: ubuntu-lateststeps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -114,9 +135,13 @@ jobs:- uses: Swatinem/rust-cache@v2with:workspaces: src-tauri- key: test-cli- # Branches restore but never save: one 3.5GB cache set on main- # rather than one per branch, which is what breached the 10GB cap.+ # One cache for the three jobs that build the jan binary in the cli+ # feature set (this one, schema, adk): their target dirs are the same+ # debug build, so separate keys stored it three times. Only this job,+ # which builds the most of it, saves.+ shared-key: jan-cli+ # Branches restore but never save: one cache set on main rather than+ # one per branch, which is what breached the 10GB cap.save-if: ${{ github.ref == 'refs/heads/main' }}# The plugin-install tests build fixture repositories and commit in@@ -126,34 +151,29 @@ jobs:git config --global user.email "[email protected]"git config --global user.name "Jan CI"+ # The Linux shell sandbox, which the agent tests reach.+ - name: Install the shell sandbox+ run: |+ sudo apt update+ sudo apt install -y bubblewrap+ sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0+# One thread: a few tests set process-wide state (env vars, the global- # config), and the same convention is what `make test-rust` uses.+ # config), and the same convention is what `make test-rust` uses. A+ # change that reaches only jan-cli or the ADK examples skips it.- name: cargo test+ if: needs.changes.outputs.cli == 'true'run: |cargo test --locked --manifest-path src-tauri/Cargo.toml \--no-default-features --features cli --lib -- --test-threads=1- # The standalone CLI is not a workspace member. Its binary-level RPC- # tests are not run by the app library command above.- - name: cargo test (RPC CLI)- run: |- cargo test --locked --manifest-path src-tauri/jan-cli/Cargo.toml \- --no-default-features --features cli --test agent_rpc-- # The experimental ACP server (`jan acp`), driven over stdio the way an- # editor drives it, against a stub provider.- - name: cargo test (ACP CLI)- run: |- cargo test --locked --manifest-path src-tauri/jan-cli/Cargo.toml \- --no-default-features --features cli --test acp-- # The ADK cookbook's runnable source, run with the runner's own- # node and python3 against the jan binary this commit builds, plus the- # check that every docs excerpt still matches the file it quotes.- - name: cargo test (ADK examples)- run: |- cargo test --locked --manifest-path src-tauri/jan-cli/Cargo.toml \- --no-default-features --features cli --test adk_examples+ # The standalone CLI is not a workspace member, so the command above never+ # reaches it. This is its whole suite (`make check-cli`): the binary-level+ # RPC and ACP tests, stream-json, the TUI, telemetry, and adk_examples,+ # which runs the ADK cookbook's source with the runner's own node and+ # python3 and checks every docs excerpt still matches the file it quotes.+ - name: cargo test (jan-cli)+ run: make check-cli# `jan --version` on a build without JAN_CLI_BUILD_VERSION reports the# committed app version, so a bump that skips jan-cli or tauri.conf.json@@ -209,6 +229,8 @@ jobs:# command a human would, in the CLI's own feature set, and prints the diff.schema:name: protocol schema+ needs: changes+ if: needs.changes.outputs.cli == 'true'runs-on: ubuntu-lateststeps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -218,10 +240,9 @@ jobs:- uses: Swatinem/rust-cache@v2with:workspaces: src-tauri- key: protocol-schema- # Branches restore but never save: one 3.5GB cache set on main- # rather than one per branch, which is what breached the 10GB cap.- save-if: ${{ github.ref == 'refs/heads/main' }}+ # Restores the `test` job's cache; see the note there.+ shared-key: jan-cli+ save-if: false# --locked: the generated document is a function of the locked schemars,# so the only thing that may move it is a commit.@@ -267,28 +288,25 @@ jobs:# 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.+ #+ # The crate list comes from the classifier: a crate is linted when it or a+ # path dependency of it changed. tauri-plugin-mlx is Apple-Silicon-only and+ # a macOS target dependency, not part of any Linux build, so it has no entry.crates:name: ${{ matrix.crate }}+ needs: changes+ if: needs.changes.outputs.crates != '[]'runs-on: ubuntu-lateststrategy:fail-fast: falsematrix:- # 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- - plugins/tauri-plugin-rag- - 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: true+ crate: ${{ fromJSON(needs.changes.outputs.crates) }}+ # jan-cli's differences are keyed on its name, not an `include` entry, for+ # the reason given on the app matrix.+ env:+ FLAGS: ${{ matrix.crate == 'jan-cli' && '--locked --no-default-features --features cli' || '' }}+ TARGET_DIR: ${{ matrix.crate == 'jan-cli' && '../target' || 'target' }}+ SKIP_TAURI: ${{ matrix.crate == 'jan-cli' }}steps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -298,53 +316,30 @@ jobs:- uses: Swatinem/rust-cache@v2with:- workspaces: src-tauri/${{ matrix.crate }} -> ${{ matrix.target_dir || 'target' }}+ workspaces: src-tauri/${{ matrix.crate }} -> ${{ env.TARGET_DIR }}save-if: ${{ github.ref == 'refs/heads/main' }}- name: Install Tauri dependencies- if: ${{ !matrix.skip_tauri }}+ if: env.SKIP_TAURI != 'true'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 ${{ matrix.flags }} --manifest-path src-tauri/${{ matrix.crate }}/Cargo.toml --all-targets+ run: cargo check $FLAGS --manifest-path src-tauri/${{ matrix.crate }}/Cargo.toml --all-targets- name: cargo clippy- run: cargo clippy ${{ matrix.flags }} --manifest-path src-tauri/${{ matrix.crate }}/Cargo.toml --all-targets -- -D warnings+ run: cargo clippy $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 real# runtime binary, and a client that only agreed with itself would pass. The# committed wire types are checked against protocol/rpc-schema.json in the# same job, since that document is what generates them.- adk-changes:- name: ADK paths- runs-on: ubuntu-latest- outputs:- run: ${{ steps.filter.outputs.run }}- steps:- # A PR that touches nothing the ADKs build from skips the job's ~5 minute- # runtime build. Pushes, dispatches and an unreadable file list run it.- - id: filter- env:- GH_TOKEN: ${{ github.token }}- PR: ${{ github.event.pull_request.number }}- run: |- if [ -z "$PR" ] || ! files=$(gh pr diff "$PR" --repo "$GITHUB_REPOSITORY" --name-only); then- echo "run=true" >> "$GITHUB_OUTPUT"- exit 0- fi- if grep -qE '^(src-tauri/|adk/|packages/adk/|protocol/|package\.json$|yarn\.lock$|\.github/workflows/rust-check\.yml$)' <<< "$files"; then- echo "run=true" >> "$GITHUB_OUTPUT"- else- echo "run=false" >> "$GITHUB_OUTPUT"- fi-adk:name: ADKs- needs: adk-changes- if: needs.adk-changes.outputs.run == 'true'+ needs: changes+ if: needs.changes.outputs.adk == 'true'runs-on: ubuntu-lateststeps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6@@ -354,8 +349,9 @@ jobs:- uses: Swatinem/rust-cache@v2with:workspaces: src-tauri- key: adk- save-if: ${{ github.ref == 'refs/heads/main' }}+ # Restores the `test` job's cache; see the note there.+ shared-key: jan-cli+ save-if: false- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4with:@@ -388,3 +384,25 @@ jobs:run: |env -i PATH="$(dirname "$JAN_BIN"):/usr/bin:/bin" HOME="$HOME" \JAN_BIN="$JAN_BIN" python3 -m unittest discover -s adk/python/tests -t adk/python++ # The one check to mark required. Path-gated jobs report "skipped" when a PR+ # does not reach them, and a required check that never reports blocks the+ # merge; this job always reports, and fails only on a real failure or+ # cancellation among the jobs it waits for.+ ci-ok:+ name: Rust Check passed+ if: always()+ needs: [changes, app, test, versions, schema, crates, adk]+ runs-on: ubuntu-latest+ steps:+ - name: Fail on a failed or cancelled job+ env:+ RESULTS: ${{ join(needs.*.result, ' ') }}+ run: |+ echo "results: $RESULTS"+ for r in $RESULTS; do+ case "$r" in+ success | skipped) ;;+ *) exit 1 ;;+ esac+ donediff --git a/.github/workflows/template-tauri-build-windows-arm64.yml b/.github/workflows/template-tauri-build-windows-arm64.ymlindex 367277daa..6202ab8cb 100644--- a/.github/workflows/template-tauri-build-windows-arm64.yml+++ b/.github/workflows/template-tauri-build-windows-arm64.yml@@ -448,6 +448,10 @@ jobs:# This job has failed in packaging after an hour of compiling more# than once. Saving anyway keeps the next attempt cheap.cache-on-failure: true+ # A pull request's cache is readable only by that pull request, and+ # each one was an 835MB entry against the repo's 10GB cap. PR builds+ # restore what main, release and nightly runs saved.+ save-if: ${{ github.event_name != 'pull_request' }}- name: Install AzureSignToolrun: dotnet tool install --global --version 6.0.0 AzureSignTooldiff --git a/Makefile b/Makefileindex 6e751da04..b543dbc6f 100644--- a/Makefile+++ b/Makefile@@ -142,12 +142,25 @@ lint: install-and-build# Both go through `test-rust`, which owns `stub-resources`: the app's build# script fails on any missing bundle.resources path, and neither entry point# builds the engine worker or the ggml backends.-test-prepare: lint- yarn download:bin+test-prepare: test-ts rust-test-assets++# The two halves of test-ci. CI runs them as separate jobs so a pull request+# runs only the half its files can break, and the TypeScript half on one OS.+test-ts: lintyarn test++# The steps test-ci ran before test-rust, without the lint/vitest half. They+# need node_modules (download:bin unpacks with it, build:icon is the Tauri CLI),+# which lint's install-and-build used to provide.+rust-test-assets:+ yarn install+ yarn download:binyarn copy:assets:tauriyarn build:icon+test-ci-rust: rust-test-assets+ $(MAKE) test-rust+test-rust: stub-resourcescargo test --locked --manifest-path src-tauri/Cargo.toml --no-default-features --features test-tauri -- --test-threads=1cargo test --locked --manifest-path src-tauri/plugins/tauri-plugin-hardware/Cargo.toml