Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion .agents/skills/manage-ci/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Read this file before inspecting or changing CI. This is the standalone Skippy
contract; no downstream product's workflow topology applies here.

- `.github/workflows/pr-checks.yml` owns the single intended required `PR checks`
aggregate on a standard GitHub-hosted Ubuntu runner. Protected-main code reads
aggregate on the repository's selected Ubuntu runner. Protected-main code reads
workflow/check/status results without executing candidate code or using lab
credentials. Failures/cancellations fail it; pending or missing applicable work
stays pending; success/neutral/intentional skips pass. Producer starts and
Expand Down
3 changes: 3 additions & 0 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ runs:
fi
echo "SKIPPY_CARGO_CACHE_LAYOUT=${digest:0:16}" >> "$GITHUB_ENV"
- name: Restore shared Cargo downloads
if: ${{ !startsWith(runner.name, 'depot-') }}
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
Expand All @@ -44,10 +45,12 @@ runs:
restore-keys: |
cargo-downloads-v1-${{ github.event_name == 'pull_request_target' && 'same-repo-pr-' || '' }}${{ runner.os }}-${{ env.SKIPPY_CARGO_CACHE_LAYOUT }}-${{ inputs.download-scope }}-
- name: Identify checked-out source
if: ${{ !startsWith(runner.name, 'depot-') }}
id: source
shell: bash
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Restore rolling Cargo build snapshot
if: ${{ !startsWith(runner.name, 'depot-') }}
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ inputs.build-paths }}
Expand Down
5 changes: 4 additions & 1 deletion .github/actions/ci-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ inputs:
build-cli:
description: Build the CLI locally instead of downloading the platform producer artifact.
default: 'false'
setup-host:
description: Install the pinned command runner on a standard runner image.
default: 'false'
smoke:
description: Select inference or artifact smoke.
default: inference
Expand All @@ -26,7 +29,7 @@ runs:
using: composite
steps:
- uses: ./.github/actions/setup
if: runner.environment == 'github-hosted' && inputs.containerized != 'true'
if: inputs.setup-host == 'true'
with:
cache: 'false'
- name: Identify the compiler image
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/ci-smoke/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:
name: ${{ env.SKIPPY_ARTIFACT_SCOPE }}-package-${{ inputs.runtime_id }}
path: dist/products/${{ inputs.runtime_id }}
- name: Restore immutable Qwen3 smoke fixture
if: env.SKIPPY_CI_MODEL == ''
if: ${{ !startsWith(runner.name, 'depot-') && env.SKIPPY_CI_MODEL == '' }}
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: target/ci-models/Qwen3-0.6B-Q8_0.gguf
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/native-source/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ runs:
using: composite
steps:
- name: Restore prepared llama.cpp source
if: env.LLAMA_WORKDIR == '' && env.LLAMA_UPSTREAM_URL == '' && env.LLAMA_PIN_FILE == '' && env.LLAMA_PATCH_DIR == '' && env.SKIPPY_LLAMA_DIR == ''
if: ${{ !startsWith(runner.name, 'depot-') && env.LLAMA_WORKDIR == '' && env.LLAMA_UPSTREAM_URL == '' && env.LLAMA_PIN_FILE == '' && env.LLAMA_PATCH_DIR == '' && env.SKIPPY_LLAMA_DIR == '' }}
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .deps/llama.cpp
key: native-source-v1-${{ runner.os }}-${{ hashFiles('llama_cpp/upstream.txt') }}-${{ hashFiles('llama_cpp/patches/**', 'scripts/prepare-llama.sh') }}
restore-keys: |
native-source-v1-${{ runner.os }}-${{ hashFiles('llama_cpp/upstream.txt') }}-
- name: Restore pinned whisper.cpp source
if: env.WHISPER_WORKDIR == '' && env.WHISPER_UPSTREAM_URL == '' && env.WHISPER_PIN_FILE == ''
if: ${{ !startsWith(runner.name, 'depot-') && env.WHISPER_WORKDIR == '' && env.WHISPER_UPSTREAM_URL == '' && env.WHISPER_PIN_FILE == '' }}
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .deps/whisper.cpp
Expand Down
13 changes: 13 additions & 0 deletions .github/actions/sccache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ runs:
using: composite
steps:
- name: Export GitHub cache credentials
if: ${{ !startsWith(runner.name, 'depot-') }}
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
Expand All @@ -18,6 +19,7 @@ runs:
shell: bash
env:
SCCACHE_SCOPE: ${{ inputs.scope }}
USE_LOCAL_CACHE: ${{ startsWith(runner.name, 'depot-') }}
run: |
set -euo pipefail
version=0.19.0
Expand Down Expand Up @@ -64,6 +66,10 @@ runs:
export SCCACHE_BASEDIRS="$GITHUB_WORKSPACE"
export SCCACHE_GHA_VERSION="skippy-v1-$SCCACHE_SCOPE-$recipe_digest"
export SCCACHE_GHA_RW_MODE=READ_ONLY
if [[ "$USE_LOCAL_CACHE" == true ]]; then
export SCCACHE_GHA_ENABLED=false
Comment thread
i386 marked this conversation as resolved.
Resolved
unset SCCACHE_WEBDAV_ENDPOINT SCCACHE_WEBDAV_TOKEN SCCACHE_WEBDAV_USERNAME SCCACHE_WEBDAV_PASSWORD
fi
case "${GITHUB_REF:-}:$GITHUB_EVENT_NAME" in
refs/heads/main:push|refs/heads/main:schedule|refs/heads/main:workflow_dispatch)
if [[ "${GITHUB_REF_PROTECTED:-false}" == true && "$(git rev-parse HEAD)" == "$GITHUB_SHA" ]]; then
Expand All @@ -83,4 +89,11 @@ runs:
echo "SCCACHE_BASEDIRS=$SCCACHE_BASEDIRS"
echo "SCCACHE_GHA_VERSION=$SCCACHE_GHA_VERSION"
echo "SCCACHE_GHA_RW_MODE=$SCCACHE_GHA_RW_MODE"
if [[ "$USE_LOCAL_CACHE" == true ]]; then
echo 'SCCACHE_GHA_ENABLED=false'
echo 'SCCACHE_WEBDAV_ENDPOINT='
echo 'SCCACHE_WEBDAV_TOKEN='
echo 'SCCACHE_WEBDAV_USERNAME='
echo 'SCCACHE_WEBDAV_PASSWORD='
fi
} >> "$GITHUB_ENV"
1 change: 1 addition & 0 deletions .github/path-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ code:
- '.github/scripts/**'
- '.github/path-filters.yml'
- '.github/workflows/ci.yml'
- '.github/workflows/ci-pr.yml'
- '.github/workflows/inference.yml'
- '.github/workflows/llama-upgrade.yml'
- 'Cargo.toml'
Expand Down
67 changes: 67 additions & 0 deletions .github/scripts/ci-gate.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,73 @@ test('hosted CI cannot satisfy a native inference requirement', () => {
assert.throws(() => gate(results({ hostedRequiresNative: true })), /require native hardware qualification on an isolated runner/);
});

