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
34 changes: 18 additions & 16 deletions .agents/skills/manage-ci/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,32 @@ contract; no downstream product's workflow topology applies here.
the previous two required checks until then, and retain all review protections.

- `.github/workflows/ci.yml` owns code checks and package builds. Declarative
native paths trigger CI on code or inference PRs and on code pushes to main.
Inside CI, declarative PR filters select code checks and require Linux x64
CUDA 13 and macOS ARM64 Metal package and device smoke on inference PRs.
Main pushes retain the short profile: inference-related, packaging or native
changes select those same two device smokes, and native paths additionally
select Graph Contracts after canary. The declarative packaging/native filters
extend main only; do not change PR admission or hardware requirements.
Classify main changes since a verified successful ancestor main-push CI run
so coalesced and failed pushes cannot hide untested inputs. When previous
coverage is unavailable, require both device smokes and Graph Contracts.
The protected inference workflow uses the same inference paths in its native
native paths trigger CI on automation, code, package or qualification inputs.
Independent declarative PR filters select hosted offline automation, source
checks, and Linux ARM64 CUDA 13 plus macOS ARM64 Metal package/device smoke.
Qualification scripts and reporting do not select PR package builds. Reporting
and offline check recipes belong in `ci/automation.just`; root `Justfile` edits
remain conservative build inputs. Main pushes retain conservative source
checks. Inference, packaging and native main changes select both device
smokes; native changes additionally select Graph Contracts. Compare main
changes since a verified successful ancestor main-push CI run so coalesced
and failed pushes cannot hide untested inputs. If previous coverage cannot
be verified, require both device smokes and Graph Contracts. The protected
inference workflow uses its separate qualification paths in its native
trigger for the seven Spark configurations. PR qualification is manual: the
jobs run only when the PR carries the `qualify` label, while the workflow
still triggers on path matches so an intentionally skipped run satisfies
the `PR checks` aggregate; nightly and releases stay automatic. Main pushes
do not start the Spark ladder. `PR checks` reads protected workflow trigger
paths to determine which runs it expects. Quality canary
runs CI automation tests before build checks and gates package jobs. Full CI
do not start the Spark ladder. `PR checks` reads protected trigger paths to determine
which runs it expects. Hosted offline
automation gates Quality canary and package jobs; Quality canary gates package
jobs whenever source checks apply. Full CI
runs Graph Contracts in parallel with eight build, package and smoke jobs.
Each CPU job supplies a shared platform CLI to its backend jobs. Routine CI
uses two device jobs and checks the three remaining CUDA archives on hosted
compiler-image runners.
Tagged releases add device smoke on those exact archives. The lightweight
CI gate checks the validated matrix and requires all applicable results.
Tagged releases add device smoke on those exact archives, including x64 CUDA 13.
The lightweight CI gate checks the validated matrix and requires all applicable results.
- `.github/workflows/docs.yml` directly validates `docs-site/**` changes on PRs
and deploys to beta on protected-main pushes. The protected PR aggregate
expects this workflow when docs paths match. Tagged release validation calls
Expand Down
107 changes: 98 additions & 9 deletions .github/path-filters.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Used with dorny/paths-filter's some-with-excludes predicate.
# The PR workflow tests check these lists against the native triggers.
# These are file-level rules: inline tests and shared manifest/Justfile edits
# still count when their containing file matches.
code:
# Native workflow triggers and route behavior are checked by the Node tests.
# Root Justfile and shared manifest edits remain conservative file-level inputs.
automation:
- 'crates/**'
- 'skippy-api-rs/**'
- 'skippy_api/**'
Expand All @@ -13,10 +12,30 @@ code:
- '.github/actions/**'
- '.github/scripts/**'
- '.github/path-filters.yml'
- '.github/workflows/ci.yml'
- '.github/workflows/ci-pr.yml'
- '.github/workflows/inference.yml'
- '.github/workflows/llama-upgrade.yml'
- '.github/actionlint.yaml'
- '.github/workflows/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'Justfile'
- '.python-version'
- 'ci/**'
- '.gi/templates.yaml'
- '!**/*.md'
- '!**/*.mdx'
- '!**/*.rst'
- '!**/*.adoc'
- '!**/docs/**'
- '!docs-site/**'

