Index of every page on this site: llms.txt
All skills
Run it yourself

Audits a repository's GitHub Actions workflows for CI optimization opportunities — missing caches, redundant setup, sleep-based readiness, long test jobs without sharding, full-history checkout, dead env vars, build-cache misconfig, and ~60 more patterns across caching, redundancy, parallelization, conditional execution, trigger scope, and hidden failures. Use when: (1) analyzing a repo's CI for optimization opportunities, (2) producing a prioritized report with measured wall-clock and runner-minute savings, (3) re-auditing after upstream CI changes. Do not trigger for: general CI setup help, writing new workflows from scratch, non-GitHub-Actions CI systems, or security/posture audits — use `ci-secure` for those.

Use this Skill: https://skilld.dev/gh/starslingdev/skills/ci-speedup

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencespatternsopt24-long-test-job-without-sharding.md

≈1.8k tokens on demand. Your agent reads this file only when SKILL.md points to it.

OPT24 — Long Test Job Without Sharding

TL;DR: A test job runs for many minutes as one big job; splitting it into parallel shards would finish it far sooner.

Anti-pattern: A single test job running all tests sequentially when the test framework supports sharding.

Detection heuristic:

  • Identify test jobs with wall-clock time >5 minutes
  • Check if the test framework supports sharding (Playwright --shard, vitest --shard)
  • Check if sharding is configured
  • For go test / go test -coverprofile, require sampled package summaries to show that one package owns at least 60% of the package time and of the job's P50. Missing summaries and balanced packages are not classified. A matrix value reaching go test -run / -skip counts as an existing shard only when the split is a verified partition: the filter values are distinct and, for the one literal package (resolved against the step's working directory), every Test/Fuzz function in its *_test.go files runs in exactly one leg. A provable non-partition (a repeated value, a single leg, or a test that runs in no leg or in several) is classified normally and the finding names the test or value. A split that cannot be checked (generated or file-fed values, a wildcard or unreadable package, subtest filters, build-constrained tests) produces no finding and is listed as held back because the partition could not be verified; it is never reported as verified.

Fix: First measure the worker count inside the existing job with OPT88 and use its idle cores safely. Only then add matrix-based sharding. E.g., Playwright: --shard=${{ matrix.shard }}/${{ strategy.job-total }}. When the split pieces are few and each leg would repeat a large setup, running the shards as a parallel: step group inside the one job is the alternative: setup is paid once and no new check names appear. But in-job shards share one runner's cores, and most test runners already use every core, so the saving is often near zero; separate jobs or a matrix are what add machines (OPT77's fix covers the syntax and runner requirement; OPT75's covers the independence checklist and why the saving is an upper bound until benchmarked).

Go has no native suite-shard flag. For one dominant package, first list its test names with go test -list, using the same build tags and flags (-race, -tags) as the run, then partition that exact list exhaustively and disjointly and give each matrix leg an anchored -run expression applied to that package only. Every other package the step tests runs unfiltered in exactly one leg, so every test still runs exactly once. Keep the old required check name on an always() aggregate job that fails unless every leg succeeded. A coverage gate additionally needs one atomic profile per shard, artifact upload from every leg, profile merging only after all legs succeed, and the unchanged threshold applied to the merged profile. Public examples split a race suite into four legs in openclaw/crabbox#2455, split a normal CLI test run into four partitions in openclaw/crabbox#2875, and cut a coverage gate from 20m06s to 10m13s while increasing summed coverage runner time about 46.5% in openclaw/crabbox#2810.

Required-checks caveat: if the job you're sharding is a required status check (a merge gate — which the long pole usually is), the new shard jobs must be added to branch protection as required checks (or the ruleset equivalent), or the sharded-out test work silently stops gating merges — everything stays green while the gate no longer actually runs it. The split isn't complete until the new jobs gate the merge, and re-establishing that gating is usually an admin-only step. If the split routes the old check's work behind a needs: edge and an aggregator, see OPT75's dependency-failure skip caveat — a dependent skipped by a failed dependency reports skipped, not failed, so the aggregator must run with always() (not !cancelled(), which a cancelled run skips) and propagate every needs.<job>.result, and keeping the required check name on that aggregator re-gates the merge without an admin.

Wall-clock vs runner-minutes: Sharding splits only the measured test execution across PARALLEL jobs. First subtract compilation and other pre-test work that every shard repeats. A compiled-language step with no measurable compile/test split is a measure-first opportunity with no credited saving. For N shards, repeated pre-test work adds roughly (N−1) × the pre-test floor in runner-minutes. Sharding can still lower wall-clock when enough test payload remains, but the bill axis must include that repeated floor. Note diminishing returns: sharding floors at the per-job fixed overhead, so it must be stacked with cache fixes that attack that overhead (warm build cache, dependency cache, browser-binary cache) — past a certain shard count the setup tax dominates and adding shards stops moving wall-clock. See wall-clock-methodology.md §7.

When the existing runner is already saturated, extra shard jobs buy wall clock only by spending runner-minutes: every job repeats checkout, setup, and any in-step compile before its tests. Safe in-job workers come first because they can lower both wall clock and runner-minutes without adding that per-job tax.

Partition-correctness caveat: a sharded split is only as safe as its guards, and the failure mode is silent — everything stays green while coverage quietly drops. Whichever shape the fix takes (matrix job, in-job parallel: step group, or a hand-rolled background-process split), the agent's own tests must prove, not assume: (1) the shards partition the input set exactly — every item (page, test file, spec) is covered by exactly one shard across every valid shard count, not left out or doubled up by an off-by-one in the index math; (2) the shard count is validated where it is read, in every step that reads it — an empty, zero, or non-numeric count must fail the job loudly rather than silently running zero shards or one shard that claims the whole sweep; (3) a documented rollback to a lower shard count (often 1) does not itself defeat the guard tests — if the tests hardcode or derive their expectations from the current shard count instead of exercising the real script/workflow logic at an independent count, dialing the count down for an incident silently turns the new guard tests into no-ops at exactly the moment they're needed; and (4) a result-collection step that merges per-shard verdicts keeps every failure, not just the first or last one it sees. A split that passes functionally but fails any of these checks is a finding that found a problem, not a safe win — report it as unverified.


Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 alert2d3 checks · Risk SAFE
  • Gen Agent Trust Hub2d

    The skill is a robust CI optimization tool that audits GitHub Actions workflows. It identifies performance bottlenecks using deterministic logic and provides analysis of job logs. While it processes untrusted log data, it includes strong defensive instructions to mitigate indirect prompt injection. A minor best-practice issue regarding unsafe YAML loading was identified in a utility script.

  • Socket2d

    No alerts

  • Snyk2d

    Risk: CRITICAL · 2 issues

Signed by skilld at 9a84115. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 16 hours ago.

Activeupdated yesterday

README badge

README badge for starslingdev/skills/ci-speedup