test('the repository switch moves every hosted job to Depot', () => {
const workflows = ['ci', 'ci-images', 'ci-image-builds', 'docs', 'inference', 'llama-upgrade', 'pr-checks', 'release'];
for (const name of workflows) {
const yaml = readFileSync(join(__dirname, '../workflows', name + '.yml'), 'utf8');
const labels = [...yaml.matchAll(/^ runs-on: (.+)\n((?: .+\n)*)/gm)]
.map(([, label, continuation]) => `${label} ${continuation.trim().replaceAll(/\s+/g, ' ')}`.trim());
assert.ok(labels.some(label => label.includes('SKIPPY_DEPOT_RUNNERS_ENABLED')), name);
for (const label of labels) {
if (name === 'llama-upgrade' && label === '${{ matrix.runner }}') continue;
assert.match(label, /vars.SKIPPY_DEPOT_RUNNERS_ENABLED == 'true'.*depot-/, name);
}
}
});

test('ordinary PRs call protected workflows with no cache access or publisher permissions', () => {
const workflows = { 'ci-pr': 'ci', 'ci-images-pr': 'ci', 'docs-pr': 'docs' };
for (const [caller, callee] of Object.entries(workflows)) {
const yaml = readFileSync(join(__dirname, '../workflows', caller + '.yml'), 'utf8');
assert.ok(yaml.includes(`uses: Mesh-LLM/skippy/.github/workflows/${callee}.yml@main`));
assert.match(yaml, /^ cache-mode: none$/m);
assert.doesNotMatch(yaml, /runs-on:|secrets:|: write$/m);
const reusable = readFileSync(join(__dirname, '../workflows', callee + '.yml'), 'utf8');
assert.doesNotMatch(reusable, /^(?: )+\w+: write$/m);
}
});