code:
- 'crates/**'
- 'skippy-api-rs/**'
- 'skippy_api/**'
- 'llama_cpp/**'
- 'tools/**'
- 'scripts/**'
- '.cargo/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
Expand All @@ -29,6 +48,72 @@ code:
- '!**/*.adoc'
- '!**/docs/**'
- '!docs-site/**'
- '!scripts/inference-*'
- '!scripts/lib/inference_*'
- '!scripts/lib/inference-*'
- '!scripts/lib/jy_qualification.py'
- '!scripts/tests/**'
- '!scripts/ci-preserve-cuda-license.sh'
- '!scripts/ci-automation*.sh'

packages:
- 'crates/**'
- 'skippy_api/src/**'
- 'skippy_api/include/**'
- 'skippy_api/CMakeLists.txt'
- 'llama_cpp/upstream.txt'
- 'llama_cpp/whisper-upstream.txt'
- 'llama_cpp/patches/**'
- 'tools/process-supervision/**'
- 'scripts/lib/ci_artifacts.py'
- 'scripts/lib/ci_process.py'
- 'scripts/artifact-file.sh'
- 'scripts/build-llama.sh'
- 'scripts/prepare-llama.sh'
- 'scripts/prepare-whisper.sh'
- 'scripts/cargo-linker*'
- 'scripts/lib/cuda-toolkit.sh'
- 'scripts/lib/lld.sh'
- 'scripts/lib/macos-deployment-target*'
- 'Cargo.toml'
- 'Cargo.lock'
- '.cargo/**'
- 'rust-toolchain.toml'
- 'Justfile'
- 'scripts/automation-run.sh'
- 'scripts/ci-product.py'
- 'scripts/ci-model-fetch.sh'
- 'scripts/package-*.sh'
- 'scripts/verify-native-runtime-package.sh'
- 'scripts/native-*.py'
- 'scripts/lib/native_*.py'
- 'scripts/lib/ci_*.py'
- 'scripts/lib/windows_job.py'
- '.github/actions/ci-package/**'
- '.github/actions/ci-smoke/**'
- '.github/actions/native-source/**'
- '.github/actions/source/**'
- 'ci/targets.json'
- 'ci/llama-canary/**'
- '!**/*.md'
- '!**/*.mdx'
- '!**/*.rst'
- '!**/*.adoc'
- '!**/docs/**'
- '!**/tests/**'
- '!**/benches/**'
- '!**/examples/**'
- '!**/fuzz/**'
- '!**/tests.rs'
- '!**/*_tests.rs'
- '!**/tests_*.rs'
- '!**/test_support.rs'
- '!crates/llama-spec-bench/**'
- '!crates/metrics-server/**'
- '!crates/skippy-gpu-bench/**'
- '!crates/skippy-package-builder/**'
- '!crates/skippy-quantize/**'
- '!crates/skippy-correctness/**'

inference:
- 'crates/**'
Expand Down Expand Up @@ -81,8 +166,12 @@ inference:
- '!crates/skippy-package-builder/**'
- '!crates/skippy-quantize/**'
- '!crates/skippy-correctness/**'
- '!scripts/inference-render-report.py'
- '!scripts/lib/inference_markdown.py'
- '!scripts/lib/inference_charts.py'
- '!scripts/lib/inference_png.py'

