Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions .github/workflows/judge-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,34 @@ jobs:
with:
persist-credentials: false
ref: ${{ github.sha }}
# The PR merge commit plus its first parent (the base tip) for the diff below.
fetch-depth: 2

# packages/console-ui (types only) and the root pnpm files feed the UI
# checks but nothing the Rust engine suite exercises, so a PR touching
# only those skips the Rust engine half. Keep this regex in sync with
# on.pull_request.paths minus those JS-only entries.
- name: Decide whether the engine suite runs
id: scope
run: |
changed="$(git diff --name-only HEAD^1 HEAD)"
if grep -qE '^(judge(-laya|-typesafe|-semif|-decider|-clef|-openai)?/|crates/(llama-runtime|llama-native|judge-contract|judge-provider|config-client|console-ui|worker-paths)/|rust-toolchain\.toml$|\.cargo/|\.github/scripts/judge-|\.github/workflows/judge-e2e\.yml$)' <<<"$changed"; then
echo "engine=true" >> "$GITHUB_OUTPUT"
else
echo "::notice::Only JS-side shared files changed; skipping the Rust engine suite."
fi

- name: Prepare reports
run: |
mkdir -p "$RUNNER_TEMP/judge-e2e-reports"
echo "JUDGE_E2E_REPORT_DIR=$RUNNER_TEMP/judge-e2e-reports" >> "$GITHUB_ENV"

- name: Install Rust toolchain
if: steps.scope.outputs.engine == 'true'
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # v1
with:
toolchain: 1.97.1

- name: Cache cargo registry and builds
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
with:
workspaces: |
judge
judge-laya
judge-typesafe
judge-clef
judge-openai
crates/judge-contract
crates/judge-provider

- name: Setup pnpm
# Version comes from the root package.json packageManager field.
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
Expand Down Expand Up @@ -112,13 +117,8 @@ jobs:
# Reuse these assets in both Cargo feature variants.
echo 'SKIP_UI_BUILD=1' >> "$GITHUB_ENV"

# judge-semif, judge-decider, judge-laya and judge-clef compile llama.cpp
# through crates/llama-native (curl, tar, patch, cmake; no libclang) and
# the runtime-loaded Vulkan backend module (headers + glslc).
- name: Provision llama.cpp build tools
run: sudo apt-get update && sudo apt-get install -y cmake libvulkan-dev glslc spirv-headers

- name: Install pinned iii engine
if: steps.scope.outputs.engine == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
BIN_DIR: ${{ runner.temp }}/judge-engine/bin
Expand All @@ -131,7 +131,18 @@ jobs:
test "$(awk '{print $NF}' "$JUDGE_E2E_REPORT_DIR/engine-version.log")" = "${III_RELEASE_TAG#iii/v}"
echo "III_ENGINE_BIN=$BIN_DIR/iii" >> "$GITHUB_ENV"

# Compile time was the whole cost: four from-scratch llama.cpp builds with
# every CPU variant and Vulkan, plus eight workspaces each building the
# same deps. One target dir builds each shared unit once across the
# suites (judge-laya's opt-level 3 still gets its own llama.cpp), and the
# tiny models run on one CPU module. The hosted image ships cmake, curl,
# tar and patch. No rust-cache: PR-scoped caches never reach another PR,
# and it purges path crates (llama-native's llama.cpp) anyway.
- name: Real-engine tests (11 local mocked cases)
if: steps.scope.outputs.engine == 'true'
env:
CARGO_TARGET_DIR: ${{ runner.temp }}/judge-e2e-target
III_LLAMA_CPP_MINIMAL: '1'
run: bash .github/scripts/judge-e2e.sh

- name: Upload test logs
Expand Down
12 changes: 10 additions & 2 deletions crates/llama-native/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ fn sha256_hex(path: &Path) -> Option<String> {
fn llama() {
println!("cargo:rerun-if-changed=native");
println!("cargo:rerun-if-env-changed=III_LLAMA_CPP_TARBALL");
println!("cargo:rerun-if-env-changed=III_LLAMA_CPP_MINIMAL");
let out = PathBuf::from(env::var("OUT_DIR").expect("cargo sets OUT_DIR"));
let src = llama_source(&out);
let os = env::var("CARGO_CFG_TARGET_OS").expect("cargo sets the target OS");
Expand All @@ -126,11 +127,18 @@ fn llama() {
.define("GGML_OPENMP", "OFF")
.define("BUILD_SHARED_LIBS", if dynamic { "ON" } else { "OFF" });
if dynamic {
// III_LLAMA_CPP_MINIMAL=1 (test-only builds such as Judge E2E): one CPU
// module and no Vulkan, a fraction of the build time. Never ship it.
let full = if env::var("III_LLAMA_CPP_MINIMAL").as_deref() == Ok("1") {
"OFF"
} else {
"ON"
};
fs::create_dir_all(&backends).expect("creating the backends directory");
cmake
.define("GGML_BACKEND_DL", "ON")
.define("GGML_CPU_ALL_VARIANTS", "ON")
.define("GGML_VULKAN", "ON")
.define("GGML_CPU_ALL_VARIANTS", full)
.define("GGML_VULKAN", full)
.define("GGML_BACKEND_DIR", &backends);
}
if os == "macos" {
Expand Down
Loading