test('the protected image PR bridge routes only the image workflow', () => {
const bridge = workflow.split('\n pr_image_builds:\n')[1].split('\n changes:\n')[0];
const admission = bridge.match(/if: >-\n([\s\S]+?)\n uses:/)[1];
const eligible = new Function('github', 'vars', 'startsWith', `return (${admission});`);
const event = {
repository: 'Mesh-LLM/skippy', event_name: 'pull_request',
workflow_ref: 'Mesh-LLM/skippy/.github/workflows/ci-images-pr.yml@refs/pull/136/merge',
};
const vars = { SKIPPY_DEPOT_RUNNERS_ENABLED: 'true' };
const startsWith = (value, prefix) => value.startsWith(prefix);
assert.equal(eligible(event, vars, startsWith), true);
assert.equal(eligible(event, {}, startsWith), false);
assert.equal(eligible({ ...event, workflow_ref: event.workflow_ref.replace('ci-images-pr', 'ci-pr') }, vars, startsWith), false);
assert.match(bridge, /uses: \.\/\.github\/workflows\/ci-image-builds\.yml/);
});

test('host CPU packages install Just on GitHub and Depot runners', () => {
for (const row of rows) {
const job = `package_${row.id.replaceAll('-', '_')}`;
const body = workflow.split(`\n ${job}:\n`)[1].split(/\n \w+:\n/)[0];
assert.equal(body.includes("setup-host: 'true'"), row.backend === 'cpu', job);
}
const action = readFileSync(join(__dirname, '../actions/ci-package/action.yml'), 'utf8');
assert.match(action, /uses: \.\/\.github\/actions\/setup\n if: inputs.setup-host == 'true'/);
});