# Additional main-only smoke inputs. PR inference selection above stays unchanged.
# Additional main-only smoke inputs; PRs use the independent packages filter.
packaging:
- 'crates/skippy-package-builder/**'
- 'skippy-api-rs/**'
Expand Down
85 changes: 71 additions & 14 deletions .github/scripts/ci-gate.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@ const declared = section.match(/ needs: \[([\s\S]+?)\]/)[1].split(',').map(s
const targets = JSON.parse(readFileSync(join(__dirname, '../../ci/targets.json'), 'utf8'));
const rows = targets.runtimes.filter(row => row.enabled !== false && targets.enabled_hosts.includes(row.host));
const packageJobs = rows.map(row => `package_${row.id.replaceAll('-', '_')}`);
const prPackages = ['package_darwin_aarch64_metal', 'package_linux_x86_64_cuda13'];
const releaseSmokes = ['release_smoke_linux_x86_64_cuda12', 'release_smoke_linux_aarch64_cuda12', 'release_smoke_linux_aarch64_cuda13'];
const prPackages = ['package_darwin_aarch64_metal', 'package_linux_aarch64_cuda13'];
const releaseSmokes = ['release_smoke_linux_x86_64_cuda12', 'release_smoke_linux_aarch64_cuda12', 'release_smoke_linux_x86_64_cuda13'];

function results({ code = true, inference = false, native = false, full = false, release = false, hostedRequiresNative = false } = {}) {
const selected = code || inference;
function results({ automation = true, code = true, packages = false, native = false, full = false, release = false, hostedRequiresNative = false } = {}) {
const selected = code || packages;
const required = ['changes'];
if (automation) required.push('automation');
if (selected) required.push('plan');
if (code) required.push('quality');
if (full) required.push('native_contracts', ...packageJobs);
else if (inference) required.push(...prPackages);
else if (packages) required.push(...prPackages);
if (native) required.push('native_contracts');
if (release) required.push(...releaseSmokes);
const needs = Object.fromEntries(declared.map(job => [job, { result: required.includes(job) ? 'success' : 'skipped' }]));
needs.changes.outputs = { code: String(code), inference: String(inference), native: String(native), hosted_requires_native: String(hostedRequiresNative) };
needs.changes.outputs = { automation: String(automation), code: String(code), packages: String(packages), native: String(native), hosted_requires_native: String(hostedRequiresNative) };
if (selected) needs.plan.outputs = { profile: full ? 'full' : 'pr', runtimes: JSON.stringify({ include: rows }) };
return needs;
}
Expand All @@ -49,16 +50,16 @@ test('all eight runtime packages match the planned matrix and depend on the cana
assert.match(body, /^ needs: \[plan, quality[\],]/m);
assert.ok(body.includes(`runtime-id: ${row.id}\n`));
if (row.backend !== 'cpu') assert.ok(body.includes(`package_${row.host.replaceAll('-', '_')}_cpu`));
assert.equal(body.includes("needs.changes.outputs.inference == 'true'"), prPackages.includes(job));
assert.equal(body.includes("needs.changes.outputs.packages == 'true'"), prPackages.includes(job));
}
assert.doesNotThrow(() => gate(results({ full: true })));
});