test('manual compiler image smoke can skip publication on either runner provider', () => {
const images = readFileSync(join(__dirname, '../workflows/ci-images.yml'), 'utf8');
const repository = 'Mesh-LLM/skippy';
const ref = 'refs/heads/main';
for (const kind of ['cpu', 'gpu']) {
const publish = images.split(`\n ${kind}-publish:\n`)[1];
const publishPolicy = publish.match(/if: >-\n([\s\S]+?)\n runs-on:/)[1];
const publishImage = new Function('github', 'inputs', `return (${publishPolicy});`);
assert.equal(publishImage({ repository, ref, event_name: 'workflow_dispatch' }, { build_only: true }), false);
assert.equal(publishImage({ repository, ref, event_name: 'workflow_dispatch' }, { build_only: false }), true);
assert.equal(publishImage({ repository, ref, event_name: 'push' }, {}), true);
assert.equal(publishImage({ repository, ref, event_name: 'pull_request' }, {}), false);
}
});

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 script = admission.split(' script: |\n')[1];
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/pr-checks.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const automaticPR = run => ['pull_request', 'pull_request_target'].includes(run.
const accepted = new Set(['success', 'skipped', 'neutral']);
const controllerName = 'Evaluate aggregate PR checks';

module.exports = async function aggregate({ github, context, core }) {
module.exports = async function aggregate({ github, context, core, depot = false }) {
const repo = context.repo;
const trigger = context.payload.workflow_run;
const source = context.payload.pull_request?.head.sha || trigger?.head_sha ||
Expand Down Expand Up @@ -36,7 +36,7 @@ module.exports = async function aggregate({ github, context, core }) {
}
const sameRepositoryPR = pr.base?.ref === 'main' && pr.head.repo?.id != null &&
pr.head.repo.id === pr.base.repo?.id;
const expected = expectedWorkflows(files, sameRepositoryPR);
const expected = expectedWorkflows(files, sameRepositoryPR, depot);
const runs = await github.paginate(github.rest.actions.listWorkflowRunsForRepo,
{ ...repo, head_sha: source, per_page: 100 });
const latest = new Map();
Expand Down
24 changes: 22 additions & 2 deletions .github/scripts/pr-checks.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function evaluate(options = {}) {
} };
const context = { repo: { owner: 'Mesh-LLM', repo: 'skippy' }, runId: 42,
payload: options.payload || { pull_request: pr } };
await aggregate({ github, context, core: { info() {}, setFailed: message => failures.push(message) } });
await aggregate({ github, context, depot: options.depot, core: { info() {}, setFailed: message => failures.push(message) } });
assert.ok(calls.every(c => c.sha === sha && c.context === 'PR checks'));
return { state: calls.at(-1)?.state, calls, failures };
}
Expand Down Expand Up @@ -63,9 +63,13 @@ test('every failed or cancelled workflow blocks, including additional workflows'
test('combined image workflow cannot be missed before it is scheduled', async () => {
const workflow = readFileSync(join(__dirname, '../workflows/ci-images.yml'), 'utf8');
const triggers = [...workflow.matchAll(/paths: \[([^\]]+)\]/g)];
const expectedPaths = ['.github/workflows/ci-images.yml', 'ci/Dockerfile*', 'ci/targets.json', 'rust-toolchain.toml', 'Justfile'];
const expectedPaths = ['.github/workflows/ci-images.yml', '.github/workflows/ci-images-pr.yml',
'.github/workflows/ci-image-builds.yml', 'ci/image-targets.json', 'ci/Dockerfile*',
'ci/targets.json', 'rust-toolchain.toml', 'Justfile'];
assert.equal(triggers.length, 2);
for (const trigger of triggers) assert.deepEqual(JSON.parse('[' + trigger[1].replaceAll("'", '"') + ']'), expectedPaths);
const pr = readFileSync(join(__dirname, '../workflows/ci-images-pr.yml'), 'utf8');
assert.equal(pr.match(/paths: \[([^\]]+)\]/)[1], triggers[0][1]);
for (const filename of [
'ci/Dockerfile', 'ci/Dockerfile.cuda', 'ci/Dockerfile.gpu', 'ci/Dockerfile.gpu.dockerignore',
'ci/targets.json', 'rust-toolchain.toml', 'Justfile', '.github/workflows/ci-images.yml'
Expand Down Expand Up @@ -137,6 +141,8 @@ test('native CI and inference triggers match the internal route lists', () => {
const exclusion = code.findIndex(path => path.startsWith('!'));
assert.deepEqual(lists(prPaths), [...code.slice(0, exclusion), ...ciOnly, ...code.slice(exclusion)]);
assert.deepEqual(lists(targetPaths), lists(prPaths));
const depotPr = readFileSync(join(__dirname, '../workflows/ci-pr.yml'), 'utf8');
assert.deepEqual(lists(depotPr), lists(prPaths));
const includes = lists(prPaths).filter(path => !path.startsWith('!'));
for (const path of inference.filter(path => !path.startsWith('!'))) {
assert.ok(includes.some(trigger => trigger === path ||
Expand All @@ -156,6 +162,20 @@ test('same-repository PRs to main wait for the protected CI producer', async ()
assert.equal((await evaluate({ pr: fork, runs: [ordinary, inference] })).state, 'success');
});

test('Depot PR checks require each protected producer rather than its legacy run', async () => {
const files = [inferenceChange, { filename: 'ci/Dockerfile' }, { filename: 'docs-site/index.mdx' }];
const legacy = [run('ci.yml'), run('inference.yml'), run('ci-images.yml'), run('docs.yml')];
const protectedRuns = [run('ci-pr.yml'), run('inference.yml'), run('ci-images-pr.yml'), run('docs-pr.yml')];
assert.equal((await evaluate({ files, depot: true, runs: legacy })).state, 'pending');
assert.equal((await evaluate({ files, depot: true, runs: protectedRuns })).state, 'success');
assert.equal((await evaluate({ files, depot: true, runs: protectedRuns.slice(0, -1) })).state, 'pending');
assert.equal((await evaluate({ files, runs: legacy })).state, 'success');

const pr = { head: { sha, repo: { id: 42 } }, base: { ref: 'main', repo: { id: 42 } } };
const sameRepository = [run('ci.yml', 3, { event: 'pull_request_target' }), ...protectedRuns.slice(1)];
assert.equal((await evaluate({ files, pr, depot: true, runs: sameRepository })).state, 'success');
});

test('latest run and attempt govern reruns; old cancellations do not poison new results', async () => {
const runs = [run('ci.yml'), run('inference.yml', 2, { conclusion: 'cancelled' }), run('inference.yml', 3)];
assert.equal((await evaluate({ runs })).state, 'success');
Expand Down
7 changes: 4 additions & 3 deletions .github/scripts/pr-trigger-paths.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ function workflowPaths(workflow, eventName) {
return rules;
}

function expectedWorkflows(files, sameRepositoryPR = false) {
function expectedWorkflows(files, sameRepositoryPR = false, depot = false) {
const filenames = files.flatMap(({ filename, previous_filename }) => [filename, previous_filename]).filter(Boolean);
const expected = new Map();
for (const [workflow, defaultEvent] of producers) {
const eventName = workflow === 'ci.yml' && sameRepositoryPR ? 'pull_request_target' : defaultEvent;
const rules = workflowPaths(workflow, eventName);
const producer = depot && eventName === 'pull_request' ? workflow.replace('.yml', '-pr.yml') : workflow;
const rules = workflowPaths(producer, eventName);
// GitHub applies matching path patterns in order, with the last match
// determining whether each changed file is included.
if (filenames.some(filename => rules.findLast(rule => rule.regex.test(filename))?.include)) {
expected.set(`.github/workflows/${workflow}`, eventName);
expected.set(`.github/workflows/${producer}`, eventName);
}
}
return expected;
Expand Down
Loading
Loading