test('inference PRs and selected main merges require the two package and smoke jobs', () => {
for (const options of [{}, { code: false }, { inference: true }, { code: false, inference: true }]) {
test('only package-affecting pull requests require the two package and smoke jobs', () => {
for (const options of [{}, { code: false }, { packages: true }, { code: false, packages: true }]) {
assert.doesNotThrow(() => gate(results(options)));
}
const needs = results({ inference: true });
const needs = results({ packages: true });
for (const job of prPackages) {
const missingSmoke = structuredClone(needs);
missingSmoke[job].result = 'skipped';
Expand All @@ -69,8 +70,64 @@ test('inference PRs and selected main merges require the two package and smoke j
assert.throws(() => gate(unexpectedSmoke), /must be skipped/);
});

test('automation-only PRs require successful offline checks and skip all builds', () => {
assert.doesNotThrow(() => gate(results({ code: false })));
assert.doesNotThrow(() => gate(results({ automation: false, code: false })));
for (const result of ['failure', 'cancelled', 'skipped', undefined]) {
const needs = results({ code: false });
if (result === undefined) delete needs.automation;
else needs.automation.result = result;
assert.throws(() => gate(needs), /automation/);
}
for (const decision of ['automation', 'code', 'packages', 'native', 'hosted_requires_native']) {
const needs = results({ code: false });
delete needs.changes.outputs[decision];
assert.throws(() => gate(needs), /Path selection/);
}
});

test('package smoke waits for automation and every applicable source check', () => {
for (const job of prPackages) {
const body = workflow.split(`\n ${job}:\n`)[1].split(/\n \w+:\n/)[0];
const condition = body.match(/ if: >-\n([\s\S]+?)\n runs-on:/)[1]
.replace('${{', '').replace('}}', '');
const selected = new Function('needs', 'cancelled', `return (${condition})`);
for (const code of [false, true]) {
assert.equal(selected(results({ code, packages: true }), () => false), true);
for (const result of ['failure', 'cancelled', 'skipped']) {
const needs = results({ code, packages: true });
needs.automation.result = result;
assert.equal(selected(needs, () => false), false);
}
const needs = results({ code, packages: true });
needs.quality.result = code ? 'skipped' : 'failure';
assert.equal(selected(needs, () => false), false);
}
assert.equal(selected(results(), () => false), false);
assert.equal(selected(results({ full: true }), () => false), true);
assert.equal(selected(results({ packages: true }), () => true), false);
}
});

test('ARM64 owns routine CUDA device smoke and x64 retains exact release device smoke', () => {
const arm = workflow.split('\n package_linux_aarch64_cuda13:\n')[1].split(/\n \w+:\n/)[0];
const row = rows.find(row => row.id === 'linux-aarch64-cuda13');
assert.ok(arm.includes(`group: ${row.runner_group}`));
assert.ok(arm.includes(`labels: ${JSON.stringify(row.runner).replaceAll(',', ', ')}`));
assert.match(arm, /host-id: linux-aarch64\n/);
assert.match(arm, /build-cli:.*profile == 'pr'/);
assert.doesNotMatch(arm, /smoke: artifact/);
const x64 = workflow.split('\n package_linux_x86_64_cuda13:\n')[1].split(/\n \w+:\n/)[0];
assert.match(x64, /skippy-ci-cuda13:latest\n/);
assert.match(x64, /smoke: artifact\n/);
const release = workflow.split('\n release_smoke_linux_x86_64_cuda13:\n')[1].split(/\n \w+:\n/)[0];
assert.match(release, /needs: \[package_linux_x86_64_cuda13\]/);
assert.match(release, /runtime_id: linux-x86_64-cuda13\n/);
assert.match(release, /download-package: 'true'/);
});

test('targeted main validation requires device smokes and selected Graph Contracts', () => {
const needs = results({ inference: true, native: true });
const needs = results({ packages: true, native: true });
assert.doesNotThrow(() => gate(needs));
for (const job of ['quality', 'native_contracts', ...prPackages]) {
for (const result of ['skipped', 'failure', 'cancelled', undefined]) {
Expand All @@ -93,7 +150,7 @@ test('targeted main validation requires device smokes and selected Graph Contrac
});

test('missing, skipped, failed and cancelled required work cannot pass full CI', () => {
for (const job of ['changes', 'plan', 'quality', 'native_contracts', ...packageJobs]) {
for (const job of ['changes', 'automation', 'plan', 'quality', 'native_contracts', ...packageJobs]) {
for (const result of ['skipped', 'failure', 'cancelled', undefined]) {
const needs = results({ full: true });
if (result === undefined) delete needs[job];
Expand All @@ -113,7 +170,7 @@ test('release validation requires the three other GPU smokes', () => {
assert.throws(() => gate(results(), true), /requires full CI/);
});

test('hosted CI cannot satisfy a native inference requirement', () => {
test('hosted CI cannot satisfy a native package requirement', () => {
assert.throws(() => gate(results({ hostedRequiresNative: true })), /require native hardware qualification on an isolated runner/);
});

Expand Down Expand Up @@ -185,7 +242,7 @@ test('manual compiler image smoke can skip publication on either runner provider
});

test('native CI trusts only an immutable same-repository PR from a writer', async () => {
const admission = workflow.split(' - name: Verify the same-repository PR author\n')[1].split('\n plan:\n')[0];
const admission = workflow.split(' - name: Verify the same-repository PR author\n')[1].split('\n automation:\n')[0];
const script = admission.split(' script: |\n')[1];
const evaluate = new Function('github', 'context', 'return (async () => {\n' + script + '\n})()');
const candidate = {
Expand Down
20 changes: 10 additions & 10 deletions .github/scripts/ci-main-routing.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ function matches(name, files) {
}

function selection(github, files, { force = false, verified = false } = {}) {
const paths = Object.fromEntries(['code', 'inference', 'packaging', 'native']
const paths = Object.fromEntries(['automation', 'code', 'packages', 'inference', 'packaging', 'native']
.map(name => [name, String(matches(name, files))]));
const steps = { paths: { outputs: paths }, release: { outputs: { verified: String(verified) } },
main_base: { outputs: { force: String(force) } } };
return Object.fromEntries(['code', 'inference', 'native', 'hosted_requires_native'].map(name => {
return Object.fromEntries(['automation', 'code', 'packages', 'native', 'hosted_requires_native'].map(name => {
const expression = changes.match(new RegExp(`^ ${name}: \\$\\{\\{ (.+) \\}\\}$`, 'm'))[1];
return [name, new Function('github', 'steps', `return (${expression});`)(github, steps)];
}));
Expand Down Expand Up @@ -65,24 +65,24 @@ test('main runs device smokes for inference and packaging changes, Graph Contrac
];
for (const [file, inference, native] of cases) {
const actual = selection(main, [file]);
assert.equal(actual.inference, inference, file);
assert.equal(actual.packages, inference, file);
assert.equal(actual.native, native, file);
assert.equal(actual.hosted_requires_native, false, file);
}
assert.deepEqual(selection(main, ['scripts/tests/inference_contracts.py'], { force: true }),
{ code: true, inference: true, native: true, hosted_requires_native: false });
{ automation: true, code: true, packages: true, native: true, hosted_requires_native: false });
assert.deepEqual(selection(main, ['llama_cpp/upstream.txt'], { verified: true }),
{ code: false, inference: false, native: false, hosted_requires_native: false });
{ automation: false, code: false, packages: false, native: false, hosted_requires_native: false });
});

test('PR hardware selection and full nightly/release profile selection stay unchanged', () => {
const pr = event_name => ({ event_name, event: { pull_request: {} } });
assert.deepEqual(selection(pr('pull_request_target'), ['crates/skippy-cli/src/main.rs']),
{ code: true, inference: true, native: false, hosted_requires_native: false });
{ automation: true, code: true, packages: true, native: false, hosted_requires_native: false });
assert.deepEqual(selection(pr('pull_request'), ['crates/skippy-cli/src/main.rs']),
{ code: true, inference: false, native: false, hosted_requires_native: true });
assert.equal(selection(pr('pull_request_target'), ['scripts/tests/inference_contracts.py']).inference, false);
assert.equal(selection(pr('pull_request_target'), ['crates/skippy-package-builder/src/lib.rs']).inference, false);
{ automation: true, code: true, packages: false, native: false, hosted_requires_native: true });
assert.equal(selection(pr('pull_request_target'), ['scripts/tests/inference_contracts.py']).packages, false);
assert.equal(selection(pr('pull_request_target'), ['crates/skippy-package-builder/src/lib.rs']).packages, false);
const profile = workflow.match(/SKIPPY_CI_PROFILE: \$\{\{ (.+) \}\}/)[1];
const selectProfile = new Function('github', 'inputs', `return (${profile});`);
assert.equal(selectProfile(main, {}), 'pr');
Expand All @@ -97,7 +97,7 @@ test('main path selection and package jobs remain bound to the exact merged SHA'
assert.match(workflow, /fetch-depth: \$\{\{ github.event_name == 'push' && '0' \|\| '1' \}\}/);
assert.match(workflow, /base: \$\{\{ steps.main_base.outputs.base \}\}\n ref: \$\{\{ github.sha \}\}/);
assert.match(workflow, /SKIPPY_CI_SOURCE_REF: .+\|\| github.sha \}\}/);
for (const job of ['package_darwin_aarch64_metal', 'package_linux_x86_64_cuda13']) {
for (const job of ['package_darwin_aarch64_metal', 'package_linux_aarch64_cuda13']) {
const body = workflow.split(`\n ${job}:\n`)[1].split(/\n \w+:\n/)[0];
assert.match(body, /needs: \[plan, quality,/);
assert.match(body, /ref: \$\{\{ env.SKIPPY_CI_SOURCE_REF \}\}/);
Expand Down
Loading
Loading